Automatic Updating Signs

Discussion in 'Plugin Development' started by ElliottOlson, Jun 23, 2014.

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

    ElliottOlson

    I am trying to add Automatic Updating Signs to my plugin. I have stored the signs location, but when ever I try to get that signs location through a method, and change the text on it, it doesn't change it.

    Could anyone help me with a method of getting the location and changing the text on that specific sign?

    Thank you.
     
  2. Offline

    BungeeTheCookie


    Code:java
    1. @EventHandler
    2. private void t(SignChangeEvent e){
    3. Sign s = (Sign)e.getBlock().getState();
    4. e.getLines();
    5. e.setLine(0, stirng);
    6. s.setLine(0, string);
    7. s.update();
    8. }
     
  3. Offline

    ElliottOlson

    BungeeTheCookie How would I call this event? Could I call this though a command being executed?
     
  4. Offline

    BungeeTheCookie

    Bukkit.getServer().getPluginManager().registerEvents(listener, plugin)
     
  5. Offline

    Zupsub

    You're talking about different things:
    BungeeTheCookie: you've created an event which will be fired if a player creates a sign

    But the TO want to change the lines of a sign; use:

    Sign s = (Sign) yourSignBlock.getState();
    s.set...
     
  6. Offline

    BungeeTheCookie

    The event calls when the sign is modified, he can just call it and change it under conditions using if() statements
     
  7. Offline

    fireblast709

    BungeeTheCookie two things. 1) Why are you even listening to the event in the first place, since he is using Bukkit to change the lines (rather than a player). 2) Why are you using the Sign object while the event will override everything after it has been processed?

    ElliottOlson Assuming you have the Sign object, just call update() after changing the lines
     
Thread Status:
Not open for further replies.

Share This Page