EssentialsX

EssentialsX

2M Downloads

Error when trying to enchant certain items

pop4959 opened this issue ยท 1 comments

commented

Information

Full output of /ess version:

> essentials version
[14:59:51 INFO]: CONSOLE issued server command: /essentials version
[14:59:51 INFO]: Server version: 1.15.1-R0.1-SNAPSHOT git-Paper-32 (MC: 1.15.1)
[14:59:51 INFO]: EssentialsX version: 2.17.1.47
[14:59:51 INFO]: LuckPerms version: 4.4.1
[14:59:51 INFO]: Vault version: 1.7.2-b107
[14:59:51 INFO]: EssentialsXChat version: 2.17.1.47
[14:59:51 INFO]: EssentialsXGeoIP version: 2.17.1.47
[14:59:51 INFO]: EssentialsXAntiBuild version: 2.17.1.47
[14:59:51 INFO]: EssentialsXSpawn version: 2.17.1.47
[14:59:51 INFO]: EssentialsXProtect version: 2.17.1.47

Server log:

/essentials verbose on /item diamondpick 1 luck:1

[14:50:15 INFO]: Essentials 2.17.1.47 debug mode enabled
[14:50:15 INFO]: pop4959 issued server command: /item diamondpick 1 luck:1
[14:50:15 INFO]: [Essentials] checking if pop4959 has essentials.mail - true
[14:50:15 INFO]: [Essentials] checking if pop4959 has essentials.item - true
[14:50:15 INFO]: [Essentials] checking if pop4959 can afford charge.
[14:50:15 INFO]: [Essentials] calculated command (item) cost for pop4959 as 0
[14:50:15 INFO]: [Essentials] Trying resolver 'essentials:custom_items' for item 'diamondpick'...
[14:50:15 INFO]: [Essentials] checking if pop4959 has essentials.itemspawn.exempt - true
[14:50:15 INFO]: [Essentials] checking if pop4959 has essentials.enchantments.allowunsafe - true
[14:50:15 INFO]: [Essentials] checking if pop4959 has essentials.enchantments.luck - true
[14:50:15 INFO]: [Essentials] checking if pop4959 has essentials.oversizedstacks - true
[14:50:15 INFO]: [Essentials] attempting to charge user pop4959
[14:50:15 INFO]: [Essentials] calculated command (item) cost for pop4959 as 0
[14:50:15 INFO]: [Essentials] charge user pop4959 completed

tab completion when typing /enchant luck:0<anything here>

[14:50:56 ERROR]: [Essentials] Command enchant failed:
java.lang.IllegalArgumentException: Invalid key. Must be [a-z0-9/._-]: luck:0
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:49) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.NamespacedKey.minecraft(NamespacedKey.java:142) ~[patched_1.15.1.jar:git-Paper-32]
        at com.earth2me.essentials.Enchantments.getByName(Enchantments.java:267) ~[?:?]
        at com.earth2me.essentials.commands.Commandenchant.getTabCompleteOptions(Commandenchant.java:79) ~[?:?]
        at com.earth2me.essentials.commands.EssentialsCommand.tabComplete(EssentialsCommand.java:184) ~[?:?]
        at com.earth2me.essentials.Essentials.onTabCompleteEssentials(Essentials.java:454) ~[?:?]
        at com.earth2me.essentials.Essentials.onTabComplete(Essentials.java:393) ~[?:?]
        at org.bukkit.command.PluginCommand.tabComplete(PluginCommand.java:141) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.command.Command.tabComplete(Command.java:93) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.command.SimpleCommandMap.tabComplete(SimpleCommandMap.java:244) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.tabCompleteCommand(CraftServer.java:1719) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.tabComplete(CraftServer.java:1691) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.craftbukkit.v1_15_R1.command.BukkitCommandWrapper.getSuggestions(BukkitCommandWrapper.java:49) ~[patched_1.15.1.jar:git-Paper-32]
        at com.mojang.brigadier.tree.ArgumentCommandNode.listSuggestions(ArgumentCommandNode.java:71) ~[patched_1.15.1.jar:git-Paper-32]
        at com.mojang.brigadier.CommandDispatcher.getCompletionSuggestions(CommandDispatcher.java:596) ~[patched_1.15.1.jar:git-Paper-32]
        at com.mojang.brigadier.CommandDispatcher.getCompletionSuggestions(CommandDispatcher.java:579) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.PlayerConnection.lambda$a$3(PlayerConnection.java:566) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.aZ(MinecraftServer.java:1037) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:1030) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1096) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:933) ~[patched_1.15.1.jar:git-Paper-32]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

/essentials verbose on /enchant luck:0

[14:53:27] [Server thread/INFO]: pop4959 issued server command: /enchant luck:0
[14:53:27] [Server thread/INFO]: [Essentials] checking if pop4959 has essentials.mail - true
[14:53:27] [Server thread/INFO]: [Essentials] checking if pop4959 has essentials.enchant - true
[14:53:27] [Server thread/INFO]: [Essentials] checking if pop4959 can afford charge.
[14:53:27] [Server thread/INFO]: [Essentials] calculated command (enchant) cost for pop4959 as 0
[14:53:27] [Server thread/INFO]: [Essentials] checking if pop4959 has essentials.enchantments.allowunsafe - true
[14:53:27] [Server thread/INFO]: [Essentials] Error calling the command /enchant
java.lang.IllegalArgumentException: Invalid key. Must be [a-z0-9/._-]: luck:0
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:49) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.NamespacedKey.minecraft(NamespacedKey.java:142) ~[patched_1.15.1.jar:git-Paper-32]
        at com.earth2me.essentials.Enchantments.getByName(Enchantments.java:267) ~[?:?]
        at com.earth2me.essentials.MetaItemStack.getEnchantment(MetaItemStack.java:461) ~[?:?]
        at com.earth2me.essentials.commands.Commandenchant.run(Commandenchant.java:61) ~[?:?]
        at com.earth2me.essentials.commands.EssentialsCommand.run(EssentialsCommand.java:161) ~[?:?]
        at com.earth2me.essentials.Essentials.onCommandEssentials(Essentials.java:559) ~[?:?]
        at com.earth2me.essentials.Essentials.onCommand(Essentials.java:470) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.15.1.jar:git-Paper-32]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchCommand(CraftServer.java:740) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.PlayerConnection.handleCommand(PlayerConnection.java:1820) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.PlayerConnection.a(PlayerConnection.java:1628) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.PacketPlayInChat.a(PacketPlayInChat.java:47) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.aZ(MinecraftServer.java:1037) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:1030) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1096) ~[patched_1.15.1.jar:git-Paper-32]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:933) ~[patched_1.15.1.jar:git-Paper-32]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
[14:53:27] [Server thread/WARN]: java.lang.IllegalArgumentException: Invalid key. Must be [a-z0-9/._-]: luck:0
[14:53:27] [Server thread/WARN]:        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191)
[14:53:27] [Server thread/WARN]:        at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:49)
[14:53:27] [Server thread/WARN]:        at org.bukkit.NamespacedKey.minecraft(NamespacedKey.java:142)
[14:53:27] [Server thread/WARN]:        at com.earth2me.essentials.Enchantments.getByName(Enchantments.java:267)
[14:53:27] [Server thread/WARN]:        at com.earth2me.essentials.MetaItemStack.getEnchantment(MetaItemStack.java:461)
[14:53:27] [Server thread/WARN]:        at com.earth2me.essentials.commands.Commandenchant.run(Commandenchant.java:61)
[14:53:27] [Server thread/WARN]:        at com.earth2me.essentials.commands.EssentialsCommand.run(EssentialsCommand.java:161)
[14:53:27] [Server thread/WARN]:        at com.earth2me.essentials.Essentials.onCommandEssentials(Essentials.java:559)
[14:53:27] [Server thread/WARN]:        at com.earth2me.essentials.Essentials.onCommand(Essentials.java:470)
[14:53:27] [Server thread/WARN]:        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[14:53:27] [Server thread/WARN]:        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[14:53:27] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchCommand(CraftServer.java:740)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.PlayerConnection.handleCommand(PlayerConnection.java:1820)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.PlayerConnection.a(PlayerConnection.java:1628)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.PacketPlayInChat.a(PacketPlayInChat.java:47)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.PacketPlayInChat.a(PacketPlayInChat.java:5)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.MinecraftServer.aZ(MinecraftServer.java:1037)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:1030)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1096)
[14:53:27] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:933)
[14:53:27] [Server thread/WARN]:        at java.lang.Thread.run(Thread.java:748)

EssentialsX config:

Details

Description
I encountered this bug while trying to remove a mistake enchantment from a pickaxe. Can use /item to enchant with luck, but not /enchant. Even if it's not intended to be supported, at the very least it should not be throwing exceptions.

Steps to reproduce
/item diamond_pick 1 luck:1
/enchant luck:0 (while holding the pickaxe)

Expected behavior
Enchantment should be equally valid in /enchant as it is in /item.

Screenshots
image

commented

/enchant uses a different syntax. You're looking for /enchant <enchantment> [level] - note that /enchant doesn't accept the <enchantment>:<level> syntax used in item meta. This is how /enchant has always worked.

What you're doing currently is trying to find an enchantment that has the name luck:0 - EssentialsX only knows the name luck and Minecraft itself only knows the name minecraft:luck.