fix: only allow FakePlayer to get killed once
This commit is contained in:
parent
7e194171e8
commit
ed0a66c7cd
1 changed files with 6 additions and 0 deletions
|
@ -51,6 +51,7 @@ public class NPCManager {
|
||||||
|
|
||||||
private final Varo plugin;
|
private final Varo plugin;
|
||||||
private final ArrayList<EntityPlayer> npcs = new ArrayList<EntityPlayer>();
|
private final ArrayList<EntityPlayer> npcs = new ArrayList<EntityPlayer>();
|
||||||
|
private final ArrayList<Integer> isDying = new ArrayList<Integer>();
|
||||||
private final HashMap<UUID, PlayerInventory> inventories = new HashMap<UUID, PlayerInventory>();
|
private final HashMap<UUID, PlayerInventory> inventories = new HashMap<UUID, PlayerInventory>();
|
||||||
private final Scoreboard scoreboard;
|
private final Scoreboard scoreboard;
|
||||||
private Team afkTeam;
|
private Team afkTeam;
|
||||||
|
@ -175,6 +176,10 @@ public class NPCManager {
|
||||||
if (isCritical)
|
if (isCritical)
|
||||||
world.playSound(loc, Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0F, 1.0F);
|
world.playSound(loc, Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0F, 1.0F);
|
||||||
} else {
|
} else {
|
||||||
|
if (this.isDying.contains(npc.getId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.isDying.add(npc.getId());
|
||||||
// Send Death Animation Packet
|
// Send Death Animation Packet
|
||||||
for (final Player connectionPlayer : Bukkit.getOnlinePlayers()) {
|
for (final Player connectionPlayer : Bukkit.getOnlinePlayers()) {
|
||||||
final PlayerConnection connection = ((CraftPlayer) connectionPlayer)
|
final PlayerConnection connection = ((CraftPlayer) connectionPlayer)
|
||||||
|
@ -225,6 +230,7 @@ public class NPCManager {
|
||||||
connection.sendPacket(new PacketPlayOutEntityDestroy(npc.getId()));
|
connection.sendPacket(new PacketPlayOutEntityDestroy(npc.getId()));
|
||||||
}
|
}
|
||||||
this.npcs.remove(npc);
|
this.npcs.remove(npc);
|
||||||
|
this.isDying.remove(npc.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue