Package org.bukkit.block

Examples of org.bukkit.block.Sign


   
    public RepairableSign(BlockState state)
    {
        super(state);
       
        Sign s = (Sign) state;
        lines  = s.getLines();
    }
View Full Code Here


     */
    public void repair()
    {
        super.repair();
       
        Sign s = (Sign) getWorld().getBlockAt(getX(),getY(),getZ()).getState();
        s.setLine(0, lines[0]);
        s.setLine(1, lines[1]);
        s.setLine(2, lines[2]);
        s.setLine(3, lines[3]);
    }
View Full Code Here

    public Block signblock;
    public MinecartMember<?> member = null;
    public void setTime() {
      long duration = System.currentTimeMillis() - startTime;
      if (MaterialUtil.ISSIGN.get(this.signblock)) {
        Sign sign = BlockUtil.getSign(this.signblock);
        String dur = Util.getTimeString(duration);
        sign.setLine(3, dur);
        sign.update(true);
        //Message
        for (Player player : sign.getWorld().getPlayers()) {
          if (player.hasPermission("train.build.trigger")) {
            player.sendMessage(ChatColor.YELLOW + "[Train Carts] Trigger time of '" + sign.getLine(2) + "' set to " + dur);
          }
        }
      }
    }
View Full Code Here

  public Sign[] findSignsBelow() {
    ArrayList<Sign> below = new ArrayList<Sign>(1);
    //other signs below this sign we could parse?
    Block signblock = this.getBlock();
    while (MaterialUtil.ISSIGN.get(signblock = signblock.getRelative(BlockFace.DOWN))) {
      Sign sign = BlockUtil.getSign(signblock);
      if (sign == null || BlockUtil.getFacing(signblock) != this.getFacing()) {
        break;
      }
      below.add(sign);
    }
View Full Code Here

        // See <@link language property escaping>.
        // @tags
        // <l@location.sign_contents>
        // -->
        if (mechanism.matches("sign_contents") && getBlock().getState() instanceof Sign) {
            Sign state = (Sign)getBlock().getState();
            for (int i = 0; i < 4; i++)
                state.setLine(i, "");
            dList list = value.asType(dList.class);
            if (list.size() > 4) {
                dB.echoError("Sign can only hold four lines!");
            }
            else {
                for (int i = 0; i < list.size(); i++) {
                    state.setLine(i, EscapeTags.unEscape(list.get(i)));
                }
            }
            state.update();
        }

        // <--[mechanism]
        // @object dLocation
        // @name skull_skin
        // @input Element
        // @description
        // Sets the skin of a skull block.
        // Takes a username.
        // @tags
        // <l@location.skull_skin>
        // -->
        if (mechanism.matches("skull_skin") && getBlock().getState() instanceof Skull) {
            Skull state = ((Skull)getBlock().getState());
            if (!state.setOwner(value.asString()))
                dB.echoError("Failed to set skull_skin!");
            state.update(true);
        }

        if (!mechanism.fulfilled())
            mechanism.reportInvalid();
    }
View Full Code Here

    }
    latestLocations.put(player.getName(), playerLoc);
   
    // Signs can automatically teleport you to specific or random warzones
    if (playerLoc.getBlock().getType() == Material.SIGN_POST) {
      Sign sign = (Sign) playerLoc.getBlock().getState();
      if (sign.getLine(0).equals("[zone]")) {
        Warzone indicated = Warzone.getZoneByName(sign.getLine(1));
        if (indicated != null) {
          player.teleport(indicated.getTeleport());
        } else if (sign.getLine(1).equalsIgnoreCase("$random")) {
          List<Warzone> warzones = War.war.getEnabledWarzones();
          if (warzones.size() == 0) return;
          int zone = random.nextInt(warzones.size());
          Warzone random = warzones.get(zone);
          player.teleport(random.getTeleport());
        } else if (sign.getLine(1).equalsIgnoreCase("$active")) {
          List<Warzone> warzones = War.war.getActiveWarzones();
          if (warzones.size() == 0) warzones = War.war.getEnabledWarzones();
          if (warzones.size() == 0) return;
          int zone = random.nextInt(warzones.size());
          Warzone random = warzones.get(zone);
View Full Code Here

        List<String> events = new ArrayList<String>();
        Map<String, dObject> context = new HashMap<String, dObject>();

        dPlayer player = new dPlayer(event.getPlayer());
        Sign sign = (Sign) block.getState();
        dLocation location = new dLocation(block.getLocation());
        dMaterial material = dMaterial.getMaterialFrom(block.getType(), block.getData());

        context.put("old", new dList(Arrays.asList(sign.getLines())));
        context.put("new", new dList(Arrays.asList(event.getLines())));

        dList old_escaped = new dList();
        for (String str: sign.getLines()) {
            old_escaped.add(EscapeTags.Escape(str));
        }
        context.put("old_escaped", old_escaped); // Deprecated

        dList new_escaped = new dList();
View Full Code Here

  }
 
  public void onPlayerInteract(PlayerInteractEvent event){
    if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
      if(event.getClickedBlock().getType().equals(Material.SIGN_POST) || event.getClickedBlock().getType().equals(Material.WALL_SIGN)){
        Sign sign = (Sign)event.getClickedBlock().getState();
        if(sign.getLine(0).equalsIgnoreCase("[RankUp]")){
         
          String packageName = sign.getLine(2);
          if(packageName.equals("")){packageName = "default";}
         
          if(config.getAllPackageNames().contains(packageName) && config.getBoolean(packageName + ".rankup_sign_enabled")){
           
            String startingGroup = config.getString(packageName + ".startingGroup");
View Full Code Here

          break;
        }
      }
      Block signblock = info.getBlock();
      while (MaterialUtil.ISSIGN.get(signblock = signblock.getRelative(BlockFace.DOWN))) {
        Sign sign = BlockUtil.getSign(signblock);
        if (sign == null) break;
        boolean valid = true;
        for (String line : sign.getLines()) {
          DirectionStatement stat = new DirectionStatement(line, cartDirection);
          if (stat.direction == Direction.NONE) {
            valid = false;
            break;
          } else {
View Full Code Here

      return;
    }
    ignoreTimes.mark(dest);

    // First, use the sign direction
    Sign destsign = null;
    for (Block signblock : Util.getSignsFromRails(dest)) {
      if (isElevator(destsign = BlockUtil.getSign(signblock))) {
        break;
      }
    }

    // Facing towards a rail direction?
    BlockFace[] startDirs = FaceUtil.getFaces(BlockUtil.getRails(dest).getDirection().getOppositeFace());
    BlockFace launchDir = null;
    if (destsign != null) {
      BlockFace signdir = ((Directional) destsign.getData()).getFacing();
      if (startDirs[0] == signdir || startDirs[1] == signdir) {
        launchDir = signdir;
      }
    }
    if (launchDir == null) {
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.