From e25a6e432790de5dc39d401fd544b8def03f7dc7 Mon Sep 17 00:00:00 2001 From: Thanos Paravantis Date: Wed, 29 Jun 2016 12:23:02 +0300 Subject: [PATCH] Reset leap data when needed (death/quit/game end) --- .../game/arcade/kit/perks/PerkLeap.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java index f971ae57a..035ffe685 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; @@ -18,6 +19,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; +import org.bukkit.event.player.PlayerQuitEvent; public class PerkLeap extends Perk { @@ -125,4 +127,22 @@ public class PerkLeap extends Perk PerkLeapEvent leapEvent = new PerkLeapEvent(player); UtilServer.getServer().getPluginManager().callEvent(leapEvent); } + + @EventHandler + public void removeDataOnQuit(PlayerQuitEvent event) + { + _uses.remove(event.getPlayer().getName()); + } + + @EventHandler + public void removeDataOnDeath(PlayerDeathEvent event) + { + _uses.remove(event.getEntity().getName()); + } + + @Override + public void unregisteredEvents() + { + _uses.clear(); + } }