From 280d03daa754d59f5a7c5335af4cc1ffc2b099a1 Mon Sep 17 00:00:00 2001 From: git Date: Tue, 8 Mar 2016 09:52:30 +1300 Subject: [PATCH] Fix names --- .../src/mineplex/core/CustomTagFix.java | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java index 4f8199ed7..6f14c0810 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java @@ -265,7 +265,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook _entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName); _entityMap.get(owner.getName()).put(spawnPacket.a, ids); - sendProtocolPackets(owner, spawnPacket.a, ids[1], entityName, verifier, true, ids[0]); + sendProtocolPackets(owner, spawnPacket.a, entityName, verifier, true, ids); break; } } @@ -302,17 +302,16 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook return; } - int newId = UtilEnt.getNewEntityId(); - int newId2 = UtilEnt.getNewEntityId(); + Integer[] ids = new Integer[] + { + UtilEnt.getNewEntityId(), + UtilEnt.getNewEntityId() + }; _entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName); - _entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[] - { - newId, - newId2 - }); + _entityMap.get(owner.getName()).put(spawnPacket.a, ids); - sendProtocolPackets(owner, spawnPacket.a, newId2, entityName, verifier, true, newId); + sendProtocolPackets(owner, spawnPacket.a, entityName, verifier, true, ids); break; } } @@ -372,8 +371,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook } _entityNameMap.get(owner.getName()).put(metaPacket.a, newName); - sendProtocolPackets(owner, metaPacket.a, newId[1], newName, verifier, !isDisplaying, - !isDisplaying ? newId[0] : -1); + sendProtocolPackets(owner, metaPacket.a, newName, verifier, !isDisplaying, newId); } else { // Lets delete it @@ -486,14 +484,14 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook _entityRiding.get(owner.getName()).remove(attachPacket.b); - sendProtocolPackets(owner, vehicleId, ids[1], _entityNameMap.get(owner.getName()).get(vehicleId), verifier, - true, ids[0]); + sendProtocolPackets(owner, vehicleId, _entityNameMap.get(owner.getName()).get(vehicleId), verifier, true, + ids); } else { Integer[] ids = _entityMap.get(owner.getName()).get(attachPacket.c); - if (ids != null && ids[0] != attachPacket.b) + if (ids != null && ids[1] != attachPacket.b) { _entityRiding.get(owner.getName()).put(attachPacket.b, attachPacket.c); @@ -511,8 +509,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook } } - private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, String entityName, - final PacketVerifier packetList, final boolean newPacket, final int squidId) + private void sendProtocolPackets(final Player owner, final int entityId, String entityName, final PacketVerifier packetList, + final boolean newPacket, final Integer[] entityIds) { CustomTagEvent event = new CustomTagEvent(owner, entityId, entityName); _plugin.getServer().getPluginManager().callEvent(event); @@ -532,7 +530,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook if (newPacket) { - if (squidId >= 0) { watcher.watch(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); @@ -540,7 +537,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook squidWatcher.a(0, (byte) (0 | 1 << 5), Entity.META_ENTITYDATA, (byte) (0 | 1 << 5)); PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(); - spawnPacket.a = squidId; + spawnPacket.a = entityIds[1]; spawnPacket.b = (byte) EntityType.SQUID.getTypeId(); spawnPacket.c = 1000000; @@ -558,7 +555,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook } PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(); - spawnPacket.a = newEntityId; + spawnPacket.a = entityIds[0]; spawnPacket.b = (byte) 30; spawnPacket.c = 1000000; @@ -569,15 +566,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity(); vehiclePacket.a = 0; - vehiclePacket.b = spawnPacket.a; - vehiclePacket.c = squidId >= 0 ? squidId : entityId; + vehiclePacket.b = entityIds[0]; + vehiclePacket.c = entityIds[1]; UtilPlayer.sendPacket(owner, vehiclePacket); } else { PacketPlayOutEntityMetadata entityMetadata = new PacketPlayOutEntityMetadata(); - entityMetadata.a = newEntityId; + entityMetadata.a = entityIds[0]; entityMetadata.b = watcher.c(); packetList.bypassProcess(entityMetadata);