Remove SG wolf pet on quit

This commit is contained in:
libraryaddict 2015-03-17 18:30:17 +13:00
parent ec30269a14
commit 06ebbbbc73

View File

@ -8,7 +8,6 @@ import org.bukkit.DyeColor;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
@ -16,13 +15,13 @@ import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWolf;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Wolf; 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.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -312,6 +311,20 @@ public class PerkWolfPet extends Perk
wolves.clear(); wolves.clear();
} }
@EventHandler
public void PlayerQuit(PlayerQuitEvent event)
{
ArrayList<Wolf> wolves = _wolfMap.remove(event.getPlayer());
if (wolves == null)
return;
for (Wolf wolf : wolves)
wolf.remove();
wolves.clear();
}
public boolean IsMinion(Entity ent) public boolean IsMinion(Entity ent)
{ {