Make some minor adjustments

This commit is contained in:
Morphan1 2015-03-10 03:40:25 -04:00
parent b20a0d4b4b
commit b0f7fb4348

View File

@ -283,24 +283,27 @@ public class EventListen implements Listener {
new BukkitRunnable() {
@Override
public void run() {
Player player = event.getPlayer();
final Player player = event.getPlayer();
if (player == null || !player.isValid())
return;
for (Entity entity : player.getNearbyEntities(72, 72, 72)) {
if (entity instanceof Player && npcRegistry.isNPC(entity)) {
final EntityPlayer entityplayer = ((CraftPlayer) player).getHandle();
final EntityPlayer entitynpc = ((CraftPlayer) entity).getHandle();
entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(
NMS.sendPacket(player, new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entitynpc));
new BukkitRunnable() {
@Override
public void run() {
entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(
if (!player.isValid())
return;
NMS.sendPacket(player, new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entitynpc));
}
}.runTaskLater(CitizensAPI.getPlugin(), 2);
}
}
}
}.runTaskLater(CitizensAPI.getPlugin(), 30);
}.runTaskLater(CitizensAPI.getPlugin(), 40);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)