Package org.bukkit.block

Examples of org.bukkit.block.Sign


       
        if(block == null){plugin.localizedMessage(player, null, "msg-error-edit"); return;}
        else if(block.getTypeId() != Material.WALL_SIGN.getId()){plugin.localizedMessage(player, null, "msg-error-edit"); return;}
       

        Sign    sign = (Sign) block.getState();
        Sign    owner = sign;
        String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
        boolean    privateSign;
       
        // Check if it is our sign that is selected.
       
        if(text.equals("[private]") || text.equalsIgnoreCase(Lockette.altPrivate)) privateSign = true;
        else if(text.equals("[more users]") || text.equalsIgnoreCase(Lockette.altMoreUsers)){
          privateSign = false;
         
          Block    checkBlock = Lockette.getSignAttachedBlock(block);
          if(checkBlock == null){plugin.localizedMessage(player, null, "msg-error-edit"); return;}
         
          Block    signBlock = Lockette.findBlockOwner(checkBlock);
          if(signBlock == null){plugin.localizedMessage(player, null, "msg-error-edit"); return;}
         
          owner = (Sign) signBlock.getState();
        }
        else{plugin.localizedMessage(player, null, "msg-error-edit"); return;}
       
       
        int      length = player.getName().length();
       
        if(length > 15) length = 15;

        // Check owner.
        if(owner.getLine(1).replaceAll("(?i)\u00A7[0-F]", "").equals(player.getName().substring(0, length)) || Lockette.debugMode){
          int      line = Integer.parseInt(command[1]) - 1;
         
          // Disallow editing [Private] line 1/2 here.
          if(!Lockette.debugMode){
            if(line <= 0) return;
View Full Code Here


    return(false);
  }
 
 
  private static void interactSign(Block block, Player player){
    Sign    sign = (Sign) block.getState();
    String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
    Block    signBlock = block;
   
   
    // Check if it is our sign that was clicked.
   
    if(text.equals("[private]") || text.equalsIgnoreCase(Lockette.altPrivate)){}
    else if(text.equals("[more users]") || text.equalsIgnoreCase(Lockette.altMoreUsers)){
      Block    checkBlock = Lockette.getSignAttachedBlock(block);
      if(checkBlock == null) return;
     
      signBlock = Lockette.findBlockOwner(checkBlock);
      if(signBlock == null) return;
     
      sign = (Sign) signBlock.getState();
    }
    else return;
   
    int      length = player.getName().length();
   
    if(length > 15) length = 15;
   
    // Check owner.
    if(sign.getLine(1).replaceAll("(?i)\u00A7[0-F]", "").equals(player.getName().substring(0, length)) || Lockette.debugMode){
      if(!block.equals(plugin.playerList.get(player.getName()))){
        // Associate the user with the owned sign.
        plugin.playerList.put(player.getName(), block);
        plugin.localizedMessage(player, null, "msg-help-select");
      }
    }
    else{/*
      int fee = getSignOption(signBlock, "fee", Lockette.altFee, 0);
     
      if(fee != 0){
        if(!signBlock.equals(plugin.playerList.get(player.getName()))){
          // First half of fee approval.
          plugin.playerList.put(player.getName(), signBlock);
          plugin.localizedMessage(player, null, "msg-user-touch-fee", sign.getLine(1), plugin.economyFormat(fee));
        }
      }
      else{*/
        if(!block.equals(plugin.playerList.get(player.getName()))){
          // Only print this message once as well.
          plugin.playerList.put(player.getName(), block);
          plugin.localizedMessage(player, null, "msg-user-touch-owned", sign.getLine(1));
        }
      //}
    }
  }
View Full Code Here

    // Moved to outer..
   
   
    // Lets see if the player is allowed to touch...
   
    Sign    sign = (Sign) signBlock.getState();
    int      length = player.getName().length();
    String    line;
   
    if(length > 15) length = 15;
   
   
    // Check owner.
   
    line = sign.getLine(1).replaceAll("(?i)\u00A7[0-F]", "");
   
    if(line.equals(player.getName().substring(0, length))) return(true);
    if(plugin.inGroup(block.getWorld(), player, line)) return(true);
   
   
    // Check main two users.
   
    int      y;
   
    for(y = 2; y <= 3; ++y) if(!sign.getLine(y).isEmpty()){
      line = sign.getLine(y).replaceAll("(?i)\u00A7[0-F]", "");
     
      if(plugin.inGroup(block.getWorld(), player, line)) return(true);
      if(line.equalsIgnoreCase(player.getName().substring(0, length))) return(true);
    }
   
   
    // Check for more users.
   
    List<Block>  list = Lockette.findBlockUsers(block, signBlock);
    int      x, count = list.size();
    Sign    sign2;
   
    for(x = 0; x < count; ++x){
      sign2 = (Sign) list.get(x).getState();
     
      for(y = 1; y <= 3; ++y) if(!sign2.getLine(y).isEmpty()){
        line = sign2.getLine(y).replaceAll("(?i)\u00A7[0-F]", "");
       
        if(plugin.inGroup(block.getWorld(), player, line)) return(true);
        if(line.equalsIgnoreCase(player.getName().substring(0, length))) return(true);
      }
    }
View Full Code Here

   
    Block    signBlock = Lockette.findBlockOwner(block);
   
    if(signBlock == null) return(true);
   
    Sign    sign = (Sign) signBlock.getState();
    int      length = player.getName().length();
   
    if(length > 15) length = 15;
   
    // Check owner only.
    if(sign.getLine(1).replaceAll("(?i)\u00A7[0-F]", "").equals(player.getName().substring(0, length))){
      Lockette.toggleSingleDoor(block);
      return(false);
    }
   
    return(true);
View Full Code Here

    if(!enabled) return(false);
   
    int      type = block.getTypeId();
   
    if(type == Material.WALL_SIGN.getId()){
      Sign    sign = (Sign) block.getState();
      String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
     
      if(text.equals("[private]") || text.equalsIgnoreCase(altPrivate)){
        return(true);
      }
      else if(text.equals("[more users]") || text.equalsIgnoreCase(altMoreUsers)){
View Full Code Here

    if(!enabled) return(null);
   
    int      type = block.getTypeId();
   
    if(type == Material.WALL_SIGN.getId()){
      Sign    sign = (Sign) block.getState();
      String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
     
      if(text.equals("[private]") || text.equalsIgnoreCase(altPrivate)){
        return(sign.getLine(1).replaceAll("(?i)\u00A7[0-F]", ""));
      }
      else if(text.equals("[more users]") || text.equalsIgnoreCase(altMoreUsers)){
        Block    checkBlock = getSignAttachedBlock(block);
       
        if(checkBlock != null){
          Block    signBlock = findBlockOwner(checkBlock);
         
          if(signBlock != null){
            sign = (Sign) signBlock.getState();
           
            return(sign.getLine(1).replaceAll("(?i)\u00A7[0-F]", ""));
          }
        }
      }
    }
    else{
      Block    signBlock = Lockette.findBlockOwner(block);
     
      if(signBlock != null){
        Sign    sign = (Sign) signBlock.getState();
       
        return(sign.getLine(1).replaceAll("(?i)\u00A7[0-F]", ""));
      }
    }
   
    return(null);
  }
View Full Code Here

   
    Block    checkBlock = Lockette.findBlockOwner(block);
   
    if(checkBlock == null) return(true);
   
    Sign    sign = (Sign) checkBlock.getState();
    int      length = name.length();

    if(length > 15) length = 15;
   
    // Check owner only.
    if(sign.getLine(1).replaceAll("(?i)\u00A7[0-F]", "").equals(name.substring(0, length))){
      return(true);
    }
   
    return(false);
  }
View Full Code Here

    if(signBlock == null) return(true);
   

    // Check main three users.

    Sign    sign = (Sign) signBlock.getState();
    int      length = name.length();
    String    line;
    int      y;
   
    if(length > 15) length = 15;
   
    for(y = 1; y <= 3; ++y) if(!sign.getLine(y).isEmpty()){
      line = sign.getLine(y).replaceAll("(?i)\u00A7[0-F]", "");
     
      // Check if the name is there verbatum.
      if(line.equalsIgnoreCase(name.substring(0, length))) return(true);

      // Check if name is in a group listed on the sign.
      if(withGroups) if(plugin.inGroup(block.getWorld(), name, line)) return(true);
    }
   
   
    // Check for more users.
   
    List<Block>  list = Lockette.findBlockUsers(block, signBlock);
    int      x, count = list.size();
   
    for(x = 0; x < count; ++x){
      sign = (Sign) list.get(x).getState();
     
      for(y = 1; y <= 3; ++y) if(!sign.getLine(y).isEmpty()){
        line = sign.getLine(y).replaceAll("(?i)\u00A7[0-F]", "");

        // Check if the name is there verbatum.
        if(line.equalsIgnoreCase(name.substring(0, length))) return(true);

        // Check if name is in a group listed on the sign.
View Full Code Here

    if(signBlock == null) return(true);
   

    // Check main three users.

    Sign    sign = (Sign) signBlock.getState();
    String    line;
    int      y;
   
    for(y = 1; y <= 3; ++y) if(!sign.getLine(y).isEmpty()){
      line = sign.getLine(y).replaceAll("(?i)\u00A7[0-F]", "");
     
      if(line.equalsIgnoreCase("[Everyone]") || line.equalsIgnoreCase(Lockette.altEveryone)) return(true);
    }
   
   
    // Check for more users.
   
    List<Block>  list = Lockette.findBlockUsers(block, signBlock);
    int      x, count = list.size();
   
    for(x = 0; x < count; ++x){
      sign = (Sign) list.get(x).getState();
     
      for(y = 1; y <= 3; ++y) if(!sign.getLine(y).isEmpty()){
        line = sign.getLine(y).replaceAll("(?i)\u00A7[0-F]", "");
       
        if(line.equalsIgnoreCase("[Everyone]") || line.equalsIgnoreCase(Lockette.altEveryone)) return(true);
      }
    }
   
View Full Code Here

        if(ignore == null) doCheck = true;
        else if(checkBlock.getLocation().equals(ignore)) doCheck = false;
        else doCheck = true;
       
        if(doCheck){
          Sign    sign = (Sign) checkBlock.getState();
          String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
         
          if(text.equals("[private]") || text.equalsIgnoreCase(altPrivate)) return(checkBlock);
        }
      }
    }
    else if(iterate) if(checkBlock.getTypeId() == block.getTypeId()){
      checkBlock = findBlockOwnerBase(checkBlock, ignore, iterateFurther, iterateUp, iterateDown, includeEnds, false);
      if(checkBlock != null) return(checkBlock);
    }
   
    checkBlock = block.getRelative(BlockFace.EAST);
    if(checkBlock.getTypeId() == Material.WALL_SIGN.getId()){
      face = checkBlock.getData();
      if(face == 2){
        // Ignore a sign being created.
       
        if(ignore == null) doCheck = true;
        else if(checkBlock.getLocation().equals(ignore)) doCheck = false;
        else doCheck = true;
       
        if(doCheck){
          Sign    sign = (Sign) checkBlock.getState();
          String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
         
          if(text.equals("[private]") || text.equalsIgnoreCase(altPrivate)) return(checkBlock);
        }
      }
    }
    else if(iterate) if(checkBlock.getTypeId() == block.getTypeId()){
      checkBlock = findBlockOwnerBase(checkBlock, ignore, iterateFurther, iterateUp, iterateDown, includeEnds, false);
      if(checkBlock != null) return(checkBlock);
    }
   
    checkBlock = block.getRelative(BlockFace.SOUTH);
    if(checkBlock.getTypeId() == Material.WALL_SIGN.getId()){
      face = checkBlock.getData();
      if(face == 5){
        // Ignore a sign being created.
       
        if(ignore == null) doCheck = true;
        else if(checkBlock.getLocation().equals(ignore)) doCheck = false;
        else doCheck = true;
       
        if(doCheck){
          Sign    sign = (Sign) checkBlock.getState();
          String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
         
          if(text.equals("[private]") || text.equalsIgnoreCase(altPrivate)) return(checkBlock);
        }
      }
    }
    else if(iterate) if(checkBlock.getTypeId() == block.getTypeId()){
      checkBlock = findBlockOwnerBase(checkBlock, ignore, iterateFurther, iterateUp, iterateDown, includeEnds, false);
      if(checkBlock != null) return(checkBlock);
    }
   
    checkBlock = block.getRelative(BlockFace.WEST);
    if(checkBlock.getTypeId() == Material.WALL_SIGN.getId()){
      face = checkBlock.getData();
      if(face == 3){
        // Ignore a sign being created.
       
        if(ignore == null) doCheck = true;
        else if(checkBlock.getLocation().equals(ignore)) doCheck = false;
        else doCheck = true;
       
        if(doCheck){
          Sign    sign = (Sign) checkBlock.getState();
          String    text = sign.getLine(0).replaceAll("(?i)\u00A7[0-F]", "").toLowerCase();
         
          if(text.equals("[private]") || text.equalsIgnoreCase(altPrivate)) return(checkBlock);
        }
      }
    }
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.