Skip to content

Commit

Permalink
/ce limit Improvement
Browse files Browse the repository at this point in the history
Add ore information to /ce limit to help users understand what all of the current limits are.
  • Loading branch information
TrueDarkLord committed Feb 10, 2024
1 parent b5cbf5c commit dffb151
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,17 @@ public enum Messages {
RAGE_DAMAGED("Rage.Damaged", "&7[&c&lRage&7]: &cYou have been hurt and it broke your Rage Multiplier!"),
INVALID_ITEM_STRING("Invalid-Item-String", "&cInvalid item string supplied."),
LIMIT_COMMAND("Limit-Command", Arrays.asList(
"&0======================================",
"&8[&aCrazyEnchants&8]: &bPersonal Enchantment Limit:",
" ",
"&7Bypass Limit: &6%bypass%",
"&7Vanilla Enchantment Check: &6%vanilla%",
"&7Max Enchantment Limit: &6%limit%",
"&7Current Enchantment amount on item: &6%item%")),
"&7Base Enchantment Limit: &6%baseLimit%",
"&7Current Items Slot Crystal Limit Adjustment: &6%slotCrystal%",
"&7Current Enchantment amount on item: &6%item%",
"&7You can add &6%space% &7more enchantments to this item.",
"&0======================================")),
HELP("Help", Arrays.asList(
"&2&l&nCrazy Enchantments",
"&b/ce - &9Opens up the menu.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,21 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
placeholders.put("%bypass%", String.valueOf(sender.hasPermission("crazyenchantments.bypass.limit")));

assert sender instanceof Player;
placeholders.put("%limit%", String.valueOf(crazyManager.getPlayerMaxEnchantments((Player) sender)));
Player player = (Player) sender;
ItemStack item = player.getInventory().getItemInMainHand();

int limit = crazyManager.getPlayerMaxEnchantments(player);
int baseLimit = crazyManager.getPlayerBaseEnchantments(player);
int slotModifier = item.isEmpty() ? 0 : crazyManager.getEnchantmentLimiter(item);

int canAdd = Math.min(baseLimit - slotModifier, limit);

placeholders.put("%limit%", String.valueOf(limit));
placeholders.put("%baseLimit%", String.valueOf(baseLimit));
placeholders.put("%vanilla%", String.valueOf(crazyManager.checkVanillaLimit()));
placeholders.put("%item%", String.valueOf(enchantmentBookSettings.getEnchantmentAmount(methods.getItemInHand((Player) sender), crazyManager.checkVanillaLimit())));
placeholders.put("%item%", String.valueOf(item.isEmpty() ? 0 : enchantmentBookSettings.getEnchantmentAmount(item, crazyManager.checkVanillaLimit())));
placeholders.put("%slotCrystal%", String.valueOf(-slotModifier));
placeholders.put("%space%", String.valueOf(canAdd));

sender.sendMessage(Messages.LIMIT_COMMAND.getMessage(placeholders));
}
Expand Down
6 changes: 6 additions & 0 deletions paper/src/main/resources/Messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ Messages:
Rage-Up: '&7[&c&lRage&7]: &7You are now doing &a%level%x &7Damage.'
Damaged: '&7[&c&lRage&7]: &cYou have been hurt and it broke your Rage Multiplier!'
Limit-Command:
- '&0======================================'
- '&8[&aCrazyEnchants&8]: &bPersonal Enchantment Limit:'
- ' '
- '&7Bypass Limit: &6%bypass%'
- '&7Vanilla Enchantment Check: &6%vanilla%'
- '&7Max Enchantment Limit: &6%limit%'
- '&7Base Enchantment Limit: &6%baseLimit%'
- '&7Current Items Slot Crystal Limit Adjustment: &6%slotCrystal%'
- '&7Current Enchantment amount on item: &6%item%'
- '&7You can add &6%space% &7more enchantments to this item.'
- '&0======================================'
Help:
- '&2&l&nCrazy Enchantments'
- '&b/ce - &9Opens up the menu.'
Expand Down

0 comments on commit dffb151

Please sign in to comment.