From 11bd4804f43489972c7170dc101301ad73a55407 Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 23 Nov 2013 11:03:52 +1100 Subject: [PATCH] skeleton/wolf removal on death --- .../game/arcade/kit/perks/PerkSkeletons.java | 16 ++++++++++++++++ .../game/arcade/kit/perks/PerkWolfPet.java | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index 9e7a85419..da442bfc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -12,9 +12,11 @@ import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Wolf; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.PlayerDeathEvent; import mineplex.core.common.util.C; 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", "Damage", damage, false); } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + ArrayList skels = _minions.remove(event.getEntity()); + + if (skels == null) + return; + + for (Skeleton skel : skels) + skel.remove(); + + skels.clear(); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index e2987f5bb..149a4104d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -18,6 +18,7 @@ import org.bukkit.entity.Wolf; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; @@ -295,4 +296,18 @@ public class PerkWolfPet extends Perk } } } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + ArrayList wolves = _wolfMap.remove(event.getEntity()); + + if (wolves == null) + return; + + for (Wolf wolf : wolves) + wolf.remove(); + + wolves.clear(); + } }