From 74a7388701f982e6ecde1144859c22b5b6ef4ee1 Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Mon, 31 Dec 2018 14:27:05 +0100 Subject: [PATCH] Make enchantments case insensitive. Lowercasing the enchantment string before feeding it to the Bukkit API makes the enchantments a little more "copy/paste proof" when grabbing the uppercased names from the JavaDocs/Minecraft wiki. --- changelog.md | 1 + src/main/java/com/garbagemule/MobArena/util/ItemParser.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 21eedc7..3168f6d 100644 --- a/changelog.md +++ b/changelog.md @@ -15,6 +15,7 @@ These changes will (most likely) be included in the next version. - Unbreakable weapons and armor now use the unbreakable item flag instead of item durability and on-hit repairs. This means that MobArena's unbreakable items are now compatible with plugins that depend on special durability values, such as QualityArmory. - Spectators can no longer take damage when the arena isn't running. - Pets can now teleport back to their owners if they get too far away. +- Enchantment names are now case insensitive (i.e. `FIRE_PROTECTION` is the same as `fire_protection`). ## [0.103] - 2018-08-28 - It is now possible to add a fixed delay (in seconds) between waves with the new per-arena setting `next-wave-delay`. diff --git a/src/main/java/com/garbagemule/MobArena/util/ItemParser.java b/src/main/java/com/garbagemule/MobArena/util/ItemParser.java index 8e09960..98d4f0d 100644 --- a/src/main/java/com/garbagemule/MobArena/util/ItemParser.java +++ b/src/main/java/com/garbagemule/MobArena/util/ItemParser.java @@ -160,6 +160,6 @@ public class ItemParser } private static Enchantment getEnchantment(String ench) { - return Enchantment.getByKey(NamespacedKey.minecraft(ench)); + return Enchantment.getByKey(NamespacedKey.minecraft(ench.toLowerCase())); } }