Inform players of the ender pearl cooldown

This commit is contained in:
Sam 2017-12-10 16:05:52 +00:00 committed by Alexander Meech
parent d885f83159
commit 96263ebf5b

View File

@ -29,10 +29,12 @@ import mineplex.core.updater.event.UpdateEvent;
public class EnderPearlModule extends Module public class EnderPearlModule extends Module
{ {
private static final int DEFAULT_COOLDOWN = 500;
private final Map<Player, Projectile> _pearls; private final Map<Player, Projectile> _pearls;
private int _maxTicks = Integer.MAX_VALUE; private int _maxTicks = Integer.MAX_VALUE;
private long _cooldown = 500; private long _cooldown = DEFAULT_COOLDOWN;
public EnderPearlModule() public EnderPearlModule()
{ {
@ -62,7 +64,7 @@ public class EnderPearlModule extends Module
Player player = event.getPlayer(); Player player = event.getPlayer();
ItemStack itemStack = player.getItemInHand(); ItemStack itemStack = player.getItemInHand();
if (itemStack != null && itemStack.getType() == Material.ENDER_PEARL && !Recharge.Instance.use(player, "Ender Pearl", _cooldown, false, false)) if (itemStack != null && itemStack.getType() == Material.ENDER_PEARL && !Recharge.Instance.use(player, "Ender Pearl", _cooldown, _cooldown > DEFAULT_COOLDOWN, false))
{ {
event.setCancelled(true); event.setCancelled(true);
} }