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
@ -178,11 +181,11 @@ public class MorphTitan extends MorphGadget
dir.multiply(8); dir.multiply(8);
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT,
player.getLocation().add(0, 1.5, 0), player.getLocation().add(0, 1.5, 0),
(float)dir.getX(), (float)dir.getX(),
(float)dir.getY(), (float)dir.getY(),
(float)dir.getZ(), (float)dir.getZ(),
1, 0, ViewDist.LONG, UtilServer.getPlayers()); 1, 0, ViewDist.LONG, UtilServer.getPlayers());
player.playSound(player.getLocation(), Sound.FIREWORK_TWINKLE2, 2f, 2f); player.playSound(player.getLocation(), Sound.FIREWORK_TWINKLE2, 2f, 2f);
} }
@ -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();
}
}
}