use of gg.projecteden.nexus.framework.exceptions.postconfigured.CommandCooldownException in project Nexus by ProjectEdenGG.
the class ICustomCommand method checkCooldown.
private void checkCooldown(CustomCommand command, Cooldown cooldown, String commandId) {
if (cooldown != null) {
boolean bypass = false;
if (!(command.getEvent().getSender() instanceof Player))
bypass = true;
else if (cooldown.bypass().length() > 0 && command.getEvent().getPlayer().hasPermission(cooldown.bypass()))
bypass = true;
if (!bypass) {
int ticks = cooldown.value().x(cooldown.x());
CooldownService service = new CooldownService();
UUID uuid = cooldown.global() ? UUID0 : ((Player) command.getEvent().getSender()).getUniqueId();
String type = "command:" + commandId;
if (!service.check(uuid, type, ticks))
throw new CommandCooldownException(uuid, type);
}
}
}
use of gg.projecteden.nexus.framework.exceptions.postconfigured.CommandCooldownException in project Nexus by ProjectEdenGG.
the class DailyRewardsCommand method reset.
@Confirm
@Path("reset [player]")
void reset(@Arg(value = "self", permission = Group.ADMIN) DailyRewardUser user) {
try {
if (!new CooldownService().check(player(), resetCooldownType, TickTime.DAY))
throw new CommandCooldownException(player(), resetCooldownType);
user.endStreak();
service.save(user);
send(player(), PREFIX + "Your streak has been cleared");
player().closeInventory();
} catch (CommandCooldownException ex) {
send(player(), ex.getMessage());
}
}
Aggregations