From 145f9e4f414e45659c04c59e9be0257774f85d72 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 25 Apr 2021 12:06:59 +0800 Subject: [PATCH] Fix sequential command execution with commands on both hands --- main/src/main/java/net/citizensnpcs/trait/CommandTrait.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java b/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java index 4ccef1c2f..faa1f176b 100644 --- a/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java +++ b/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java @@ -204,6 +204,10 @@ public class CommandTrait extends Trait { 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; @@ -542,6 +546,8 @@ public class CommandTrait extends Trait { @Persist(valueType = Long.class) Map lastUsed = Maps.newHashMap(); @Persist + Hand lastUsedHand; + @Persist int lastUsedId = -1; @Persist Map nUsed = Maps.newHashMap();