1.8.8 Sign updating problem

Discussion in 'Spigot Plugin Development' started by erikgamer07, Feb 27, 2020.

  1. Hello! I'm creating a minigame. Right now I am with the signs system, and I have a problem. I have seen a lot of posts and things about sign updating, and I have tried with all, but it doesn't updates. I have this method to update the sign:
    Code (Java):
        public void updateSign() {
            Sign sign = map.getSign();

            sign.setLine(0, ChatAPI.cc(sign.getLine(0)));

            if(map.getState().equals(State.WAITING)) {
                sign.setLine(1, ChatAPI.cc("&aEsperando"));
            } else if(map.getState().equals(State.STARTING)) {
                sign.setLine(1, ChatAPI.cc("&6Empezando"));
            } else if(map.getState().equals(State.FULL)) {
                sign.setLine(1, ChatAPI.cc("&5Llena"));
            } else if(map.getState().equals(State.INGAME)) {
                sign.setLine(1, ChatAPI.cc("&cEn juego"));
            }

            sign.setLine(2, ChatAPI.cc(sign.getLine(2)));
            sign.setLine(3, ChatAPI.cc("&8" + players.size() + "/" + map.getPlayers()));

            sign.update();
        }
    I have tried with all the .update() methods, any of them worked.

    The sign looks like this when it updates:

    https://imgur.com/a/LEZFfwt

    Any idea about how to fix it? Thanks!
     
  2. SteelPhoenix

    Moderator

    So what isn't working exactly?
     
  3. So, the sign updates, but the sign has other lines, not only 2. As you can see in the code, I setline 2 lines more than 2.
     
  4. no.. youre only setting two. the game state and the player count. the other two, youre just getting whats already there and setting it again. if the lines are empty, youre just setting them to empty again..
     
  5. Before updating the lines are not empty.
     
  6. SteelPhoenix

    Moderator

    I'm assuming you're saving a reference to the sign's state? You can't.