@EventHandler
public void dropCommon(BlockPlaceEvent e) {
Player p = e.getPlayer();
Block b = e.getBlockPlaced();
if (!this.ml.WLWorlds.contains(e.getPlayer().getWorld().getName())) {
return;
}
if (e.isCancelled()) {
return;
}
if (e.getBlockPlaced().getTypeId() == 76) {
if (p.getItemInHand().getItemMeta().getDisplayName() != null
&& p.getItemInHand().getItemMeta().getDisplayName()
.equalsIgnoreCase(ChatColor.GOLD + ChatColor.BOLD.toString() + "Сигнальная шашка")) {
MessageManager.getManager().msg(p, MsgType.SUCCESS, cm.messageConfig.getString("signal_enable"));
BukkitRunnable run = new BukkitRunnable() {
@Override
public void run() {
for (Player p : Bukkit.getOnlinePlayers()) {
World w = Bukkit.getWorld("Realistic_World");
Location loc = p.getLocation();
int radius = 25;
for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radius; z++) {
Block b = w.getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y,
loc.getBlockZ() + z);
if (b.getType() == Material.REDSTONE_TORCH_ON) {
ParticleEffect.SMOKE_LARGE.display(0, 2, 0, 0, 5,
b.getLocation().add(0.5, 0, 0.5), 200);
if (r.nextInt(500) <= 10) {
cs.spawnCrate();
b.setType(Material.AIR);
this.cancel();
MessageManager.getManager().msg(p, MsgType.SUCCESS,
cm.messageConfig.getString("signal_success"));
}
}
}
}
}
}
}
};
run.runTaskTimer(plugin, 1, 1);
}
}
}