From 60c030b7b4c76d82aafcc6403dd7966466698f2b Mon Sep 17 00:00:00 2001 From: youpaishidifu <1@ypshidifu.cn> Date: Sat, 31 Oct 2026 15:21:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC65=E6=89=B9:=20=E6=8C=81=E7=9B=BE?= =?UTF-8?q?=E9=94=84=E5=9C=B0/=E5=8E=BB=E7=9A=AE=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Sdf1_login/Main.java | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/main/java/Sdf1_login/Main.java b/src/main/java/Sdf1_login/Main.java index 7ff28ef..edc4dc4 100644 --- a/src/main/java/Sdf1_login/Main.java +++ b/src/main/java/Sdf1_login/Main.java @@ -3922,6 +3922,44 @@ public class Main extends JavaPlugin // ★ 屏蔽Sdf1_game宝箱自定义物品 if (isTreasureItem(hand) || isTreasureItem(offhand)) return; + // ★ 第65批:持盾锄地/去皮修复 + // MC 原版:主手盾牌右击方块时,盾牌优先触发格挡,锄头/斧头无法工作 + // 修复:主手盾牌 + 副手锄头/斧头 + 目标方块可交互时,手动执行方块交互 + if (e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) { + if (hand.getType() == Material.SHIELD) { + org.bukkit.block.Block clicked = e.getClickedBlock(); + if (clicked != null) { + // 副手锄头:草方块/菌丝土 → 耕地 + String offhandName = offhand.getType().name(); + boolean isHoe = offhandName.endsWith("_HOE"); + if (isHoe) { + Material bt = clicked.getType(); + if (bt == Material.GRASS_BLOCK || bt == Material.PODZOL) { + e.setCancelled(true); + clicked.setType(Material.FARMLAND); + clicked.getWorld().playSound(clicked.getLocation(), Sound.BLOCK_GRASS_HIT, 1, 1); + return; + } + } + // 副手斧头:原木 → 去皮原木 + boolean isAxe = offhandName.endsWith("_AXE"); + if (isAxe) { + String typeName = clicked.getType().name(); + if (typeName.endsWith("_LOG")) { + e.setCancelled(true); + String strippedName = typeName.replace("_LOG", "_STRIPPED_LOG"); + Material strippedMat = Material.getMaterial(strippedName); + if (strippedMat != null) { + clicked.setType(strippedMat); + clicked.getWorld().playSound(clicked.getLocation(), Sound.BLOCK_WOOD_HIT, 1, 1); + return; + } + } + } + } + } + } + if (isMenuSnowball(hand) || isMenuSnowball(offhand)) { e.setCancelled(true);