diff --git a/src/main/java/noppes/npcs/constants/EnumScriptType.java b/src/main/java/noppes/npcs/constants/EnumScriptType.java index 01fa36ac2..f6d05d65b 100644 --- a/src/main/java/noppes/npcs/constants/EnumScriptType.java +++ b/src/main/java/noppes/npcs/constants/EnumScriptType.java @@ -155,9 +155,21 @@ public enum EnumScriptType { public String function; + private static final java.util.Map BY_FUNCTION = new java.util.HashMap<>(); + static { + for (EnumScriptType type : values()) { + BY_FUNCTION.put(type.function, type); + } + } + public static EnumScriptType valueOfIgnoreCase(String channelName) { - channelName = channelName.toUpperCase(); - return valueOf(channelName); + // First try by function name (e.g. "abilityStart") + EnumScriptType type = BY_FUNCTION.get(channelName); + if (type != null) { + return type; + } + // Fallback to enum constant name (e.g. "ABILITY_START") + return valueOf(channelName.toUpperCase()); } private EnumScriptType(String function) {