Problem with sign

Discussion in 'Plugin Development' started by Anrza, Jul 25, 2014.

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

    Anrza

    It's pretty clear what I want it to do, but my problem is that, while I get "Hmm" and "Gah", I don't get "Tis a sign". Help please?
    Code:java
    1. @EventHandler
    2. public void onPlayerInteractEvent(PlayerInteractEvent event) {
    3. System.out.println("Hmm");
    4. if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
    5. System.out.println("Gah");
    6. if (event.getClickedBlock().equals(Material.SIGN_POST)) {
    7. System.out.println("Tis a sign");
    8. }
    9. }
    10. }
     
  2. Offline

    Niknea

    Anrza Change line 6 to:

    PHP:
    if(event.getClickedBlock().getType() == Material.SIGN_POST || event.getClickedBlock().getType() == Material.SIGN || event.getClickedBlock().getType() == Material.WALL_SIGN
     
    Anrza likes this.
  3. Offline

    daavko

    Niknea Note: Material.SIGN is sign item, which you have in inventory. That's not a block.
     
  4. Offline

    Anrza

    Niknea Thank you very much.
     
Thread Status:
Not open for further replies.

Share This Page