From 55149ab5d167cf610c07efb7ba8ffebd9bd04648 Mon Sep 17 00:00:00 2001 From: Vidal Date: Tue, 17 Feb 2026 18:31:47 -0300 Subject: [PATCH] Fixed the check that prevented built-in types from showing up in NPC Abilities --- .../data/ability/AbilityController.java | 27 +++++++++++++++++++ .../java/noppes/npcs/NoppesUtilServer.java | 5 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityController.java b/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityController.java index c492cf50b..38cfee5ef 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityController.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityController.java @@ -497,6 +497,33 @@ public class AbilityController implements IAbilityHandler { return abilityTypes.containsKey(typeId); } + public boolean isAllowedByPlayer(String typeId) { + if (abilityTypes.containsKey(typeId)) { + Ability temp = abilityTypes.get(typeId).get(); + return temp.getAllowedBy() == UserType.PLAYER_ONLY; + } + + return false; + } + + public boolean isAllowedByNPC(String typeId) { + if (abilityTypes.containsKey(typeId)) { + Ability temp = abilityTypes.get(typeId).get(); + return temp.getAllowedBy() == UserType.NPC_ONLY; + } + + return false; + } + + public boolean isAllowedByBoth(String typeId) { + if (abilityTypes.containsKey(typeId)) { + Ability temp = abilityTypes.get(typeId).get(); + return temp.getAllowedBy() == UserType.BOTH; + } + + return false; + } + @Override public String[] getAbilityNameArray() { return builtAbilities.keySet().toArray(new String[0]); diff --git a/src/main/java/noppes/npcs/NoppesUtilServer.java b/src/main/java/noppes/npcs/NoppesUtilServer.java index b54b4b245..400a56678 100644 --- a/src/main/java/noppes/npcs/NoppesUtilServer.java +++ b/src/main/java/noppes/npcs/NoppesUtilServer.java @@ -781,8 +781,9 @@ public class NoppesUtilServer { if (controller != null) { int index = 0; for (String typeId : controller.getTypes()) { - // Exclude built-in types from the NPC type list - if (controller.isBuiltInType(typeId)) continue; + if (!controller.isAllowedByNPC(typeId) && !controller.isAllowedByBoth(typeId)) + continue; + map.put(typeId, index++); } }