Fix memory leak in ItemSnowball
This commit is contained in:
parent
2ed03147b0
commit
38ef65c32e
@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilText;
|
|||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.gadgets.Ammo;
|
import mineplex.core.gadget.gadgets.Ammo;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class ItemSnowball extends ItemGadget
|
public class ItemSnowball extends ItemGadget
|
||||||
{
|
{
|
||||||
@ -59,4 +61,12 @@ public class ItemSnowball extends ItemGadget
|
|||||||
event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f);
|
event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void cleanup(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_snowballs.entrySet().removeIf(ent -> !ent.getKey().isValid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user