From 54c03e40db914937fb65ba44903b79a9868d3166 Mon Sep 17 00:00:00 2001 From: Simon Chuu Date: Sat, 11 Aug 2018 03:42:00 -0400 Subject: [PATCH] Fix phantom removal upon their death (no EXP). Relase 1.0.1 No snapshot version 1.1 yet. --- build.gradle | 2 +- .../simonorj/mc/phantomsmp/PhantomSMP.java | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 5523be7..c13883d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'com.simonorj.mc.phantomsmp' -version '1.1-SNAPSHOT' +version '1.0.1' sourceCompatibility = 1.8 diff --git a/src/main/java/com/simonorj/mc/phantomsmp/PhantomSMP.java b/src/main/java/com/simonorj/mc/phantomsmp/PhantomSMP.java index fc9e393..3ef5b19 100644 --- a/src/main/java/com/simonorj/mc/phantomsmp/PhantomSMP.java +++ b/src/main/java/com/simonorj/mc/phantomsmp/PhantomSMP.java @@ -86,17 +86,6 @@ private void addPhantom(Phantom phantom, Player newTarget, Cancellable e) { phantomPlayerMap.put(phantom, p); } - private void removePhantom(Phantom phantom) { - Player p = phantomPlayerMap.remove(phantom); - if (p == null) - return; - - playerPhantomMap.get(p).remove(phantom); - - if (phantom.getCustomName() == null) - phantom.remove(); - } - private void removePlayerPhantom(Player p) { Iterator i = playerPhantomMap.get(p).iterator(); while(i.hasNext()) { @@ -184,7 +173,13 @@ public void phantomDied(EntityDeathEvent e) { if (!(e.getEntity() instanceof Phantom)) return; - removePhantom((Phantom) e.getEntity()); + Phantom phantom = (Phantom) e.getEntity(); + + Player p = phantomPlayerMap.remove(phantom); + if (p == null) + return; + + playerPhantomMap.get(p).remove(phantom); } } }