Sign not updating

Discussion in 'Plugin Development' started by Assist, Nov 3, 2013.

Thread Status:
Not open for further replies.
  1. It seems like sometimes my signs are working, and sometimes not. I have a method that sets sign lines depending on game states, but it doesn't seem to be updating in, nor is it correctly reading some of the lines. Here is my update method:
    Code:java
    1. public void updateSign(Sign sign) {
    2. Arena arena = new Arena(sign.getLine(2));
    3.  
    4. if (arena.getState() == GameState.RUNNING && !sign.getLine(1).equals("Game running")) {
    5. sign.setLine(1, "Game running");
    6.  
    7. } else if (arena.getState() == GameState.WAITING && !sign.getLine(1).equals("Click to Join")) {
    8. sign.setLine(1, "Click to Join");
    9.  
    10. } else if (arena.getState() == GameState.DISABLED && sign.getLine(1).equals("Arena disabled")) {
    11. sign.setLine(1, "Arena disabled");
    12. }
    13.  
    14. sign.setLine(3, arena.getPlayers().size() + "/18");
    15.  
    16. if (sign.update()) {
    17. System.out.println("Gamesign " + getMetadata(sign, "gamesign", clazz) + " updated.");
    18. }
    19.  
    20. System.out.println(sign.getLine(0) + " " + sign.getLine(1) + " " + sign.getLine(2) + " " + sign.getLine(3));
    21. }
    and here is how I call it:
    Code:java
    1. ArenaManager manager = new ArenaManager(clazz, lines[2]);
    2.  
    3. if (!manager.exists()) {
    4. manager.create();
    5.  
    6. event.getBlock().setMetadata("gamesign", new FixedMetadataValue(clazz, lines[2]));
    7. new SignWall(clazz).updateSign((Sign) event.getBlock().getState());
    8. }
    The last debug line in the update method prints this:
    Code:
     Click to Join  
    while in reality, the line 0 is my plugin name, line 2 is an arena name, and line 3 should be set to numberofplayers/18.

    Both of the debug lines are being shown, but nothing is happening to the sign lines. What could be the problem this time?
     
  2. are you realy making a new arena object every time you calling updateSign?
     
  3. ferrybig
    No, you're hallucinating. If you're not going to say anything helpful, then please don't say anything.

    It seems like if something interacts with the sign, it updates itself. Fair enough, solved.
     
Thread Status:
Not open for further replies.

Share This Page