Could not pass event PLAYER_INTERACT to..

Discussion in 'Plugin Development' started by desup, Dec 20, 2011.

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

    desup

    Hello, i need another help from you ( sorry :D )
    Still working on the same plugin as in my older posts, but now, Im getting error Could not pass event PLAYER_INTERACT to..
    With this code in Block Listener:

    Code:
     public void onPlayerInteract(PlayerInteractEvent event){
                Player player = event.getPlayer();
                if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
                    Block b = event.getClickedBlock();
                    if(b.getType() == Material.SIGN_POST){
                          if(((Sign)b.getState()).getLines()[0].equals("[BARAK]")){
                              for(int q = 1;q <= 3; q++){
                                    Block newBlock = player.getWorld().getBlockAt(b.getX(), b.getY()+q, b.getZ());
                                    newBlock.setTypeId(49);
    
            }
                    }
                }
                }
           }
    And with this one in main class:

    Code:
    public void onEnable(){
        PluginManager pm = getServer().getPluginManager();
        pm.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, Event.Priority.Normal, this);
        pm.registerEvent(Event.Type.PLAYER_INTERACT, this.blockListener, Event.Priority.Normal, this);
        PluginDescriptionFile pdfFile = this.getDescription();
        this.logger.info( pdfFile.getName() + " version " + pdfFile.getVersion() + " Is working!!");
    }
    Sorry, I am professional in PHP, bu in Java I am REALLY BIG NOOB.. :D Please help me ..
    thx
     
  2. Offline

    nisovin

    That should be in a player listener. Also, what's the stack trace? And what line is it pointing to? All this information is necessary.
     
  3. Hey, the onPlayerInteract belongs into a PlayerListener, but in your onEnable you are using it on your blockListener
    pm.registerEvent(Event.Type.PLAYER_INTERACT, this.blockListener, Event.Priority.Normal, this);
     
  4. Offline

    desup

    Sorry, but I am the biggest noob that youve vere seen , i guess.
    First sentence is everything, that i have understood.
    Sorry, everything from my plugin is just mixture of the tutorials..
     
Thread Status:
Not open for further replies.

Share This Page