Setting the text of a sign I have the coordinates of

Discussion in 'Plugin Development' started by JJJollyjim, Oct 12, 2011.

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

    JJJollyjim

    The title is pretty self-explanatory :). I have the coordinates of a sign and need to get/set the text of it.

    Any help appreciated,
    ~JJJollyjim
     
  2. Block b = getServer().getWorld("worldName").getBlockAt(x, y, z);
    Sign s = (Sign)b.getState();
    s.setLine(0, "line 1");
    s.setLine(1, "line 2");
    s.setLine(2, "line 3");
    s.setLine(3, "line 4");
    s.update();
     
  3. Offline

    JJJollyjim

    Thanks very much for the help, but it only kinda-semi works.
    When I set it with that then read it with getBlock(), it works fine as expected, except that it does not show up for the player. When the player disconnects and reconnects, it is updated. I had a look at the source of your plugin, (SignClock), and you don't seem to be doing any sort of chunk-reloading or anything, so I'm wondering why it isn't working.

    Thanks, JJJollyjim.

    EDIT: Could the problem be that I am only setting one of the lines, rather than all four?
     
  4. This is very strange. Maybe you could try setting true or false as argument to s.update();
    Not released plugins I was/am working on do that, too, so: No.
     
  5. Offline

    JJJollyjim

    Thanks for the help, s.update(true) works great.
     
Thread Status:
Not open for further replies.

Share This Page