[SPIGOT-7808] Enchantment#getName return incorrect name (not about badly named) Created: 02/Jul/24  Updated: 25/Dec/24  Resolved: 03/Jul/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Wei Assignee: Doc
Resolution: Fixed Votes: 0
Labels: API

Attachments: PNG File 1.20.6_enchantments.png     PNG File 1.21_enchantments.png    
Version: CraftBukkit version 4248-Spigot-491f367-ae4f5a0 (MC: 1.21)
Guidelines Read: Yes

 Description   

I know Enchantment#getName is deprecated and is not recommended to be used anymore, however, this function continued to return the correct name (although badly named) until version 1.21.

for (Enchantment enchantment : Registry.ENCHANTMENT) {
    System.out.println("Enchantment [" + enchantment.getKey().getKey() + "]. getName() return " + enchantment.getName());
}

I ran the code above in two different Spigot versions, 1.20.6 and 1.21. and the outputs are attached below. You can see that Enchantment#getName() returns an incorrect name in version 1.21.

For example, getName() of the Efficiency enchantment returns DEPTH_STRIDER instead of DIG_SPEED.



 Comments   
Comment by Doc [ 02/Jul/24 ]

Looks like a issue in the conversion for get the names... try to make a PR for hotfix that https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1442/overview

 

Generated at Sat Dec 13 15:24:19 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.