use of org.bukkit.craftbukkit.v1_8_R2.CraftServer in project DragonsOnline by UniverseCraft.
the class PlayerNPC116R3 method spawn.
public void spawn() {
registry.unregister(this);
uuid = UUID.randomUUID();
this.isDestroyed = false;
DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer();
WorldServer world = ((CraftWorld) location.getWorld()).getHandle();
// displayName);
GameProfile gameProfile = new GameProfile(uuid, "");
gameProfile.getProperties().clear();
gameProfile.getProperties().put("textures", new Property("textures", texture, signature));
this.handle = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager(world));
handle.persist = true;
handle.collides = false;
handle.setCustomNameVisible(false);
handle.setInvulnerable(npc.isImmortal());
handle.playerConnection = new PlayerConnection(((CraftServer) Bukkit.getServer()).getServer(), new NetworkManager(EnumProtocolDirection.SERVERBOUND), handle);
((CraftWorld) location.getWorld()).addEntity(handle, CreatureSpawnEvent.SpawnReason.CUSTOM);
handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
registry.register(this);
for (Entity e : getEntity().getNearbyEntities(SPAWN_RADIUS, SPAWN_RADIUS, SPAWN_RADIUS)) {
if (e instanceof Player) {
registry.updateSpawns((Player) e, true);
}
}
}
use of org.bukkit.craftbukkit.v1_8_R2.CraftServer in project Warlords by ebicep.
the class Warlords method onDisable.
@Override
public void onDisable() {
if (BotManager.task != null) {
BotManager.task.cancel();
}
try {
// Pre-caution
for (Player player : Bukkit.getOnlinePlayers()) {
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.getActivePotionEffects().clear();
player.removeMetadata("WARLORDS_PLAYER", this);
PacketUtils.sendTitle(player, "", "", 0, 0, 0);
}
} catch (Exception e) {
e.printStackTrace();
}
try {
CraftServer server = (CraftServer) Bukkit.getServer();
server.getEntityMetadata().invalidateAll(this);
server.getWorldMetadata().invalidateAll(this);
server.getPlayerMetadata().invalidateAll(this);
} catch (Exception e) {
e.printStackTrace();
}
try {
gameManager.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
if (holographicDisplaysEnabled) {
HolographicDisplaysAPI.get(instance).getHolograms().forEach(Hologram::delete);
}
} catch (Exception e) {
e.printStackTrace();
}
try {
NPCManager.gameStartNPC.destroy();
} catch (Exception e) {
e.printStackTrace();
}
try {
Bukkit.getWorld("MainLobby").getEntities().stream().filter(entity -> entity.getName().equals("capture-the-flag")).forEach(Entity::remove);
} catch (Exception e) {
e.printStackTrace();
}
try {
BotManager.deleteStatusMessage();
BotManager.jda.shutdownNow();
} catch (Exception e) {
e.printStackTrace();
}
getServer().getConsoleSender().sendMessage(ChatColor.RED + "[Warlords] Plugin is disabled");
// TODO persist this.playerSettings to a database
}
use of org.bukkit.craftbukkit.v1_8_R2.CraftServer in project CokesAddon by Cokes86.
the class v1_15_R1 method hide.
public void hide() {
getParticipant().attributes().TARGETABLE.setValue(false);
final CraftPlayer craftPlayer = (CraftPlayer) getPlayer();
craftPlayer.getHandle().getDataWatcher().set(new DataWatcherObject<>(10, DataWatcherRegistry.b), 0);
craftPlayer.getHandle().setInvisible(true);
final PacketPlayOutEntityEquipment[] packets = { new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.MAINHAND, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.OFFHAND, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.HEAD, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.CHEST, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.LEGS, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.FEET, ItemStack.a) };
for (CraftPlayer player : ((CraftServer) Bukkit.getServer()).getOnlinePlayers()) {
if (player.equals(getPlayer()))
continue;
for (PacketPlayOutEntityEquipment packet : packets) {
player.getHandle().playerConnection.sendPacket(packet);
}
injectPlayer(player);
}
}
use of org.bukkit.craftbukkit.v1_8_R2.CraftServer in project CokesAddon by Cokes86.
the class v1_12_R1 method hide.
public void hide() {
getParticipant().attributes().TARGETABLE.setValue(false);
final CraftPlayer craftPlayer = (CraftPlayer) getPlayer();
craftPlayer.getHandle().getDataWatcher().set(new DataWatcherObject<>(10, DataWatcherRegistry.b), 0);
craftPlayer.getHandle().setInvisible(true);
final PacketPlayOutEntityEquipment[] packets = { new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.MAINHAND, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.OFFHAND, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.HEAD, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.CHEST, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.LEGS, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.FEET, ItemStack.a) };
for (CraftPlayer player : ((CraftServer) Bukkit.getServer()).getOnlinePlayers()) {
if (player.equals(getPlayer()))
continue;
for (PacketPlayOutEntityEquipment packet : packets) {
player.getHandle().playerConnection.sendPacket(packet);
}
injectPlayer(player);
}
}
use of org.bukkit.craftbukkit.v1_8_R2.CraftServer in project CokesAddon by Cokes86.
the class v1_13_R1 method hide.
public void hide() {
getParticipant().attributes().TARGETABLE.setValue(false);
final CraftPlayer craftPlayer = (CraftPlayer) getPlayer();
craftPlayer.getHandle().getDataWatcher().set(new DataWatcherObject<>(10, DataWatcherRegistry.b), 0);
craftPlayer.getHandle().setInvisible(true);
final PacketPlayOutEntityEquipment[] packets = { new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.MAINHAND, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.OFFHAND, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.HEAD, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.CHEST, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.LEGS, ItemStack.a), new PacketPlayOutEntityEquipment(getPlayer().getEntityId(), EnumItemSlot.FEET, ItemStack.a) };
for (CraftPlayer player : ((CraftServer) Bukkit.getServer()).getOnlinePlayers()) {
if (player.equals(getPlayer()))
continue;
for (PacketPlayOutEntityEquipment packet : packets) {
player.getHandle().playerConnection.sendPacket(packet);
}
injectPlayer(player);
}
}
Aggregations