Class EnumNames

java.lang.Object
me.hackware.api.util.EnumNames

public final class EnumNames extends Object
Returns the original display name for an enum constant. In dev builds, returns e.name(). In obfuscated builds, the ASM pass injects a $DN field (String[]) into each enum class containing the original constant names; this utility reads it via reflection.
  • Method Details

    • of

      public static String of(Enum<?> e)
    • fromName

      public static <E extends Enum<E>> E fromName(Class<E> cls, String name)
      Reverse lookup: find the enum constant whose of(java.lang.Enum<?>) name matches the given string. Also falls back to Enum.valueOf so both original and obfuscated names work.