Finalized F Cooldowns

This commit is contained in:
Driftay 2020-04-06 16:50:12 -04:00
parent 919a3ada25
commit b15ff69682
2 changed files with 10 additions and 10 deletions

View File

@ -54,6 +54,11 @@ public class CmdCreate extends FCommand {
return; 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); ReserveObject factionReserve = FactionsPlugin.getInstance().getFactionReserves().stream().filter(factionReserve1 -> factionReserve1.getFactionName().equalsIgnoreCase(tag)).findFirst().orElse(null);
if (factionReserve != null && !factionReserve.getName().equalsIgnoreCase(context.player.getName())) { if (factionReserve != null && !factionReserve.getName().equalsIgnoreCase(context.player.getName())) {
context.msg(TL.COMMAND_CREATE_ALREADY_RESERVED); context.msg(TL.COMMAND_CREATE_ALREADY_RESERVED);
@ -71,11 +76,6 @@ public class CmdCreate extends FCommand {
return; return;
} }
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "createCooldwn") && !context.fPlayer.isAdminBypassing()){
context.msg(TL.COMMAND_COOLDOWN);
return;
}
// trigger the faction creation event (cancellable) // trigger the faction creation event (cancellable)
FactionCreateEvent createEvent = new FactionCreateEvent(context.player, tag); FactionCreateEvent createEvent = new FactionCreateEvent(context.player, tag);
Bukkit.getServer().getPluginManager().callEvent(createEvent); Bukkit.getServer().getPluginManager().callEvent(createEvent);

View File

@ -70,6 +70,11 @@ public class CmdDisband extends FCommand {
return; return;
} }
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "disbandCooldown") && !context.fPlayer.isAdminBypassing()){
context.msg(TL.COMMAND_COOLDOWN);
return;
}
boolean access = false; 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)) { 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. // check for tnt before disbanding.
if (!disbandMap.containsKey(context.player.getUniqueId().toString()) && faction.getTnt() > 0) { if (!disbandMap.containsKey(context.player.getUniqueId().toString()) && faction.getTnt() > 0) {
context.msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + "")); context.msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));