Fix hand tracking

This commit is contained in:
fullwall 2024-01-26 18:55:11 +08:00
parent af728ec4b1
commit dbd9cdf1f1
1 changed files with 11 additions and 10 deletions

View File

@ -286,24 +286,25 @@ public class CommandTrait extends Trait {
executionErrors.put(player.getUniqueId().toString(), EnumSet.noneOf(CommandTraitError.class));
}
for (NPCCommand command : commandList) {
if (executionMode == ExecutionMode.SEQUENTIAL) {
PlayerNPCCommand info = playerTracking.get(player.getUniqueId());
if (info != null && info.lastUsedHand != hand) {
PlayerNPCCommand info = null;
if (executionMode == ExecutionMode.SEQUENTIAL
&& (info = playerTracking.get(player.getUniqueId())) != null) {
if (info.lastUsedHand != hand) {
info.lastUsedHand = hand;
info.lastUsedId = -1;
}
if (info != null && command.id <= info.lastUsedId) {
if (info.lastUsedId == max) {
info.lastUsedId = -1;
} else {
if (command.id <= info.lastUsedId) {
if (info.lastUsedId != max)
continue;
}
info.lastUsedId = -1;
}
}
runCommand(player, command);
if (executionMode == ExecutionMode.SEQUENTIAL || charged != null && !charged) {
break;
if (executionMode == ExecutionMode.SEQUENTIAL) {
playerTracking.get(player.getUniqueId()).lastUsedHand = hand;
}
if (executionMode == ExecutionMode.SEQUENTIAL || (charged != null && !charged))
break;
}
}