Merge branch 'master' of ssh://198.245.50.91:7999/min/master

This commit is contained in:
Chiss 2013-09-02 09:35:44 +10:00
commit 4607b2fdcd

View File

@ -85,19 +85,21 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
}
}
public boolean isDisguised(LivingEntity entity)
{
return _spawnPacketMap.containsKey(entity.getEntityId());
}
public DisguiseBase getDisguise(LivingEntity entity)
{
return _spawnPacketMap.get(entity.getEntityId());
}
public void Disguise(DisguiseBase disguise)
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(disguise.GetEntityId()));
entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket());
}
_spawnPacketMap.put(disguise.GetEntityId(), disguise);
reApplyDisguise(disguise);
}
public void Undisguise(LivingEntity entity)
@ -128,6 +130,47 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
_moveTempMap.remove(entity.getEntityId());
}
public void reApplyDisguise(final DisguiseBase disguise)
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(disguise.GetEntityId()));
}
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
{
public void run()
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket());
}
}
});
}
public void updateDisguise(DisguiseBase disguise)
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(disguise.GetMetaDataPacket());
}
}
@EventHandler
public void ChunkUnload(ChunkUnloadEvent event)
{