1
0
mirror of https://e.coding.net/circlecloud/Residence.git synced 2025-11-24 21:46:16 +00:00

修复补丁导致的刷物品BUG...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092
2015-11-13 20:16:56 +08:00
parent 251bc9e1bf
commit a9850013f3
2 changed files with 17 additions and 13 deletions

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId>
<artifactId>Residence</artifactId>
<version>2.8.1.2</version>
<version>2.8.1.3</version>
<name>Residence</name>
<description>重制版本的领地插件 - 喵♂呜</description>
<build>
@@ -55,7 +55,7 @@
</build>
<properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<update.description>&amp;4添加自动检测 1.7版本开启ActionBar时自动关闭...</update.description>
<update.description>&amp;d修复补丁导致的刷物品BUG...</update.description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>

View File

@@ -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);
}
}