Reset leap data when needed (death/quit/game end)

This commit is contained in:
Thanos Paravantis 2016-06-29 12:23:02 +03:00 committed by cnr
parent 5c60819179
commit e25a6e4327

View File

@ -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();
}
}