Updated NPCBase to with NPC#getState(NPCState)

Implemented net.jitse.npclib.api.NPC#getState(NPCState) to return a boolean indicating whether a state is toggled or not.
This commit is contained in:
A248 2019-10-31 20:14:46 -04:00 committed by GitHub
parent 73df32172e
commit 47d3417606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -220,6 +220,18 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
}
}
@Override
public boolean getState(NPCState state) {
if (activeStates.length != 0) {
for (int i = 0; i < activeStates.length; i++) {
if (activeStates[i] == state) {
return true;
}
}
}
return false;
}
@Override
public NPC toggleState(NPCState state) {
int inActiveStatesIndex = -1;