Package org.bukkit.block

Examples of org.bukkit.block.Sign


        }
    }

    protected final void signCheck(String player, Block block) {
        if (block.getState() instanceof Sign) {
            Sign sign = (Sign) block.getState();
            bystanders.add(new SignDestroyed(player, block.getTypeId(), block.getData(), sign, world));
        }
    }
View Full Code Here


    }

    @Override
    public void onSignChange(SignChangeEvent event) {
        if (event.getBlock().getState() instanceof Sign) {
            Sign sign = (Sign) event.getBlock().getState();
            boolean oldText = false;
            for (String line : sign.getLines()) {
                if (!line.equals("")) {
                    oldText = true;
                }
            }
            if (oldText) {
View Full Code Here

        String[] lines = data.split("\u0060");


        Block block = currWorld.getBlockAt(x, y, z);
        if (block.getState() instanceof Sign) {
            Sign sign = (Sign) block.getState();
            for (int i = 0; i < lines.length; i++) {
                sign.setLine(i, lines[i]);
            }
        } else {
            BBLogging.warning("Error when restoring sign");
        }
    }
View Full Code Here

            currWorld.loadChunk(x >> 4, z >> 4);
        }

        Block block = currWorld.getBlockAt(x, y, z);
        if (block.getState() instanceof Sign) {
            Sign sign = (Sign) block.getState();
            for (int i = 0; i < sign.getLines().length; i++) {
                sign.setLine(i, "");
            }
        } else {
            BBLogging.warning("Error when restoring sign");
        }
    }
View Full Code Here

        }
    }

    private void signCheck(String player, Block block) {
        if (block.getState() instanceof Sign) {
            Sign sign = (Sign) block.getState();
            bystanders.add(new SignDestroyed(player, block.getTypeId(), block.getData(), sign, world));
        }
    }
View Full Code Here

        }
    }

    private void signCheck(Block block) {
        if (block.getState() instanceof Sign) {
            Sign sign = (Sign) block.getState();
            bystanders.add(new DestroySignText(player, sign, world));
        }
    }
View Full Code Here

        Location location = new Location(player.getWorld(), message.getX(), message.getY(), message.getZ());
        if (player.checkSignLocation(location)) {
            // update the sign if it's actually still there
            BlockState state = location.getBlock().getState();
            if (state instanceof Sign) {
                Sign sign = (Sign) state;
                for (int i = 0; i < lines.length; ++i) {
                    sign.setLine(i, lines[i]);
                }
                sign.update();
            }
        } else {
            // player shouldn't be editing this sign
            GlowServer.logger.warning(session + " tried to edit sign at " + location);
        }
View Full Code Here

      scs.log(Level.SEVERE, "Sign change event - expected instanceof Sign, got="+event.getBlock().getState(), false);
      return;
    }
   
    // get the block information
    Sign  sign  = (Sign)event.getBlock().getState();
    Block  behind  = Utilities.getBlockBehind(sign);
     
    // get shop
    final Shop    fShop   = scs.getShopHandler().getShop(behind);
   
View Full Code Here

   
    // check if the possible blocks are signs
    for (Block block : blocks) {
      // is the block a Sign?
      if (block.getState() instanceof Sign) {
        Sign sign = (Sign)block.getState();
       
        // is the sign attached to me?
        if (Utilities.isShopBehind(sign, shop)) {
          signs.add((Sign)block.getState());
        }
View Full Code Here

  public void signCommand(PlayerInteractEvent event)
  {
    Player player = event.getPlayer();
    if (event.hasBlock() && event.getClickedBlock().getState() instanceof Sign)
    {
      Sign sign = (Sign) event.getClickedBlock().getState();
      String[] lines = sign.getLines();

      // if the first line isn't the AutoReferee tag, not our sign, not our business
      if (lines[0] == null || !"[AutoReferee]".equals(lines[0])) return;

      if (player.getWorld() == plugin.getLobbyWorld())
      {
        Long lastLoadTime = lastMapLoad.get(player.getName());
        long time = ManagementFactory.getRuntimeMXBean().getUptime();

        if (lastLoadTime != null && time < lastLoadTime + MAP_LOAD_COOLDOWN)
        {
          long secs = (lastLoadTime + MAP_LOAD_COOLDOWN - time) / 1000L;
          player.sendMessage(ChatColor.RED + "You must wait " +
            secs + "s before attempting to load another map.");
        }

        // load the world named on the sign
        else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
        {
          // if the last line is a version string, make sure it isn't included in the name
          boolean hasVersion = lines[3].isEmpty() ||
            (lines[3].trim().startsWith("[") && lines[3].trim().endsWith("]"));

          String mapname = lines[1] + " " + lines[2];
          if (!hasVersion) mapname += " " + lines[3];

          AutoRefMap map = AutoRefMap.getMap(mapname.trim());
          if (map != null)
          {
            if (player.isSneaking()) map.install();
            else this.lobbyLoadMap(player, map);

            // if the sign is fit to have a version string listed, add/update it
            if (hasVersion && map.getVersion().length() <= 13)
            {
              sign.setLine(3, String.format("[v%s]", map.getVersion()));
              sign.update();
            }
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.bukkit.block.Sign

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.