diff --git a/pom.xml b/pom.xml index 6822d26..92824d7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.citycraft Residence - 2.8.1.2 + 2.8.1.3 Residence 重制版本的领地插件 - 喵♂呜 @@ -55,7 +55,7 @@ http://ci.citycraft.cn:8080 - &4添加自动检测 1.7版本开启ActionBar时自动关闭... + &d修复补丁导致的刷物品BUG... UTF-8 diff --git a/src/main/java/cn/citycraft/Residence/listeners/bugfix/ResidenceBugFix.java b/src/main/java/cn/citycraft/Residence/listeners/bugfix/ResidenceBugFix.java index 4500c47..e98ce00 100644 --- a/src/main/java/cn/citycraft/Residence/listeners/bugfix/ResidenceBugFix.java +++ b/src/main/java/cn/citycraft/Residence/listeners/bugfix/ResidenceBugFix.java @@ -28,12 +28,6 @@ public class ResidenceBugFix implements Listener { plugin.getLogger().info("防刷生物补丁已加载..."); } - public boolean hasPerm(final ClaimedResidence res, final Player p) { - final FlagPermissions perms = res.getPermissions(); - final String world = p.getWorld().getName(); - return perms.playerHas(p.getName(), world, "place", perms.playerHas(p.getName(), world, "build", false)); - } - public Block getPlaceBlock(final PlayerInteractEvent e) { final Player p = e.getPlayer(); final ItemStack it = p.getItemInHand(); @@ -53,6 +47,12 @@ public class ResidenceBugFix implements Listener { return b.getRelative(BlockFace.DOWN); } + public boolean hasPerm(final ClaimedResidence res, final Player p) { + final FlagPermissions perms = res.getPermissions(); + final String world = p.getWorld().getName(); + return perms.playerHas(p.getName(), world, "place", perms.playerHas(p.getName(), world, "build", false)); + } + @EventHandler public void onBlockPlace(final PlayerInteractEvent e) { if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.PHYSICAL) { @@ -102,7 +102,7 @@ public class ResidenceBugFix implements Listener { if (res == null) { return; } - if (b1.getType() != Material.AIR && b2.getType() == Material.AIR) { + if (b1.getType() != Material.AIR && b1.getType() != Material.TORCH && b2.getType() == Material.AIR && checkAround(b2)) { if (!hasPerm(res, p)) { e.setCancelled(true); p.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission") + ChatColor.DARK_RED + " 当前区域不允许此操作!"); @@ -122,9 +122,13 @@ public class ResidenceBugFix implements Listener { @EventHandler public void onSugarCanePhysics(final BlockPhysicsEvent e) { - // final Material mat = e.getChangedType(); - // if (mat == Material.SUGAR_CANE_BLOCK) { - // e.getBlock().getDrops().clear(); - // } + } + + private boolean checkAround(final Block b) { + final Block be = b.getRelative(BlockFace.EAST); + final Block bw = b.getRelative(BlockFace.WEST); + final Block bn = b.getRelative(BlockFace.NORTH); + final Block bs = b.getRelative(BlockFace.SOUTH); + return (be.getType() != Material.AIR || bw.getType() != Material.AIR || bn.getType() != Material.AIR || bs.getType() != Material.AIR); } }