Solved Sign Change Event Not Working

Discussion in 'Plugin Development' started by TheCwispyOne, Oct 14, 2014.

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

    TheCwispyOne

    Code:
    Code:java
    1. @EventHandler
    2. public void onSignChange(SignChangeEvent e) {
    3. Block b = e.getBlock();
    4. Sign sign = (Sign) b.getState();
    5. if (sign.getLine(0).equalsIgnoreCase("Planet Wars") &&
    6. sign.getLine(1).equalsIgnoreCase("join")) {
    7. if (plugin.getGalaxies().contains(sign.getLine(2))) {
    8. sign.setLine(3, "0/20");
    9. sign.update();
    10. } else {
    11. sign.setLine(3, "Galaxy does not exist.");
    12. sign.update();
    13. }
    14. }
    15. }

    When I create a sign that has Planet Wars are the top line, join as the second line, and test as the 3rd line (I'm sure that test is in the Galaxies.yml) the last line of the sign doesn't change. This should work because I've got another method right above this one that works perfectly fine. I don't get any stack traces either. Help?
     
  2. Offline

    teej107

    Use the event, not the sign.
     
  3. Offline

    TheCwispyOne

    What do you mean by event? If you want me to just use Sign sign = (Sign) e.getBlock(); I can tell you that doesn't work. gives me errors in the console.

    EDIT: Ah, the powers of control + f xD turns out there is something called e.setLine(); Thanks bud :)
     
  4. Offline

    teej107

    TheCwispyOne SignChangeEvent has some very similar methods that Sign has. *hint* *hint*
     
    TheCwispyOne likes this.
Thread Status:
Not open for further replies.

Share This Page