コード例 #1
0
 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;
     }
   }
 }
コード例 #2
0
 /** @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;
 }