9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-04 15:41:38 +00:00

修复npc踩压力板

This commit is contained in:
XiaoMoMi
2025-12-30 02:05:39 +08:00
parent 791e0e7a63
commit 3eafb8aae4
10 changed files with 33 additions and 28 deletions

View File

@@ -40,10 +40,12 @@ public class DebugStickListener implements Listener {
@EventHandler(ignoreCancelled = true)
public void onUseDebugStick(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK) return;
Block clickedBlock = event.getClickedBlock();
if (clickedBlock == null) return;
Player bukkitPlayer = event.getPlayer();
BukkitServerPlayer player = BukkitAdaptors.adapt(bukkitPlayer);
if (player == null) return;
Item<ItemStack> itemInHand = player.getItemInHand(event.getHand() == EquipmentSlot.HAND ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND);
if (!BukkitItemUtils.isDebugStick(itemInHand)) return;
if (!(player.canInstabuild() && player.hasPermission("minecraft.debugstick")) && !player.hasPermission("minecraft.debugstick.always")) {