diff --git a/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/CosmeticsLocale.java b/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/CosmeticsLocale.java index ce5bda3..12775d7 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/CosmeticsLocale.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/CosmeticsLocale.java @@ -23,7 +23,7 @@ public enum CosmeticsLocale implements IDataAccessor { FIREWORKS_MATERIAL("KILL-EFFECTS.FIREWORKS.MATERIAL", DataType.STRING, "FIREWORK_ROCKET"), DEFAULT_MESSAGE("KILL_MESSAGES.DEFAULT.DISPLAY_NAME", DataType.STRING, "&7Default"), DEFAULT_MESSAGE_MATERIAL("KILL_MESSAGES.DEFAULT.MATERIAL", DataType.STRING, "BARRIER"), - DEFAULT_MESSAGE_DESCRIPTION("KILL_MESSAGES.DEFAULT.DESCRIPTION", DataType.STRING_LIST, "&7Default kill message."), + DEFAULT_MESSAGE_DESCRIPTION("KILL_MESSAGES.DEFAULT.DESCRIPTION", DataType.STRING_LIST, "&7Default kill message.", " "), DEFAULT_MESSAGE_SLOT("KILL_MESSAGES.DEFAULT.SLOT", DataType.INT, "10"), DEFAULT_MESSAGE_MESSAGES("KILL_MESSAGES.DEFAULT.MESSAGES", DataType.STRING_LIST, "&c☠ &7was killed by \uD83D\uDDE1 "); diff --git a/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/MenusLocale.java b/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/MenusLocale.java index b6b1a37..176871e 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/MenusLocale.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/configs/impl/MenusLocale.java @@ -318,7 +318,7 @@ public enum MenusLocale implements IDataAccessor { KILL_EFFECTS_SIZE("SETTINGS.KILL-EFFECTS.SIZE", DataType.INT, "27"), KILL_EFFECTS_FILTER("SETTINGS.KILL-EFFECTS.FILTER-TYPE", "FILL, BORDER, NONE", DataType.STRING, "FILL"), KILL_EFFECTS_SELECTED_LORE("SETTINGS.KILL-EFFECTS.SELECTED.LORE", DataType.STRING_LIST, - " ", "&cClick to unselect"), + " ", "&eCurrently Selected"), KILL_EFFECTS_UNSELECTED_LORE("SETTINGS.KILL-EFFECTS.UNSELECTED.LORE", DataType.STRING_LIST, " ", "&aClick to select"), KILL_EFFECTS_NO_PERMISSION_LORE("SETTINGS.KILL-EFFECTS.NO-PERMISSION.LORE", DataType.STRING_LIST, @@ -348,7 +348,22 @@ public enum MenusLocale implements IDataAccessor { KILL_MESSAGES_SLOT("SETTINGS.COSMETICS.KILL-MESSAGES.SLOT", DataType.INT, "11"), KILL_MESSAGES_NAME("SETTINGS.COSMETICS.KILL-MESSAGES.NAME", DataType.STRING, "&bKill Messages"), KILL_MESSAGES_MATERIAL("SETTINGS.COSMETICS.KILL-MESSAGES.MATERIAL", DataType.STRING, "BOOK"), - KILL_MESSAGES_LORE("SETTINGS.COSMETICS.KILL-MESSAGES.LORE", DataType.STRING_LIST, "&7View all available kill messages", " ", "&aClick to open"); + KILL_MESSAGES_LORE("SETTINGS.COSMETICS.KILL-MESSAGES.LORE", DataType.STRING_LIST, "&7View all available kill messages", " ", "&aClick to open"), + KILL_MESSAGES_SELECTED_LORE("SETTINGS.KILL-MESSAGES.SELECTED.LORE", DataType.STRING_LIST, + " ", + "", + " ", + "&eCurrently Selected"), + KILL_MESSAGES_UNSELECTED_LORE("SETTINGS.KILL-MESSAGES.UNSELECTED.LORE", DataType.STRING_LIST, + " ", + "", + " ", + "&aClick to select"), + KILL_MESSAGES_NO_PERMISSION_LORE("SETTINGS.KILL-MESSAGES.NO-PERMISSION.LORE", DataType.STRING_LIST, + " ", + "", + " ", + "&cNo permission"); private final String path; private final String comment; diff --git a/Plugin/src/main/java/dev/lrxh/neptune/cosmetics/menu/killMessages/KillMessageButton.java b/Plugin/src/main/java/dev/lrxh/neptune/cosmetics/menu/killMessages/KillMessageButton.java index 7daa5c1..d4c0b37 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/cosmetics/menu/killMessages/KillMessageButton.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/cosmetics/menu/killMessages/KillMessageButton.java @@ -4,7 +4,9 @@ import dev.lrxh.neptune.configs.impl.MenusLocale; import dev.lrxh.neptune.cosmetics.impl.KillMessagePackage; import dev.lrxh.neptune.profile.Profile; +import dev.lrxh.neptune.providers.clickable.Replacement; import dev.lrxh.neptune.utils.ItemBuilder; +import dev.lrxh.neptune.utils.ItemUtils; import dev.lrxh.neptune.utils.menu.Button; import lombok.AllArgsConstructor; import org.bukkit.entity.Player; @@ -25,14 +27,16 @@ public ItemStack getButtonItem(Player player) { List lore; if (player.hasPermission(killMessagePackage.permission())) { - lore = selected ? MenusLocale.KILL_EFFECTS_SELECTED_LORE.getStringList() : MenusLocale.KILL_EFFECTS_UNSELECTED_LORE.getStringList(); + lore = selected ? MenusLocale.KILL_MESSAGES_SELECTED_LORE.getStringList() : MenusLocale.KILL_MESSAGES_UNSELECTED_LORE.getStringList(); } else { - lore = MenusLocale.KILL_EFFECTS_NO_PERMISSION_LORE.getStringList(); + lore = MenusLocale.KILL_MESSAGES_NO_PERMISSION_LORE.getStringList(); } return new ItemBuilder(killMessagePackage.getMaterial()).name(killMessagePackage.getDisplayName() .replace("", selected ? CosmeticsLocale.SELECTED_DISPLAY_NAME.getString() : "")) - .lore(lore) + .lore(ItemUtils.getLore(lore, + new Replacement("", killMessagePackage.getDescription()), + new Replacement("", killMessagePackage.getMessages()))) .clearFlags() .build(); } diff --git a/Plugin/src/main/java/dev/lrxh/neptune/utils/ItemUtils.java b/Plugin/src/main/java/dev/lrxh/neptune/utils/ItemUtils.java index 3393c22..5b8d36a 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/utils/ItemUtils.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/utils/ItemUtils.java @@ -111,19 +111,29 @@ public List deserialize(String base64) { return items; } + @SuppressWarnings("unchecked") public List getLore(List lore, Replacement... replacements) { List newLore = new ArrayList<>(); - lore.forEach(line -> { + for (String line : lore) { + boolean skip = false; for (Replacement replacement : replacements) { if (replacement.getReplacement() instanceof String) { line = line.replaceAll(replacement.getPlaceholder(), (String) replacement.getReplacement()); + }else if (replacement.getReplacement() instanceof List) { + if(line.contains(replacement.getPlaceholder())) { + List replacementList = (List) replacement.getReplacement(); + for (String replacementLine : replacementList) { + newLore.add(line.replaceAll(replacement.getPlaceholder(), replacementLine)); + } + skip = true; + } } else if (replacement.getReplacement() instanceof Integer) { line = line.replaceAll(replacement.getPlaceholder(), String.valueOf(replacement.getReplacement())); } } - newLore.add(line); - }); + if(!skip) newLore.add(line); + } return newLore; }