Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7808

Enchantment#getName return incorrect name (not about badly named)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • CraftBukkit version 4248-Spigot-491f367-ae4f5a0 (MC: 1.21)
    • Yes

      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.

            Doc Doc
            legamemc Wei
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: