[SOLVED] OnPlayerJoin override problem (#602)

Discussion in 'Plugin Development' started by zweizeichen, Mar 30, 2011.

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

    zweizeichen

    Hey,
    at the moment I am trying to make my plugin run on 602, but I do not manage to get the OnPlayerJoin function of my PlayerListener class working.
    I am trying to run this code:

    Code:
    @Override
        public void onPlayerJoin (PlayerJoinEvent event)     {
    // Code
    }
    But it still gives me that error:

    Code:
    class org.zweizeichen.Motd.MotdPlayerListener overrides final method onPlayerJoin.(Lorg/bukkit/event/player/PlayerEvent;)
    But by changing the type from "PlayerEvent" to "PlayerJoinEvent" it should call the non-final function which I can override. I do not understand why it still calls the PlayerEvent function.

    How can I fix this error?

    void org.bukkit.event.player.PlayerListener.onPlayerJoin(PlayerJoinEvent event)
    final void org.bukkit.event.player.PlayerListener.onPlayerJoin(PlayerEvent event)
     
  2. Offline

    Grum Bukkit Team Member

    You are compiling against a version which doesn't have the new signature yet? :/

    My testcode contains:
    Code:
    pm.registerEvent( Event.Type.PLAYER_JOIN, player, Event.Priority.Monitor, this);
    
    @Override public void onPlayerJoin(PlayerJoinEvent event) { plugin.recordEvent(event); }
    And that works against the latest builds.
     
  3. Offline

    zweizeichen

    I am using this version of bukkit for my build path and this jar for my testing server.
    Could the eclipse project be screwed up? Or did I just make a stupid mistake?
    I added the source of my plugin to this post.

    Are you able to compile and run it?
     

    Attached Files:

  4. Offline

    Taco

    I have the same problem using both the latest recommended builds. It's only doing this for onPlayerJoin, and not on onPlayerQuit.

    My code:
    Code:
    @Override
        public void onPlayerJoin(PlayerLoginEvent event)
        {
            Player player = event.getPlayer();
            if((godPowers.Permissions == null && player.isOp()) || godPowers.Permissions.has(player, "godPowers.godmodeOnLogin"))
            {
                player.sendMessage("As you enter the world, you feel your godly powers returning.");
                player.setDisplayName(godPowers.title + player.getName());
                godPowers.godmodeEnabled.add(player.getName());
                player.setHealth(20);
            }
        }
    The error I get in eclipse:

    Code:
    The method onPlayerJoin(PlayerLoginEvent) of type godPowersPlayerListener must override or implement a supertype method
    
     
  5. Offline

    Raphfrk

    Think you need:
    public void onPlayerJoin(PlayerJoinEvent event)

    Player quit should also require a PlayerQuitEvent

    Not sure what the issue is with the OP.
     
  6. Offline

    Drakia

  7. Offline

    Taco

    *facepalm* Thank you. That was my problem.
     
  8. Offline

    zweizeichen

    :eek:
    MUST KILL ECLIPSE!

    Now it works perfectly again.
    Thank you for your efforts!
     
Thread Status:
Not open for further replies.

Share This Page