skeleton/wolf removal on death

This commit is contained in:
Chiss 2013-11-23 11:03:52 +11:00
parent 8752a7a6ac
commit 11bd4804f4
2 changed files with 31 additions and 0 deletions

View File

@ -12,9 +12,11 @@ import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
@ -250,4 +252,18 @@ public class PerkSkeletons extends Perk
event.AddMod("Skeleton Minion", "Negate", -event.GetDamageInitial(), false); event.AddMod("Skeleton Minion", "Negate", -event.GetDamageInitial(), false);
event.AddMod("Skeleton Minion", "Damage", damage, false); event.AddMod("Skeleton Minion", "Damage", damage, false);
} }
@EventHandler
public void PlayerDeath(PlayerDeathEvent event)
{
ArrayList<Skeleton> skels = _minions.remove(event.getEntity());
if (skels == null)
return;
for (Skeleton skel : skels)
skel.remove();
skels.clear();
}
} }

View File

@ -18,6 +18,7 @@ import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -295,4 +296,18 @@ public class PerkWolfPet extends Perk
} }
} }
} }
@EventHandler
public void PlayerDeath(PlayerDeathEvent event)
{
ArrayList<Wolf> wolves = _wolfMap.remove(event.getEntity());
if (wolves == null)
return;
for (Wolf wolf : wolves)
wolf.remove();
wolves.clear();
}
} }