Solved onPlayerInteractBlock Event Help

Discussion in 'Plugin Development' started by jthort, Dec 22, 2013.

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

    jthort

    Hey guys this piece of code is not working, here it is:
    Code:java
    1. @EventHandler
    2. public void onPlayerInteractBlock(PlayerInteractEvent e) {
    3. Bukkit.broadcastMessage("event is working");
    4.  
    5.  
    6. if(e.getClickedBlock().getLocation() == fallingblocks.k){
    7. Bukkit.broadcastMessage("right");
    8.  
    9.  
    10. }else{
    11. Bukkit.broadcastMessage(e.getClickedBlock().getLocation() + " and " + fallingblocks.k);
    12. }
    13.  
    14. }


    Even when e.getClickedBlock().getLocation() is = to fallingblocks.loc, it still doesn't display "right". Maybe you can't compare two locations together? I don't know, any help?
     
  2. Offline

    mrkirby153

    jthort

    Did you register your event in your main onEnable() by using getServer().getPluginManager().registerEvents(new YourEventClass(), this);
     
  3. Offline

    jthort

    Yeah the event is working, it shows "event is working" every time I interact with a block
     
  4. Offline

    TheLexoPlexx

    Solved, not ?
     
  5. Offline

    jthort

    No, It's still not sending the message "right"
     
Thread Status:
Not open for further replies.

Share This Page