Placing Signs without Edit Text Box

Discussion in 'Plugin Development' started by wizzinangel, Sep 17, 2014.

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

    wizzinangel

    Hi there,

    Is there a way to override the SignChangeEvent so that if the sign has certain MetaData that the "Edit Sign Text" doesn't come up?

    So for example, a sign has metadata of displayName: SaleSign.

    When someone places a sign, can SignChangeEvent check to see if the sign placed has the displayName of SaleSign and if so just place the sign with default text and not prompt the player to enter text?

    Thanks
     
  2. Offline

    masons123456

    wizzinangel You could try listening for the block place, if it's your specific sign, cancel the event and then spawn a new sign at the location and remove the sign from the inv.
     
  3. Offline

    wizzinangel

    masons123456 thanks for that..but i have tried that. Even if the block placed contains the metadata of "SomeSign" for example, it still wont cancel the SignChangeEvent.

    For the itemmeta, all i am doing to the sign is setting the DisplayName to "SomeSign". Is that correct way to do it, or is there another way to do this?
     
  4. Offline

    Dudemister1999

    Here's some pseudo-code that should help:

    Code:java
    1. On Player Interact:
    2. if player right clicked block:
    3. if player's item in hand is a sign:
    4. if the item doesn't have meta / display name, return;
    5. however, if player displayname is "Super Fancy Mystery Sign":
    6. get block clicked, set type to sign, get instance of sign from block
    7. set line 0 of sign instance to "Fancy!"
    8. update sign
    9. if amount of item in hand is more than 1, remove one from amount
    10. otherwise, just set the item to air to remove it.
    11.  
    12.  


    I can write some demonstration code, if you would like.
     
Thread Status:
Not open for further replies.

Share This Page