Fix sequential command execution with commands on both hands

This commit is contained in:
fullwall 2021-04-25 12:06:59 +08:00
parent 0e1e3586af
commit 145f9e4f41

View File

@ -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<String, Long> lastUsed = Maps.newHashMap();
@Persist
Hand lastUsedHand;
@Persist
int lastUsedId = -1;
@Persist
Map<String, Integer> nUsed = Maps.newHashMap();