Solved new to sign

Discussion in 'Spigot Plugin Development' started by MadMaxCookie, May 29, 2016.

  1. Hello new to sign

    how to do this ?

    for example I'm going to place a sign and put the word

    Example at the line 0 then it would be replaced to another string.
     
  2. Okay, and what is the objective of the plugin? Just replace String of a Sign?
     
  3. yep once they place the sign.
     
  4. "BlockPlaceEvent" Check if blockstate instanceof sign and cast the blockstate to a Sign object, set the text and update. Something like that anyways.
     
    #4 NinjaStix, May 29, 2016
    Last edited: May 29, 2016
  5. No, use the SignChangeEvent it's the most adapted for your situation. You can use this method to do what you want.

    Code (Text):
    public void onSignChange(SignChangeEvent event) {
        if (event.getLine(0).equalsIgnoreCase("something")
            event.setLine(0, "DAAAAAAAAAAMN");
        else if (event.getLine(0).equalsIgnoreCase("other")
            event.setLine(0, "Enjoy this help.");
        else
            event.setLine(0, "§4???");
    }
     
    • Agree Agree x 2
    • Informative Informative x 1
  6. Yes, I knew there was another event that was more suitable, but couldn't think of it.
     
  7. very thanks now I can work with.
     
  8. Your welcome. :D