mirror of
https://e.coding.net/circlecloud/SimpleProtect.git
synced 2024-11-22 01:49:03 +00:00
红石添加提示开关...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
ae86523045
commit
d9f7ba3ff2
11
pom.xml
11
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>cn.citycraft</groupId>
|
<groupId>cn.citycraft</groupId>
|
||||||
<artifactId>SimpleProtect</artifactId>
|
<artifactId>SimpleProtect</artifactId>
|
||||||
<version>1.3</version>
|
<version>1.3.1</version>
|
||||||
<name>SimpleProtect</name>
|
<name>SimpleProtect</name>
|
||||||
<description>Minecraft 服务器保护插件</description>
|
<description>Minecraft 服务器保护插件</description>
|
||||||
<build>
|
<build>
|
||||||
@ -53,6 +53,11 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<update.description>&c红石检测添加提示开关...</update.description>
|
||||||
|
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||||
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
@ -77,8 +82,4 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
|
||||||
</properties>
|
|
||||||
</project>
|
</project>
|
@ -20,43 +20,47 @@ import cn.citycraft.SimpleProtect.SimpleProtect;
|
|||||||
public class HighRedstone implements Runnable, Listener {
|
public class HighRedstone implements Runnable, Listener {
|
||||||
|
|
||||||
HashMap<Block, Integer> map = new HashMap<Block, Integer>();
|
HashMap<Block, Integer> map = new HashMap<Block, Integer>();
|
||||||
HashMap<Block, Player> pmap = new HashMap<Block, Player>();
|
|
||||||
SimpleProtect plugin;
|
SimpleProtect plugin;
|
||||||
|
HashMap<Block, Player> pmap = new HashMap<Block, Player>();
|
||||||
ArrayList<Player> tipop = new ArrayList<Player>();
|
ArrayList<Player> tipop = new ArrayList<Player>();
|
||||||
|
|
||||||
public HighRedstone(SimpleProtect main) {
|
public HighRedstone(final SimpleProtect main) {
|
||||||
plugin = main;
|
plugin = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onRedClock(BlockRedstoneEvent event) {
|
public void onRedClock(final BlockRedstoneEvent event) {
|
||||||
Block rb = event.getBlock();
|
final Block rb = event.getBlock();
|
||||||
if (rb.getType() == Material.REDSTONE_WIRE)
|
if (rb.getType() == Material.REDSTONE_WIRE) {
|
||||||
put(event.getBlock());
|
put(event.getBlock());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void RedStonePlace(BlockPlaceEvent event) {
|
public void RedStonePlace(final BlockPlaceEvent event) {
|
||||||
Block rb = event.getBlock();
|
final Block rb = event.getBlock();
|
||||||
Player rp = event.getPlayer();
|
final Player rp = event.getPlayer();
|
||||||
if (rb.getType() == Material.REDSTONE_WIRE)
|
if (rb.getType() == Material.REDSTONE_WIRE) {
|
||||||
pmap.put(rb, rp);
|
pmap.put(rb, rp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<Block> blocks = new ArrayList<Block>();
|
final List<Block> blocks = new ArrayList<Block>();
|
||||||
for (Entry<Block, Integer> entry : map.entrySet())
|
for (final Entry<Block, Integer> entry : map.entrySet()) {
|
||||||
if (entry.getValue() > plugin.config.getLong("HighRedstone.Maxevents"))
|
if (entry.getValue() > plugin.config.getLong("HighRedstone.Maxevents")) {
|
||||||
blocks.add(entry.getKey());
|
blocks.add(entry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
Boolean tip = true;
|
Boolean tip = true;
|
||||||
for (Block block : blocks) {
|
for (final Block block : blocks) {
|
||||||
World rw = block.getWorld();
|
final World rw = block.getWorld();
|
||||||
int rx = block.getX();
|
final int rx = block.getX();
|
||||||
int ry = block.getY();
|
final int ry = block.getY();
|
||||||
int rz = block.getZ();
|
final int rz = block.getZ();
|
||||||
Player rp = pmap.get(block);
|
final Player rp = pmap.get(block);
|
||||||
if (rp != null)
|
if (rp != null) {
|
||||||
if (rp.isOp() || rp.hasPermission("sp.ignore.highredstone")) {
|
if (rp.isOp() || rp.hasPermission("sp.ignore.highredstone")) {
|
||||||
if (!tipop.contains(rp)) {
|
if (!tipop.contains(rp)) {
|
||||||
rp.sendMessage(plugin.getfullmsg("HighRedstone.Admin"));
|
rp.sendMessage(plugin.getfullmsg("HighRedstone.Admin"));
|
||||||
@ -64,7 +68,8 @@ public class HighRedstone implements Runnable, Listener {
|
|||||||
}
|
}
|
||||||
continue;
|
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 + ""));
|
Bukkit.broadcastMessage(plugin.getfullmsg("HighRedstone.Find").replaceAll("%world%", rw.getName()).replaceAll("%x%", rx + "").replaceAll("%y%", ry + "").replaceAll("%z%", rz + ""));
|
||||||
if (rp != null) {
|
if (rp != null) {
|
||||||
Bukkit.broadcastMessage(plugin.getfullmsg("HighRedstone.Check").replaceAll("%player%", rp.getName()));
|
Bukkit.broadcastMessage(plugin.getfullmsg("HighRedstone.Check").replaceAll("%player%", rp.getName()));
|
||||||
@ -77,11 +82,12 @@ public class HighRedstone implements Runnable, Listener {
|
|||||||
map.clear();
|
map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void put(Block block) {
|
private void put(final Block block) {
|
||||||
if (map.containsKey(block)) {
|
if (map.containsKey(block)) {
|
||||||
int i = map.remove(block);
|
final int i = map.remove(block);
|
||||||
map.put(block, i + 1);
|
map.put(block, i + 1);
|
||||||
} else
|
} else {
|
||||||
map.put(block, 1);
|
map.put(block, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ Explosion:
|
|||||||
HighRedstone:
|
HighRedstone:
|
||||||
#是否开启
|
#是否开启
|
||||||
Enable: true
|
Enable: true
|
||||||
|
Tip: true
|
||||||
Maxevents: 35
|
Maxevents: 35
|
||||||
Find: '&c发现高频红石 &3世界: %world% &d坐标: X:%x% Y:%y% Z:%z% &a已清理!'
|
Find: '&c发现高频红石 &3世界: %world% &d坐标: X:%x% Y:%y% Z:%z% &a已清理!'
|
||||||
Check: '&c高频红石数据监测 &5上述高频红石由 &6玩家: &a%player% &6放置!'
|
Check: '&c高频红石数据监测 &5上述高频红石由 &6玩家: &a%player% &6放置!'
|
||||||
|
Loading…
Reference in New Issue
Block a user