Added s placeholder to item cd message

This commit is contained in:
Indyuce 2022-10-16 21:59:19 +02:00
parent b1a2ae7cca
commit 69d3f8a962
2 changed files with 5 additions and 3 deletions

View File

@ -10,7 +10,7 @@ public enum Message {
// General restrictions
HANDS_TOO_CHARGED("You can't do anything, your hands are too charged.", "two-handed"),
SPELL_ON_COOLDOWN("#progress# &eYou must wait #left# second#s# before casting this spell.", "ability-cooldown"),
ITEM_ON_COOLDOWN("This item is on cooldown! Please wait #left#s.", "item-cooldown"),
ITEM_ON_COOLDOWN("This item is on cooldown! Please wait #left# second#s#.", "item-cooldown"),
NOT_ENOUGH_PERMS_COMMAND("You don't have enough permissions."),
// Item restrictions

View File

@ -71,8 +71,9 @@ public class ItemUse implements Listener {
if (event.getAction().name().contains("RIGHT_CLICK")) {
final String cooldownReference = getCooldownReference(useItem.getMMOItem());
if (useItem.getPlayerData().getMMOPlayerData().getCooldownMap().isOnCooldown(cooldownReference)) {
final double cd = useItem.getPlayerData().getMMOPlayerData().getCooldownMap().getCooldown(cooldownReference);
Message.ITEM_ON_COOLDOWN
.format(ChatColor.RED, "#left#", MythicLib.plugin.getMMOConfig().decimal.format(useItem.getPlayerData().getMMOPlayerData().getCooldownMap().getCooldown(cooldownReference)))
.format(ChatColor.RED, "#left#", MythicLib.plugin.getMMOConfig().decimal.format(cd), "#s#", cd >= 2 ? "s" : "")
.send(player);
event.setUseItemInHand(Event.Result.DENY);
return;
@ -317,8 +318,9 @@ public class ItemUse implements Listener {
final String cooldownReference = getCooldownReference(useItem.getMMOItem());
if (useItem.getPlayerData().getMMOPlayerData().getCooldownMap().isOnCooldown(cooldownReference)) {
final double cd = useItem.getPlayerData().getMMOPlayerData().getCooldownMap().getCooldown(cooldownReference);
Message.ITEM_ON_COOLDOWN
.format(ChatColor.RED, "#left#", MythicLib.plugin.getMMOConfig().decimal.format(useItem.getPlayerData().getMMOPlayerData().getCooldownMap().getCooldown(cooldownReference)))
.format(ChatColor.RED, "#left#", MythicLib.plugin.getMMOConfig().decimal.format(cd), "#s#", cd >= 2 ? "s" : "")
.send(player);
event.setCancelled(true);
return;