diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java index 732b1ab79..f4ce9532e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java @@ -2,9 +2,10 @@ package mineplex.core.common.jsonchat; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; + import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutChat; - +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; public class JsonMessage @@ -123,7 +124,7 @@ public class JsonMessage for (Player player : players) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(chatPacket); + UtilPlayer.sendPacket(player, chatPacket); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java index 68db185a3..9df45eeac 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -19,6 +19,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.plugin.java.JavaPlugin; + import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.ChunkCoordIntPair; @@ -90,8 +91,8 @@ public class MapUtil //c.a(x & 0xF, y, z & 0xF, Block.getById(id), data); IBlockData blockData = CraftMagicNumbers.getBlock(id).fromLegacyData(data); - c.a(bp(x, y, z), blockData); - ((CraftWorld) world).getHandle().notify(bp(x, y, z)); + c.a(getBlockPos(x, y, z), blockData); + ((CraftWorld) world).getHandle().notify(getBlockPos(x, y, z)); } public static int GetHighestBlockInCircleAt(World world, int bx, int bz, int radius) @@ -146,7 +147,7 @@ public class MapUtil Block.getById(id), data)) { if (notifyPlayers) - ((CraftWorld) world).getHandle().notify(bp(x, y, z)); + ((CraftWorld) world).getHandle().notify(getBlockPos(x, y, z)); } } @@ -158,7 +159,7 @@ public class MapUtil private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_8_R3.Chunk chunk, Block block, byte data) { - chunk.a(bp(x, y, z), block.fromLegacyData(data)); + chunk.a(getBlockPos(x, y, z), block.fromLegacyData(data)); return true; // todo? // return chunk.a(x, y, z, block, data); } @@ -180,8 +181,8 @@ public class MapUtil Player player) { // System.out.println("Sending MultiBlockChunk " + x + ", " + z); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutMultiBlockChange(dirtyCount, - dirtyBlocks, ((CraftWorld) world).getHandle().getChunkAt(x, z))); + UtilPlayer.sendPacket(player, new PacketPlayOutMultiBlockChange(dirtyCount, dirtyBlocks, ((CraftWorld) world).getHandle() + .getChunkAt(x, z))); } public static void UnloadWorld(JavaPlugin plugin, World world) @@ -284,7 +285,7 @@ public class MapUtil return true; } - public static BlockPosition bp(int x, int y, int z) + public static BlockPosition getBlockPos(int x, int y, int z) { return new BlockPosition(x, y, z); } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 4f7f10e5d..c78b8144c 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -5,22 +5,29 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import net.minecraft.server.v1_8_R3.AxisAlignedBB; import net.minecraft.server.v1_8_R3.EntityBat; import net.minecraft.server.v1_8_R3.EntityCreature; import net.minecraft.server.v1_8_R3.EntityEnderDragon; import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityLiving; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; import net.minecraft.server.v1_8_R3.NavigationAbstract; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; import net.minecraft.server.v1_8_R3.PathfinderGoal; import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer; import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction; import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround; import net.minecraft.server.v1_8_R3.PathfinderGoalSelector; +import net.minecraft.server.v1_8_R3.WorldServer; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.World; +import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; @@ -32,6 +39,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.util.Vector; public class UtilEnt { @@ -51,9 +59,9 @@ public class UtilEnt return _nameMap; } - public static void silence(LivingEntity entity, boolean silence) + public static void silence(Entity entity, boolean silence) { - ((CraftLivingEntity)entity).getHandle().setSilent(silence); + ((CraftEntity)entity).getHandle().setSilent(silence); } public static void ghost(Entity entity, boolean ghost, boolean invisible) @@ -491,10 +499,14 @@ public class UtilEnt public static boolean isGrounded(Entity ent) { - if (ent instanceof CraftEntity) - return ((CraftEntity)ent).getHandle().onGround; - - return UtilBlock.solid(ent.getLocation().getBlock().getRelative(BlockFace.DOWN)); + AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox(); + Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c); + Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f); + + for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){ + if(UtilBlock.solid(b)) return true; + } + return false; } public static void PlayDamageSound(LivingEntity damagee) @@ -582,6 +594,37 @@ public class UtilEnt return false; } + public static boolean CreatureLook(Entity ent, Entity target) + { + return CreatureLook(ent, target instanceof LivingEntity ? ((LivingEntity) target).getEyeLocation() : target.getLocation()); + } + + public static boolean CreatureLook(Entity ent, Location target) + { + Vector vec = UtilAlg.getTrajectory(ent.getLocation(), target); + + return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec)); + } + + public static boolean CreatureLook(Entity ent, float pitch, float yaw) + { + if (!(ent instanceof LivingEntity)) + return false; + + EntityLiving ec = ((CraftLivingEntity) ent).getHandle(); + + ec.pitch = pitch; + ec.yaw = yaw; + ec.aK = yaw; + ec.ai = true; + + EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.getWorld()).tracker.trackedEntities.get(ec.getId()); + + entry.broadcast(new PacketPlayOutEntityHeadRotation(ec, (byte) (ec.yaw * 256.0F / 360.0F))); + + return true; + } + public static void CreatureMove(Entity ent, Location target, float speed) { if (!(ent instanceof Creature)) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java index cb255ede2..38f242ce1 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java @@ -7,6 +7,7 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; + import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter; import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; @@ -50,7 +51,6 @@ public class UtilTabTitle public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter) { - CraftPlayer player = (CraftPlayer) p; IChatBaseComponent header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawHeader)); IChatBaseComponent footer = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawFooter)); if (header == null || footer == null) @@ -83,7 +83,7 @@ public class UtilTabTitle PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); packet.a = header; packet.b = footer; - player.getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(p, packet); } private static class TextConverter diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java index 3b12119ed..11b15bd21 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java @@ -105,7 +105,7 @@ public class UtilTextMiddle { for (Player player : players) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java index d65f04448..93595a1c4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java @@ -43,14 +43,14 @@ public class UtilTextTop { Location loc = player.getLocation().subtract(0, 200, 0); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(getDragonPacket(text, healthPercent, loc)); + UtilPlayer.sendPacket(player, getDragonPacket(text, healthPercent, loc)); } //Display Wither (as well as Dragon) Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24)); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(getWitherPacket(text, healthPercent, loc)); + UtilPlayer.sendPacket(player, getWitherPacket(text, healthPercent, loc)); //Remove Bukkit.getServer().getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugins()[0], new Runnable() @@ -69,14 +69,14 @@ public class UtilTextTop { EntityDragonId }); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(destroyDragonPacket); + UtilPlayer.sendPacket(player, destroyDragonPacket); // Delete Wither (1.8+ Only) PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(new int[] { EntityWitherId }); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(destroyWitherPacket); + UtilPlayer.sendPacket(player, destroyWitherPacket); } public static PacketPlayOutSpawnEntityLiving getDragonPacket(String text, double healthPercent, Location loc) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 37882635f..cd562f903 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -22,6 +22,7 @@ import org.bukkit.event.inventory.ClickType; import mineplex.core.account.CoreClientManager; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.PetSorter; @@ -169,11 +170,11 @@ public class PetPage extends ShopPageBase PetTagPage petTagPage = new PetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Repairing", getPlayer(), pet, petPurchase); EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle(); int containerCounter = entityPlayer.nextContainerCounter(); - entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0]))); + UtilPlayer.sendPacket(player, new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0]))); entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory()); entityPlayer.activeContainer.windowId = containerCounter; entityPlayer.activeContainer.addSlotListener(entityPlayer); - entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG))); + UtilPlayer.sendPacket(player, new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG))); getShop().setCurrentPageForPlayer(getPlayer(), petTagPage); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 128aec57f..b9dc85a8a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -82,8 +82,15 @@ public class PetTagPage extends ShopPageBase public void run() { PetChangeToken token = new PetChangeToken(); + + if (getClientManager().Get(getPlayer()) != null) + token.AccountId = getClientManager().Get(getPlayer()).getAccountId(); + else + token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId(); + token.Name = getPlayer().getName(); token.PetType = _pet.GetPetType().toString(); + token.PetId = _pet.GetPetType().ordinal(); token.PetName = _tagName; PetToken petToken = new PetToken(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index fcc6d7579..d2ed8e55b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -1028,7 +1028,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler continue; if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() != 0) - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport( + UtilPlayer.sendPacket(player, new PacketPlayOutEntityTeleport( ((CraftPlayer) otherPlayer).getHandle())); } } @@ -1083,9 +1083,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler if (disguise.GetEntity() == ((CraftPlayer) player).getHandle()) continue; - EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); - - entityPlayer.playerConnection.sendPacket(disguise.GetMetaDataPacket()); + UtilPlayer.sendPacket(player, disguise.GetMetaDataPacket()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java index bedbb4bbb..4990a63b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java @@ -3,6 +3,7 @@ package mineplex.core.friend.ui; import mineplex.core.command.CommandCenter; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.friend.FriendManager; import mineplex.core.itemstack.ItemBuilder; import net.minecraft.server.v1_8_R3.BlockPosition; @@ -158,7 +159,7 @@ public class AddFriendPage implements Listener PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(c, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0])); - p.playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(_player, packet); // Set their active container to the container p.activeContainer = container; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java index 88c161532..a370dc60a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java @@ -8,7 +8,6 @@ import java.util.Iterator; import java.util.Map.Entry; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -20,8 +19,8 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; - import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; public class Hologram { @@ -94,7 +93,7 @@ public class Hologram return _playersInList.contains(player); } - protected Packet getDestroyPacket(Player player) + protected Packet getDestroyPacket() { if (_makeDestroyPackets) { @@ -148,7 +147,7 @@ public class Hologram return _playersTracking; } - protected Packet[] getSpawnPackets(Player player) + protected Packet[] getSpawnPackets() { if (_makeSpawnPackets) { @@ -357,7 +356,7 @@ public class Hologram if (player.getWorld() == getLocation().getWorld()) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player)); + UtilPlayer.sendPacket(player, getDestroyPacket()); } } } @@ -371,10 +370,7 @@ public class Hologram _playersTracking.add(player); itel.remove(); - for (Packet packet : getSpawnPackets(player)) - { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } + UtilPlayer.sendPacket(player, getSpawnPackets()); } } if (!canSee.isEmpty()) @@ -432,7 +428,7 @@ public class Hologram { for (Packet packet : packets1_8) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } @@ -524,7 +520,7 @@ public class Hologram { for (Packet packet : packets1_8) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } @@ -556,10 +552,7 @@ public class Hologram for (Player player : _playersTracking) { - for (Packet packet : getSpawnPackets(player)) - { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } + UtilPlayer.sendPacket(player, getSpawnPackets()); } _lastMovement = new Vector(); @@ -578,7 +571,7 @@ public class Hologram for (Player player : _playersTracking) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player)); + UtilPlayer.sendPacket(player, getDestroyPacket()); } _playersTracking.clear(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java index 13c465bd7..8be93fc9a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.Packet; @@ -83,20 +84,18 @@ public class HologramManager implements Listener itel2.remove(); if (player.getWorld() == hologram.getLocation().getWorld()) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(hologram.getDestroyPacket(player)); + UtilPlayer.sendPacket(player, hologram.getDestroyPacket()); } } } for (Player player : canSee) - { - if (!hologram.getPlayersTracking().contains(player)) - { - hologram.getPlayersTracking().add(player); - for (Packet packet : hologram.getSpawnPackets(player)) - { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } - } + { + if (!hologram.getPlayersTracking().contains(player)) + { + hologram.getPlayersTracking().add(player); + + UtilPlayer.sendPacket(player, hologram.getSpawnPackets()); + } } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java index 9c922ee9b..0eb36e2d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java @@ -5,6 +5,7 @@ import org.bukkit.entity.Player; import com.mineplex.spigot.IPacketVerifier; +import mineplex.core.common.util.UtilPlayer; import net.minecraft.server.v1_8_R3.Packet; public class PacketVerifier implements IPacketVerifier @@ -30,7 +31,7 @@ public class PacketVerifier implements IPacketVerifier public void process(Packet packet) { - ((CraftPlayer) _owner).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(_owner, packet); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java index 91002f171..a2d5298b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java @@ -136,7 +136,7 @@ public class PollManager extends MiniDbClientPlugin textObject.add("hoverEvent", hoverObject); PacketPlayOutChat chatPacket = new PacketPlayOutChat(ChatSerializer.a(textObject.toString())); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(chatPacket); + UtilPlayer.sendPacket(player, chatPacket); } } player.sendMessage(""); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java index 383df9150..b8015e525 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java @@ -294,6 +294,20 @@ public class PunishPage extends CraftInventoryCustom implements Listener }, 1, false, true), new PunishButton(this, Category.ChatOffense, 4, false, -1)); } + if (_plugin.GetClients().Get(_player).GetRank() == Rank.DEVELOPER || _plugin.GetClients().Get(_player).GetRank() == Rank.JNR_DEV) + { + ShopItem devWarning = new ShopItem(Material.YELLOW_FLOWER, "DEV WARNING", new String[] {ChatColor.RESET + "Developers are advised against using the punish system", ChatColor.RESET + "unless permitted by LT"}, 1, true, true); + devWarning.addGlow(); + + AddButton(0, devWarning, new IButton() + { + @Override + public void onClick(Player player, ClickType clickType) + { + } + }); + } + Collections.sort(punishments, new PunishmentSorter()); int slot = 45; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 8203daa28..94a9d012f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -21,6 +21,7 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.hologram.HologramManager; @@ -266,7 +267,7 @@ public class Treasure for (Player player : players) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java index 352d4a192..ca906d891 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java @@ -10,11 +10,12 @@ import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.util.Vector; + import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; import net.minecraft.server.v1_8_R3.TileEntity; import net.minecraft.server.v1_8_R3.TileEntityEnderChest; - +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; @@ -47,7 +48,7 @@ public class ChestOpenAnimation extends Animation CraftMagicNumbers.getBlock(block), 1, 1); for (Player other : UtilServer.getPlayers()) { - ((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(other, packet); if (block.getType() == Material.ENDER_CHEST) { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java index 6ad2ffae8..421c50231 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java @@ -6,6 +6,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; @@ -16,6 +17,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.explosion.ExplosionEvent; import mineplex.minecraft.game.core.damage.DamageManager; import net.minecraft.server.v1_8_R3.AxisAlignedBB; @@ -428,7 +430,7 @@ public class CustomExplosion extends Explosion PacketPlayOutExplosion explosion = new PacketPlayOutExplosion(this.posX, this.posY, this.posZ, this._blockExplosionSize, new ArrayList(), null); for (Player p : Bukkit.getOnlinePlayers()) - ((CraftPlayer) p).getHandle().playerConnection.sendPacket(explosion); + UtilPlayer.sendPacket(p, explosion); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index 86020436f..a508ff1cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -405,7 +405,7 @@ public class Christmas extends SoloGame player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), 20f, 1F); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } @@ -423,7 +423,7 @@ public class Christmas extends SoloGame player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), 20f, 1F); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } @@ -676,7 +676,7 @@ public class Christmas extends SoloGame 10f, 1.2F); for (Player player : UtilServer.getPlayers()) - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java index 3532981b7..10a772184 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java @@ -170,8 +170,8 @@ public class SleighHorse enquipPacket.a = id; enquipPacket.b = 4; enquipPacket.c = CraftItemStack.asNMSCopy(new ItemStack(Material.DEAD_BUSH)); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(enquipPacket); + UtilPlayer.sendPacket(player, packet); + UtilPlayer.sendPacket(player, enquipPacket); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index bcdd888a9..d4a083d94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -614,7 +614,7 @@ public class Halloween extends SoloGame player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), 20f, 1F); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java index 47e693c76..0ebd75ca8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java @@ -341,9 +341,6 @@ public class BlockForm extends Form public void FallingBlockCheck() { - - EntityPlayer player = ((CraftPlayer) Player).getHandle(); - // Block Form (Hide Falling) if (_block == null) { @@ -374,9 +371,8 @@ public class BlockForm extends Form _sawDiff = new Vector(); } - player.playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(Player, packet); } - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index 86d636ea4..f06f1d2dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -353,7 +353,7 @@ public class GamePlayerManager implements Listener if (player.isOnline()) { Manager.GetGame().SetKit(player, kit, true); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true)); + UtilPlayer.sendPacket(player, new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true)); } } }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 3301364c5..570ea9ea3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -244,7 +244,7 @@ public class HolidayManager implements Listener CraftMagicNumbers.getBlock(block), 1, 1); for (Player other : UtilServer.getPlayers()) - ((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(other, packet); } private Block findSpecialBlockLocation(Game game)