Right Click Block

Discussion in 'Plugin Development' started by MvpWouterske23, Apr 14, 2014.

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

    MvpWouterske23

    Hello guys!

    I'd like to make a plugin when i right clock an emerald block I get a message. But it send the message when I place the block. Can annyone help me?

    Code:java
    1. @EventHandler
    2. public void onInteract(PlayerInteractEvent e){
    3. Player p = e.getPlayer();
    4. Location loc = p.getLocation();
    5. Action a = e.getAction();
    6. ItemStack is = e.getItem();
    7. if(!(is.getType() == Material.EMERALD_BLOCK)){
    8. return;
    9. }
    10.  
    11. if (e.getAction() == Action.RIGHT_CLICK_BLOCK && is.getType() == Material.EMERALD_BLOCK) {
    12.  
    13. p.sendMessage("Test");
    14.  
    15.  
    16.  
    17.  
    18.  
    19. }
    20.  
    21.  
    22. }
    23. }
    24.  
     
  2. Offline

    siyman4

    When you right click, it is normal to place a block.. Perhaps you want the message to display when you left click the emerald?
     
  3. Offline

    MvpWouterske23

  4. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

Thread Status:
Not open for further replies.

Share This Page