sign.update() and setType() probleme

Discussion in 'Plugin Development' started by lokki23, Feb 9, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    lokki23

    Hello,
    My problem is the following :
    If I do a setType after a sign.uptade(), the sign update don't work. Why? Is it a bug?

    My code :
    Code:
    public void onBlockRightClick(BlockRightClickEvent event) {
        Block block = event.getBlock();
        BlockState blockState = event.getBlock().getState();
        Player player = event.getPlayer();
        String playerName = player.getName();
    
        if(block.getType() == Material.WALL_SIGN){
            Sign sign = (Sign) blockState;
            if(sign.getLine(1).equals("")){
                sign.setLine(3, "open");
                sign.update();
            }
            if(sign.getLine(3).equals("open")){
                sign.setLine(3, "close");
                sign.update();
    
                //Work without this line
                sign.getWorld().getBlockAt(sign.getX(), sign.getY() - 1, sign.getZ()).setType(Material.BEDROCK);
            }
            else if(sign.getLine(3).equals("close")){
                sign.setLine(3, "open");
                sign.update();
    
                //and without this line
                sign.getWorld().getBlockAt(sign.getX(), sign.getY() - 1, sign.getZ()).setType(Material.AIR);
            }
        }
    }

    If I switch open to close or close to open and I reboot the serveur, panel display is updated.
    An idea?

    Sorry if my english is not perfect.
     
Thread Status:
Not open for further replies.

Share This Page