Skip to content

Commit

Permalink
Fix phantom removal upon their death (no EXP). Relase 1.0.1
Browse files Browse the repository at this point in the history
No snapshot version 1.1 yet.
  • Loading branch information
chuushi committed Aug 11, 2018
1 parent 4efb83a commit 54c03e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group 'com.simonorj.mc.phantomsmp'
version '1.1-SNAPSHOT'
version '1.0.1'

sourceCompatibility = 1.8

Expand Down
19 changes: 7 additions & 12 deletions src/main/java/com/simonorj/mc/phantomsmp/PhantomSMP.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Phantom> i = playerPhantomMap.get(p).iterator();
while(i.hasNext()) {
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 54c03e4

Please sign in to comment.