From a40b001ed04ba679ddb83803b10966142a13399d Mon Sep 17 00:00:00 2001 From: GB6 Date: Fri, 5 Apr 2019 16:00:10 +0200 Subject: [PATCH] - Improved the info menus again. --- .../com/songoda/epicenchants/menus/InfoMenu.java | 2 +- .../songoda/epicenchants/objects/BookItem.java | 2 +- .../com/songoda/epicenchants/objects/Group.java | 1 + .../epicenchants/utils/single/ConfigParser.java | 1 + core/src/main/resources/groups.yml | 15 ++++++++++----- .../main/resources/menus/groups/elite-menu.yml | 1 + .../resources/menus/groups/legendary-menu.yml | 1 + .../main/resources/menus/groups/simple-menu.yml | 1 + .../main/resources/menus/groups/ultimate-menu.yml | 1 + .../main/resources/menus/groups/unique-menu.yml | 1 + core/src/main/resources/menus/main-info-menu.yml | 10 +++++----- 11 files changed, 24 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/songoda/epicenchants/menus/InfoMenu.java b/core/src/main/java/com/songoda/epicenchants/menus/InfoMenu.java index 8f51db4..e10aca6 100644 --- a/core/src/main/java/com/songoda/epicenchants/menus/InfoMenu.java +++ b/core/src/main/java/com/songoda/epicenchants/menus/InfoMenu.java @@ -47,7 +47,7 @@ public class InfoMenu extends FastInv { of("max_level", enchant.getMaxLevel()), of("applicable_to", whitelist), of("enchant", enchant.getIdentifier()), - of("description", enchant.getDescription())).build()); + of("description", enchant.getDescription().stream().map(s -> config.getString("enchant-item.description-color") + s).collect(Collectors.toList()))).build()); }); if (config.isConfigurationSection("contents")) diff --git a/core/src/main/java/com/songoda/epicenchants/objects/BookItem.java b/core/src/main/java/com/songoda/epicenchants/objects/BookItem.java index e7572f0..c971acd 100644 --- a/core/src/main/java/com/songoda/epicenchants/objects/BookItem.java +++ b/core/src/main/java/com/songoda/epicenchants/objects/BookItem.java @@ -50,7 +50,7 @@ public class BookItem { if (string.contains("{description}")) { toSet.remove(i); - toSet.addAll(i, enchant.getDescription().stream().map(GeneralUtils::color).collect(Collectors.toList())); + toSet.addAll(i, enchant.getDescription().stream().map(s -> enchant.getGroup().getDescriptionColor() + s).map(GeneralUtils::color).collect(Collectors.toList())); continue; } diff --git a/core/src/main/java/com/songoda/epicenchants/objects/Group.java b/core/src/main/java/com/songoda/epicenchants/objects/Group.java index f21eabc..eda73d5 100644 --- a/core/src/main/java/com/songoda/epicenchants/objects/Group.java +++ b/core/src/main/java/com/songoda/epicenchants/objects/Group.java @@ -10,6 +10,7 @@ public class Group { private String name; private String format; private String color; + private String descriptionColor; private int slotsUsed; private BookItem bookItem; private int destroyRateMin, destroyRateMax, successRateMin, successRateMax; diff --git a/core/src/main/java/com/songoda/epicenchants/utils/single/ConfigParser.java b/core/src/main/java/com/songoda/epicenchants/utils/single/ConfigParser.java index ccdcbd7..aa8231c 100644 --- a/core/src/main/java/com/songoda/epicenchants/utils/single/ConfigParser.java +++ b/core/src/main/java/com/songoda/epicenchants/utils/single/ConfigParser.java @@ -85,6 +85,7 @@ public class ConfigParser { .name(color(section.getString("group-name"))) .format(section.getString("group-lore-format")) .color(section.getString("group-color")) + .descriptionColor(section.getString("description-color")) .bookItem(parseBookItem(instance, section.getConfigurationSection("book-item"))) .slotsUsed(section.getInt("slots-used")) .tinkererExp(section.getInt("tinkerer-exp-per-level")) diff --git a/core/src/main/resources/groups.yml b/core/src/main/resources/groups.yml index 51f5675..ed46f1b 100644 --- a/core/src/main/resources/groups.yml +++ b/core/src/main/resources/groups.yml @@ -1,9 +1,10 @@ groups: SIMPLE: order: 0 - group-color: "&f" + group-color: "&7&l&n" group-name: "Simple" group-lore-format: "{group_color}{enchant} {level}" + description-color: "&e" rates: destroy-min: 10 destroy-max: 100 @@ -20,9 +21,10 @@ groups: - "&7Drag and drop to enchant." UNIQUE: order: 1 - group-color: "&a" + group-color: "&a&l&n" group-name: "Unique" group-lore-format: "{group_color}{enchant} {level}" + description-color: "&e" rates: destroy-min: 10 destroy-max: 100 @@ -39,9 +41,10 @@ groups: - "&7Drag and drop to enchant." ELITE: order: 2 - group-color: "&b" + group-color: "&b&l&n" group-name: "Elite" group-lore-format: "{group_color}{enchant} {level}" + description-color: "&e" rates: destroy-min: 10 destroy-max: 100 @@ -58,9 +61,10 @@ groups: - "&7Drag and drop to enchant." ULTIMATE: order: 3 - group-color: "&e" + group-color: "&e&l&n" group-name: "Ultimate" group-lore-format: "{group_color}{enchant} {level}" + description-color: "&e" rates: destroy-min: 10 destroy-max: 100 @@ -77,9 +81,10 @@ groups: - "&7Drag and drop to enchant." LEGENDARY: order: 4 - group-color: "&6" + group-color: "&6&l&n" group-name: "Legendary" group-lore-format: "{group_color}{enchant} {level}" + description-color: "&e" rates: destroy-min: 10 destroy-max: 100 diff --git a/core/src/main/resources/menus/groups/elite-menu.yml b/core/src/main/resources/menus/groups/elite-menu.yml index 375ab4b..970170a 100644 --- a/core/src/main/resources/menus/groups/elite-menu.yml +++ b/core/src/main/resources/menus/groups/elite-menu.yml @@ -8,6 +8,7 @@ slots: "ALL_SLOTS" group: ELITE enchant-item: + description-color: "&f" material: "PAPER" display-name: "{group_color}{enchant}" lore: diff --git a/core/src/main/resources/menus/groups/legendary-menu.yml b/core/src/main/resources/menus/groups/legendary-menu.yml index 4d03079..8cfc111 100644 --- a/core/src/main/resources/menus/groups/legendary-menu.yml +++ b/core/src/main/resources/menus/groups/legendary-menu.yml @@ -8,6 +8,7 @@ slots: "ALL_SLOTS" group: LEGENDARY enchant-item: + description-color: "&f" material: "PAPER" display-name: "{group_color}{enchant}" lore: diff --git a/core/src/main/resources/menus/groups/simple-menu.yml b/core/src/main/resources/menus/groups/simple-menu.yml index 21777e0..33c227b 100644 --- a/core/src/main/resources/menus/groups/simple-menu.yml +++ b/core/src/main/resources/menus/groups/simple-menu.yml @@ -8,6 +8,7 @@ slots: "ALL_SLOTS" group: SIMPLE enchant-item: + description-color: "&f" material: "PAPER" display-name: "{group_color}{enchant}" lore: diff --git a/core/src/main/resources/menus/groups/ultimate-menu.yml b/core/src/main/resources/menus/groups/ultimate-menu.yml index ca6fc12..455b38b 100644 --- a/core/src/main/resources/menus/groups/ultimate-menu.yml +++ b/core/src/main/resources/menus/groups/ultimate-menu.yml @@ -8,6 +8,7 @@ slots: "ALL_SLOTS" group: ULTIMATE enchant-item: + description-color: "&f" material: "PAPER" display-name: "{group_color}{enchant}" lore: diff --git a/core/src/main/resources/menus/groups/unique-menu.yml b/core/src/main/resources/menus/groups/unique-menu.yml index c5904b9..00910f0 100644 --- a/core/src/main/resources/menus/groups/unique-menu.yml +++ b/core/src/main/resources/menus/groups/unique-menu.yml @@ -8,6 +8,7 @@ slots: "ALL_SLOTS" group: UNIQUE enchant-item: + description-color: "&f" material: "PAPER" display-name: "{group_color}{enchant}" lore: diff --git a/core/src/main/resources/menus/main-info-menu.yml b/core/src/main/resources/menus/main-info-menu.yml index 458abf6..e0bdf53 100644 --- a/core/src/main/resources/menus/main-info-menu.yml +++ b/core/src/main/resources/menus/main-info-menu.yml @@ -6,24 +6,24 @@ contents: material: "PAPER" display-name: "&f&lSimple Enchantments" group: SIMPLE - slot: 0 + slot: 2 2: material: "PAPER" display-name: "&a&lUnique Enchantments" group: UNIQUE - slot: 1 + slot: 3 3: material: "PAPER" display-name: "&b&lElite Enchantments" group: ELITE - slot: 2 + slot: 4 4: material: "PAPER" display-name: "&e&lUltimate Enchantments" group: ULTIMATE - slot: 3 + slot: 5 5: material: "PAPER" display-name: "&6&lLegendary Enchantments" group: LEGENDARY - slot: 4 + slot: 6