fixed leak

This commit is contained in:
Cheese 2015-11-29 01:25:15 +11:00
parent b6f6d4458e
commit 51227ae4f3

View File

@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -152,6 +153,8 @@ public class MorphTitan extends MorphGadget
//Sound //Sound
stand.getWorld().playSound(stand.getLocation(), Sound.ZOMBIE_REMEDY, 6f, 0.75f); stand.getWorld().playSound(stand.getLocation(), Sound.ZOMBIE_REMEDY, 6f, 0.75f);
stand.remove();
} }
//Disguise //Disguise
@ -215,4 +218,24 @@ public class MorphTitan extends MorphGadget
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
} }
} }
@EventHandler
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
Iterator<Player> playerIter = _targets.keySet().iterator();
while (playerIter.hasNext())
{
Player player = playerIter.next();
if (!player.isOnline())
{
Entity ent = _targets.get(player);
ent.remove();
playerIter.remove();
}
}
} }