Could not pass event PLAYER_INTERACT to..

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

  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 (Text):
    1.  public void onPlayerInteract(PlayerInteractEvent event){
    2.             Player player = event.getPlayer();
    3.             if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
    4.                 Block b = event.getClickedBlock();
    5.                 if(b.getType() == Material.SIGN_POST){
    6.                       if(((Sign)b.getState()).getLines()[0].equals("[BARAK]")){
    7.                           for(int q = 1;q <= 3; q++){
    8.                                 Block newBlock = player.getWorld().getBlockAt(b.getX(), b.getY()+q, b.getZ());
    9.                                 newBlock.setTypeId(49);
    10.  
    11.         }
    12.                 }
    13.             }
    14.             }
    15.        }
    And with this one in main class:

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

    Pandemoneus

    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..
     

Share This Page