onBlockRightClicked not working?

Discussion in 'Plugin Development' started by Derek Peterson, Jan 3, 2011.

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

    Derek Peterson

    I'm having troubles getting an overridden onBlockRightClicked method to be called.

    The closest listener hook I could see was "BLOCK_PLACED", which I've registered:
    Code:
    getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
    Then in my block listener, I've got:
    Code:
    @Override
        public void onBlockRightClicked(BlockRightClickedEvent event){
            System.out.println("Block right clicked.");
        }
    However, that method is never being called.

    Am I doing something wrong?

    Thanks in advance!
     
  2. Offline

    D-Kalck

    There's a method called onBlockPlaced, so I don't think onBlockRightClicked will be called for a BLOCK_PLACED event.
    By the way I see much event types that don't have their listener such as BLOCK_DAMAGED or BLOCK_SENT.
    I also see listeners that don't have corresponding event types like onBlockBroken or the one that you want that is onBlockRightClicked.
    Bukkit is still in early developement so I think you should wait for the events you want.
     
  3. Offline

    caldabeast

    use this code:
    Code:java
    1.  
    2. @EventHandler
    3. public void onBlockRightClicked (PlayerInteractEvent) {
    4. if (event.getAction() == Action.RIGHT_CLICK) {
    5. Block clicked = event.getClickedBlock();
    6. //do stuff
    7. }
    8. }
    9.  


    Damn right it was necessary to respond to the oldest post in the category. :3
     
Thread Status:
Not open for further replies.

Share This Page