diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java index eeaf89b60..fd6e988e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java @@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; 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); } + @EventHandler + public void cleanup(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + _snowballs.entrySet().removeIf(ent -> !ent.getKey().isValid()); + } }