Could not pass event PLAYER_INTERACT to..

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

  1. Offline

    desup

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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);

    This post has been edited 1 time. It was last edited by Pandemoneus Dec 20, 2011.
  4. Offline

    desup

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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