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++); } }