Player_Join and Player_Quit in same class

Discussion in 'Plugin Development' started by Linkupdated, Mar 24, 2011.

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

    Linkupdated

    hi there i just want to know if its possible to make the event player_join and player_quit on the same class ive been trying but only player quit seems to be working...

    Code:
            pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Event.Priority.Normal, this);
            pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Event.Priority.Normal, this);
    Thanks a lot guys
     
  2. Offline

    Stmeter

    It should work, at least for me it is.

    Here's a simple MOTD using PLAYER_JOIN

    Code:
    public void onPlayerJoin(PlayerEvent event){
             Player player = event.getPlayer();
             player.sendMessage("Hello World!");
         }
    Remember that this needs to go in your playerListener, or wherever the PlayerListener class is extended.
     
  3. Offline

    Linkupdated

    wow... lol i just fixed it by myself player_join must be declared before player_quit. Sorry.
     
Thread Status:
Not open for further replies.

Share This Page