public void removeTransmitterAt(Location loc) { for (WirelessTransmitter transmitter : transmitters) { if (transmitter.getX() == loc.getBlockX() && transmitter.getZ() == loc.getBlockZ() && transmitter.getY() == loc.getBlockY()) { transmitters.remove(transmitter); return; } } }
/** @return true if one of the transmitters is active, false if they are all off. */ public boolean isActive() { for (WirelessTransmitter t : getTransmitters()) { Location loc = new Location(Bukkit.getWorld(t.getWorld()), t.getX(), t.getY(), t.getZ()); Block block = loc.getBlock(); if (block.getState() instanceof Sign) { if (block.isBlockIndirectlyPowered() || block.isBlockIndirectlyPowered()) { return true; } } } return false; }