Problem/Bug onPlayerInteract() Bug

Discussion in 'Bukkit Help' started by MrWaffleman, Jul 29, 2015.

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

    MrWaffleman

    Code:
    EventHandler(priority = EventPriority.HIGHEST)
        public void onPlayerInteract(PlayerInteractEvent e) {
            if(!(e.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
            if(e.getClickedBlock().getType() == Material.SPONGE) {
        }
    }
    For some reason these lines of code don't work, and when I right-click sponge, nothing happens...
     
  2. Offline

    oceantheskatr

    Well that's because you haven't set anything to happen when you right-click the sponge... :p

    Try putting e.getPlayer().sendMessage("Test") in between the brackets and let me know if it sends you "Test" when you right click sponge.

    Also, have you implemented Listener in your class?

    Code:
    if(e.getClickedBlock().getType() == Material.SPONGE) {
       }
    
     
    Last edited: Jul 29, 2015
  3. Offline

    MrWaffleman

    Thanks for helping but I found the solution... now the new problem is in this thread :/ .
     
Thread Status:
Not open for further replies.

Share This Page