mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Avoid NPE for rotationtrait removal
This commit is contained in:
parent
ccf4f6b085
commit
ea2df83ca5
@ -14,6 +14,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.PacketType.Play.Server;
|
||||
@ -248,9 +249,16 @@ public class ProtocolLibListener implements Listener {
|
||||
return entity instanceof NPCHolder ? ((NPCHolder) entity).getNPC() : null;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
rotationTraits.remove(event.getEntity().getEntityId());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onNPCDespawn(NPCDespawnEvent event) {
|
||||
rotationTraits.remove(event.getNPC().getEntity().getEntityId());
|
||||
if (event.getNPC().getEntity() != null) {
|
||||
rotationTraits.remove(event.getNPC().getEntity().getEntityId());
|
||||
}
|
||||
mirrorTraits.remove(event.getNPC().getEntity().getUniqueId());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user