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

PotionEffectType.getByName returns null for several PotionEffectType#getName values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • None
    • None
    • Spigot 1.20.6 / JDK 21

    • 1.20.6
    • Yes

      PotionEffectType#getName(), which has been deprecated since the move to registries returns the old API name of the effect type for potion effects with IDs 1-33. However, the counterpart static method PotionEffectType.getByName() - also deprecated - performs lookup against the EFFECT Registry and will return null for PotionEffectType#getName() values where the old API name differs from the registry key value. This breaks backwards compatibility with plugins saving potion effect types by name.

      For example, PotionEffectType.HASTE#getName() returns "FAST_DIGGING" (as per impl) - but PotionEffectType.getByName("FAST_DIGGING") returns null, because "haste" is the expected registry name.

      Suggested solution would either be to have getName() return the key value name for IDs 1-33 (may introduce breakages) or have getByName() support legacy lookup (it's deprecated anyway, so may be better for back-compat)

            Unassigned Unassigned
            William278 William278
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: