Skip to content

Commit

Permalink
Fix sequential command execution with commands on both hands
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Apr 25, 2021
1 parent 0e1e358 commit 145f9e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main/src/main/java/net/citizensnpcs/trait/CommandTrait.java
Expand Up @@ -204,6 +204,10 @@ public int compare(NPCCommand o1, NPCCommand o2) {
for (NPCCommand command : commandList) {
if (executionMode == ExecutionMode.SEQUENTIAL) {
PlayerNPCCommand info = cooldowns.get(player.getUniqueId().toString());
if (info != null && info.lastUsedHand != hand) {
info.lastUsedHand = hand;
info.lastUsedId = -1;
}
if (info != null && command.id <= info.lastUsedId) {
if (info.lastUsedId == max) {
info.lastUsedId = -1;
Expand Down Expand Up @@ -542,6 +546,8 @@ private static class PlayerNPCCommand {
@Persist(valueType = Long.class)
Map<String, Long> lastUsed = Maps.newHashMap();
@Persist
Hand lastUsedHand;
@Persist
int lastUsedId = -1;
@Persist
Map<String, Integer> nUsed = Maps.newHashMap();
Expand Down

0 comments on commit 145f9e4

Please sign in to comment.