From 695d7065ad40d9769f745efd549a0154b7f8d23f Mon Sep 17 00:00:00 2001 From: bananasmoothii <45853225+bananasmoothii@users.noreply.github.com> Date: Mon, 30 Aug 2021 15:19:56 +0200 Subject: [PATCH 1/3] Fixed a typo in conflicts that caused a NPE When running /enchantinfo IceLord, you could get [Server] INFO Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.enchantments.Enchantment.getKey()" because "enchantment1" is null [Server] INFO at com.willfp.ecoenchants.command.CommandEnchantinfo.lambda$getHandler$3(CommandEnchantinfo.java:94) ~[EcoEnchants v8.9.5.jar:?] --- .../biomes/src/main/resources/enchants/normal/icelord.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml index ffcc9c27..4064b4a5 100644 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml +++ b/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml @@ -26,7 +26,7 @@ general-config: list: [] not-met-lore: [] conflicts: - - altitide + - altitude - aquamarine - dehydration - rainforest From 9ec4c5b04aabe3b2be4e9e2f7e7d9f63c128b7ed Mon Sep 17 00:00:00 2001 From: bananasmoothii <45853225+bananasmoothii@users.noreply.github.com> Date: Mon, 30 Aug 2021 15:30:16 +0200 Subject: [PATCH 2/3] Added a rarity placeholder --- .../com/willfp/ecoenchants/command/CommandEnchantinfo.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java index c777d8d7..79e1e92d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java @@ -9,6 +9,7 @@ import com.willfp.eco.util.StringUtils; import com.willfp.ecoenchants.display.EnchantmentCache; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; +import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; import org.apache.commons.lang.WordUtils; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -139,12 +140,14 @@ public class CommandEnchantinfo extends PluginCommand { final String finalName = EnchantmentCache.getEntry(enchantment).getName(); final String finalDescription = EnchantmentCache.getEntry(enchantment).getStringDescription(1); + final EnchantmentRarity finalRarity = enchantment.getRarity(); final String finalTargets = allTargets; final String finalConflicts = allConflicts; final String finalMaxLevel = maxLevel; Arrays.asList(this.getPlugin().getLangYml().getMessage("enchantinfo").split("\\r?\\n")).forEach((string -> { string = string.replace("%name%", finalName) .replace("%description%", finalDescription) + .replace("%rarity%", finalRarity.getName()) .replace("%target%", finalTargets) .replace("%conflicts%", finalConflicts) .replace("%maxlevel%", finalMaxLevel); From 40e0dc15cef92200eca537b952d388fe005fc719 Mon Sep 17 00:00:00 2001 From: bananasmoothii <45853225+bananasmoothii@users.noreply.github.com> Date: Mon, 30 Aug 2021 15:41:27 +0200 Subject: [PATCH 3/3] Actually used the rarity placeholder --- eco-core/core-plugin/src/main/resources/lang.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index c72fbe5a..1fad5c0f 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -13,6 +13,7 @@ messages: not-found: "&cCannot find an enchantment matching name: &f%name%." enchantinfo: | %name%: &r%description% + &9Rarity: &r%rarity% &9Max Level: &r%maxlevel% &9Can be applied to: &r%target% &9Conflicts with: &r%conflicts%