9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-31 21:06:31 +00:00

修复副手放置方块

This commit is contained in:
XiaoMoMi
2025-04-14 19:40:09 +08:00
parent b5505ec06d
commit b7e7c9990f
4 changed files with 10 additions and 3 deletions

View File

@@ -219,7 +219,7 @@ public class ItemEventListener implements Listener {
int currentTicks = player.gameTicks();
// The client will send multiple packets to the server if the client thinks it should
// However, if the main hand item interaction is successful, the off-hand item should be blocked.
if (!player.updateLastSuccessfulInteractionTick(currentTicks)) {
if (player.lastSuccessfulInteractionTick() == currentTicks) {
event.setCancelled(true);
return true;
}

View File

@@ -156,6 +156,11 @@ public class BukkitServerPlayer extends Player {
}
}
@Override
public int lastSuccessfulInteractionTick() {
return lastSuccessfulInteraction;
}
@Override
public int gameTicks() {
try {