From b15ff696825cf94feb37872e7d321a592cca4156 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 6 Apr 2020 16:50:12 -0400 Subject: [PATCH] Finalized F Cooldowns --- .../java/com/massivecraft/factions/cmd/CmdCreate.java | 10 +++++----- .../java/com/massivecraft/factions/cmd/CmdDisband.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java index ad39605a..c160163e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java @@ -54,6 +54,11 @@ public class CmdCreate extends FCommand { return; } + if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "createCooldown") && !context.fPlayer.isAdminBypassing()){ + context.msg(TL.COMMAND_COOLDOWN); + return; + } + ReserveObject factionReserve = FactionsPlugin.getInstance().getFactionReserves().stream().filter(factionReserve1 -> factionReserve1.getFactionName().equalsIgnoreCase(tag)).findFirst().orElse(null); if (factionReserve != null && !factionReserve.getName().equalsIgnoreCase(context.player.getName())) { context.msg(TL.COMMAND_CREATE_ALREADY_RESERVED); @@ -71,11 +76,6 @@ public class CmdCreate extends FCommand { return; } - if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "createCooldwn") && !context.fPlayer.isAdminBypassing()){ - context.msg(TL.COMMAND_COOLDOWN); - return; - } - // trigger the faction creation event (cancellable) FactionCreateEvent createEvent = new FactionCreateEvent(context.player, tag); Bukkit.getServer().getPluginManager().callEvent(createEvent); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java index 90179f16..724ec327 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java @@ -70,6 +70,11 @@ public class CmdDisband extends FCommand { return; } + if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "disbandCooldown") && !context.fPlayer.isAdminBypassing()){ + context.msg(TL.COMMAND_COOLDOWN); + return; + } + boolean access = false; if (context.fPlayer.getPlayer().hasMetadata("disband_confirm") && (time = context.fPlayer.getPlayer().getMetadata("disband_confirm").get(0).asLong()) != 0L && System.currentTimeMillis() - time <= TimeUnit.SECONDS.toMillis(3L)) { @@ -85,11 +90,6 @@ public class CmdDisband extends FCommand { } } - if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "disbandCooldown") && !context.fPlayer.isAdminBypassing()){ - context.msg(TL.COMMAND_COOLDOWN); - return; - } - // check for tnt before disbanding. if (!disbandMap.containsKey(context.player.getUniqueId().toString()) && faction.getTnt() > 0) { context.msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));