diff --git a/pom.xml b/pom.xml index 3dd3f08..dc9e494 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.citycraft SimpleProtect - 1.3 + 1.3.1 SimpleProtect Minecraft 服务器保护插件 @@ -53,6 +53,11 @@ + + UTF-8 + &c红石检测添加提示开关... + http://ci.citycraft.cn:8080 + spigot-repo @@ -77,8 +82,4 @@ 1.0 - - UTF-8 - http://ci.citycraft.cn:8080 - \ No newline at end of file diff --git a/src/main/java/cn/citycraft/SimpleProtect/listen/HighRedstone.java b/src/main/java/cn/citycraft/SimpleProtect/listen/HighRedstone.java index f023b9d..6349761 100644 --- a/src/main/java/cn/citycraft/SimpleProtect/listen/HighRedstone.java +++ b/src/main/java/cn/citycraft/SimpleProtect/listen/HighRedstone.java @@ -20,43 +20,47 @@ import cn.citycraft.SimpleProtect.SimpleProtect; public class HighRedstone implements Runnable, Listener { HashMap map = new HashMap(); - HashMap pmap = new HashMap(); SimpleProtect plugin; + HashMap pmap = new HashMap(); ArrayList tipop = new ArrayList(); - public HighRedstone(SimpleProtect main) { + public HighRedstone(final SimpleProtect main) { plugin = main; } @EventHandler - public void onRedClock(BlockRedstoneEvent event) { - Block rb = event.getBlock(); - if (rb.getType() == Material.REDSTONE_WIRE) + public void onRedClock(final BlockRedstoneEvent event) { + final Block rb = event.getBlock(); + if (rb.getType() == Material.REDSTONE_WIRE) { put(event.getBlock()); + } } @EventHandler(ignoreCancelled = true) - public void RedStonePlace(BlockPlaceEvent event) { - Block rb = event.getBlock(); - Player rp = event.getPlayer(); - if (rb.getType() == Material.REDSTONE_WIRE) + public void RedStonePlace(final BlockPlaceEvent event) { + final Block rb = event.getBlock(); + final Player rp = event.getPlayer(); + if (rb.getType() == Material.REDSTONE_WIRE) { pmap.put(rb, rp); + } } @Override public void run() { - List blocks = new ArrayList(); - for (Entry entry : map.entrySet()) - if (entry.getValue() > plugin.config.getLong("HighRedstone.Maxevents")) + final List blocks = new ArrayList(); + for (final Entry entry : map.entrySet()) { + if (entry.getValue() > plugin.config.getLong("HighRedstone.Maxevents")) { blocks.add(entry.getKey()); + } + } Boolean tip = true; - for (Block block : blocks) { - World rw = block.getWorld(); - int rx = block.getX(); - int ry = block.getY(); - int rz = block.getZ(); - Player rp = pmap.get(block); - if (rp != null) + for (final Block block : blocks) { + final World rw = block.getWorld(); + final int rx = block.getX(); + final int ry = block.getY(); + final int rz = block.getZ(); + final Player rp = pmap.get(block); + if (rp != null) { if (rp.isOp() || rp.hasPermission("sp.ignore.highredstone")) { if (!tipop.contains(rp)) { rp.sendMessage(plugin.getfullmsg("HighRedstone.Admin")); @@ -64,7 +68,8 @@ public class HighRedstone implements Runnable, Listener { } continue; } - if (tip) { + } + if (tip && plugin.config.getBoolean("HighRedstone.Tip")) { Bukkit.broadcastMessage(plugin.getfullmsg("HighRedstone.Find").replaceAll("%world%", rw.getName()).replaceAll("%x%", rx + "").replaceAll("%y%", ry + "").replaceAll("%z%", rz + "")); if (rp != null) { Bukkit.broadcastMessage(plugin.getfullmsg("HighRedstone.Check").replaceAll("%player%", rp.getName())); @@ -77,11 +82,12 @@ public class HighRedstone implements Runnable, Listener { map.clear(); } - private void put(Block block) { + private void put(final Block block) { if (map.containsKey(block)) { - int i = map.remove(block); + final int i = map.remove(block); map.put(block, i + 1); - } else + } else { map.put(block, 1); + } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ab266dc..eb091f5 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -28,6 +28,7 @@ Explosion: HighRedstone: #是否开启 Enable: true + Tip: true Maxevents: 35 Find: '&c发现高频红石 &3世界: %world% &d坐标: X:%x% Y:%y% Z:%z% &a已清理!' Check: '&c高频红石数据监测 &5上述高频红石由 &6玩家: &a%player% &6放置!'