mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Fixed the check that prevented built-in types from showing up in NPC Abilities
This commit is contained in:
1 parent
7ed68b7efe
commit
55149ab5d1
2 files changed
+30
-2
No files matched your search
@@ -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]);
|
||||
|
||||
@@ -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++);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user