how to check wheter placed block is a sign?

Discussion in 'Plugin Development' started by Blacktiger07, Nov 27, 2011.

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

    Blacktiger07

    hi, how can i check wheter a placed block is sign?
    so does it need to be in blocklistener with the blockplace event and if, how to code it?
     
  2. Offline

    theguynextdoor

    Yes, it would be in your block listener with the block place event
    My guess would be this
    Code:java
    1. public void onBlockPlace(BlockPlaceEvent e){
    2. Block block = e.getBlock();
    3. if(block.getType().equals(Material.SIGN)){
    4. //Do stuff here
    5. }
    6. }
     
  3. Offline

    Blacktiger07

    ill try it

    okay i did this now, but i still cant do what i want with it.
    may you wanna check the code blockListener

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 21, 2016
  4. Offline

    theguynextdoor

  5. Offline

    WizzleDonker

    I always use a SignChangeEvent... mainly because it works with events in the future and plays well if the sign is ever changed in a way after placing. You can also get text from a SignChangeEvent... because the event is executed after a sign is placed, So you can get right into your stuff.
    Code:
    public void onSignChange(SignChangeEvent event) {
            if (event.getLine(0).equalsIgnoreCase("[heal]") {
                   event.setLine(0, "[HEAL]");
            }
    
        }
    And so on and so forth...
     
  6. Offline

    Blacktiger07

    thanks man
     
Thread Status:
Not open for further replies.

Share This Page