Package org.bukkit.block

Examples of org.bukkit.block.Sign


            return new Vector(r,r,r);
        }
    }

    public static void collectItem(AbstractIC ic, Vector offset, ItemStack... items) {
        Sign sign = BukkitUtil.toSign(ic.getSign());
        Block backB = ic.getBackBlock();
        BlockFace back = SignUtil.getBack(sign.getBlock());

        Block pipe = backB.getRelative(back);

        // Handle the event
        PipeRequestEvent event = new PipeRequestEvent(pipe, new ArrayList<ItemStack>(Arrays.asList(items)), backB);
        Bukkit.getPluginManager().callEvent(event);

        if (!event.isValid()) return;

        Collection<ItemStack> results = event.getItems();

        // If there is a chest add the results to the chest
        Block invHolder = backB.getRelative(offset.getBlockX(), offset.getBlockY(), offset.getBlockZ());
        if (InventoryUtil.doesBlockHaveInventory(invHolder)) {
            InventoryHolder c = (InventoryHolder) invHolder.getState();
            results = c.getInventory().addItem(results.toArray(new ItemStack[results.size()])).values();
        }

        // Drop whatever results were not added to the chest
        for (ItemStack item : results) {
            backB.getWorld().dropItemNaturally(sign.getLocation().add(0.5, 0, 0.5), item);
        }
    }
View Full Code Here


        }

        if(checkChunks) {
            for(BlockState state : event.getBlock().getChunk().getTileEntities()) {
                if(state instanceof Sign) {
                    Sign s = (Sign) state;
                    if(s.getLine(1).equalsIgnoreCase("[Chunk]")) {
                        lplayer.printError("mech.anchor.already-anchored");
                        SignUtil.cancelSign(event);
                        return;
                    }
                }
View Full Code Here

            player.print("mech.signcopy.copy");
            event.setCancelled(true);
        } else if (event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
            if(signs.containsKey(player.getName())) {

                Sign s = (Sign) event.getClickedBlock().getState();
                String[] lines = signs.get(player.getName());

                SignChangeEvent sev = new SignChangeEvent(event.getClickedBlock(), event.getPlayer(), lines);
                Bukkit.getPluginManager().callEvent(sev);

                if(!sev.isCancelled()) {
                    for(int i = 0; i < lines.length; i++)
                        s.setLine(i, lines[i]);
                    s.update();
                }

                player.print("mech.signcopy.paste");
                event.setCancelled(true);
            }
View Full Code Here

        return code.toString();
    }

    private String getCode() throws CodeNotFoundException {

        Sign sign = BukkitUtil.toSign(this.sign);

        Block above = sign.getLocation().add(new Vector(0, 1, 0)).getBlock();
        if (above.getType() == Material.CHEST) return getBookCode(above);
        Block below = sign.getLocation().add(new Vector(0, -1, 0)).getBlock();
        if (below.getType() == Material.CHEST) return getBookCode(below);

        org.bukkit.Location l = sign.getLocation();
        World w = l.getWorld();

        int x = l.getBlockX();
        int z = l.getBlockZ();
View Full Code Here

            }, 20L);
            return;
        }
        clear();
        Game game = GameManager.getInstance().getGame(gameid);
        Sign s0 = signs.get(0);
        Sign s1 = signs.get(1);

        //sign 0
        s0.setLine(0, "[SurvivalGames]");
        s0.setLine(1, "Click to join");
        s0.setLine(2, "Arena " + gameid);

        //sign 1
        s1.setLine(0, game.getName());
        s1.setLine(1, game.getMode() + "");
        s1.setLine(2, game.getActivePlayers() + "/" + ChatColor.GRAY + game.getInactivePlayers() + ChatColor.BLACK + "/" + SettingsManager.getInstance().getSpawnCount(game.getID()));

        //live update line s1
        if (game.getMode() == Game.GameMode.STARTING) {
            s1.setLine(3, game.getCountdownTime() + "");
        } else if (game.getMode() == Game.GameMode.RESETING || game.getMode() == Game.GameMode.FINISHING) {
            s1.setLine(3, game.getRBStatus());
            if (game.getRBPercent() > 100) {
                s1.setLine(1, "Saving Queue");
                s1.setLine(3, (int) game.getRBPercent() + " left");
            } else s1.setLine(3, (int) game.getRBPercent() + "%");
        } else {
            s1.setLine(3, "");
        }

        //live player data
        ArrayList < String > display = new ArrayList < String > ();
        for (Player p: game.getAllPlayers()) {
View Full Code Here

                // System.out.println(msg[a]);
                char[] line = msg[a].toCharArray();
                for (int b = 0; b < line.length; b++) {

                    //System.out.println(y/16+"    "+x/4+"     "+(3-x)%4+"     "+x);
                    Sign sig = signs[x][((y) / 16)];
                    sig.setLine(lineno, sig.getLine(lineno) + line[b]);
                    //System.out.println(sig.getLine(x%4));
                    signs[x][((y) / 16)].update();

                    y++;
                }
View Full Code Here

            for (int y = signs.length - 1; y != -1; y--) {
                for (int a = 0; a < 4; a++) {

                    for (int x = 0; x != signs[0].length; x++) {

                        Sign sig = signs[y][x];
                        sig.setLine(a, "");
                        sig.update();

                    }

                }
            }
View Full Code Here

        if(!(e.getAction()==Action.RIGHT_CLICK_BLOCK || e.getAction()==Action.LEFT_CLICK_BLOCK)) return;
       

        Block clickedBlock = e.getClickedBlock();
        if(!(clickedBlock.getType()==Material.SIGN || clickedBlock.getType()==Material.SIGN_POST || clickedBlock.getType()==Material.WALL_SIGN)) return;
        Sign thisSign = (Sign) clickedBlock.getState();
        //System.out.println("Clicked sign");
        String[] lines = thisSign.getLines();
        if(lines.length<3) return;
        if(lines[0].equalsIgnoreCase("[SurvivalGames]")) {
            e.setCancelled(true);
            try{
                if(lines[2].equalsIgnoreCase("Auto Assign")){
View Full Code Here

     */
    @Override
    public void update()
    {
        super.update();
        Sign state = (Sign) getBlock().getState();
        Sign sign = (Sign) blockState;
        for (int k = 0; k < 4; k++)
            state.setLine(k, sign.getLine(k));

        state.getData().setData(sign.getRawData());
        state.update(true);
    }
View Full Code Here

   
    for(Integer i = 0; i <= 3; i++){
     
      if(newPlayer.getLocation().add(0, -i, 0).getBlock().getType().equals(Material.SIGN_POST)){
       
        Sign sign = (Sign) newPlayer.getLocation().add(0, -i, 0).getBlock().getState();
       
        if(sign.getLine(0).equalsIgnoreCase("[PridePort]")){
       
          String arenaName = sign.getLine(1); //This is the arena name right here


          try {
            ArenaManager.addPlayerToArena(newPlayer, arenaName);
          } catch (Exception e) {
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.