Fix for Arcade Kit NPC Names in 1.8

This commit is contained in:
Shaun Bennett 2014-10-18 21:15:53 -05:00
parent ffc2ff5058
commit 1394e33056
2 changed files with 10 additions and 32 deletions

View File

@ -118,13 +118,13 @@ public class Arcade extends JavaPlugin
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, true);
cosmeticManager.setInterfaceSlot(7);
new CustomTagFix(this, packetHandler);
//Arcade Manager
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, webServerAddress);
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
new MemoryFix(this);
new CustomTagFix(this, packetHandler);
new FriendManager(this, preferenceManager);

View File

@ -69,8 +69,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.KitSorter;
import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R4.WatchableObject;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
public class GameLobbyManager implements Listener, IPacketHandler
{
@ -1086,16 +1085,16 @@ public class GameLobbyManager implements Listener, IPacketHandler
{
if (_handlingPacket)
return;
Packet packet = packetInfo.getPacket();
Player owner = packetInfo.getPlayer();
PacketVerifier packetVerifier = packetInfo.getVerifier();
int entityId = -1;
if (packet instanceof PacketPlayOutEntityMetadata)
if (packet instanceof PacketPlayOutSpawnEntityLiving)
{
entityId = ((PacketPlayOutEntityMetadata)packet).a;
entityId = ((PacketPlayOutSpawnEntityLiving)packet).a;
}
if (entityId != -1)
@ -1116,33 +1115,12 @@ public class GameLobbyManager implements Listener, IPacketHandler
{
try
{
if (packet instanceof PacketPlayOutEntityMetadata)
if (packet instanceof PacketPlayOutSpawnEntityLiving)
{
List<WatchableObject> watchables = new ArrayList<WatchableObject>();
for (WatchableObject watchableObject : (List<WatchableObject>)((PacketPlayOutEntityMetadata) packet).b)
{
WatchableObject newWatch = new WatchableObject(watchableObject.c(), watchableObject.a(), watchableObject.b());
if (newWatch.a() == 10)
{
newWatch.a(customName);
}
watchables.add(newWatch);
}
PacketPlayOutEntityMetadata newPacket = new PacketPlayOutEntityMetadata();
newPacket.a = entityId;
newPacket.b = watchables;
_handlingPacket = true;
packetVerifier.process(newPacket);
_handlingPacket = false;
packetInfo.setCancelled(true);
((PacketPlayOutSpawnEntityLiving)packet).l.watch(2, customName);
((PacketPlayOutSpawnEntityLiving)packet).l.watch(10, customName);
}
}
}
catch (IllegalArgumentException e)
{
e.printStackTrace();