Log in message

Discussion in 'Plugin Development' started by Tomp13, May 25, 2013.

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

    Tomp13

    Ok scrap that, I'm re-doing it:

    Could someone tell me the code for being able to make this come up with someone's name (Not Yuzko) when someone checks if they are online (Eg when they message them) -

    [​IMG]
     
  2. Offline

    caseif

    If that's your full class, then you forgot to register events when the plugin is enabled.
     
  3. Offline

    felixfritz

    The class has to implement the Listener interface, in the main class you have to register that event.

    PHP:
    public class PlayerJoin implements Listener {
     
        
    //Do the rest
     
    }
    That's what your main class should look like:
    PHP:
    public class MainClass extends JavaPlugin {
     
        public 
    void onEnable() {
       
            
    getServer().getPluginManager().registerEvents(new PlayerJoin(), this);
       
        }
     
        
    //Some other stuff
    }
     
  4. Offline

    frozenpoptartmc

    Code:java
    1.  
    2. [FONT=Consolas]if(p.hasPlayedBefore()){[/FONT]
    3. [FONT=Consolas] Bukkit.getServer().broadcastMessage(ChatColor.GRAY + "Welcome " + ChatColor.GOLD + p.getName() + ChatColor.GRAY + " to the server, it's their first time!");[/FONT]
    4. [FONT=Consolas] }else{[/FONT]
    5. [FONT=Consolas] p.sendMessage(ChatColor.GRAY + "Welcome back, " + ChatColor.GOLD + p.getName())[/FONT]
    6. [FONT=Consolas][/FONT]

    This isn't entirely relevant to your question, but you're saying if they have played before, announce that it's their first time...what's with this weird font?
     
  5. Offline

    Tomp13

    Please re-read my first post. :)
     
  6. Offline

    Wingzzz

    Edit, copy what is inside your CODE syntax, then click the little {}# code icon and paste in there. This way any external font will be translated to the default.
     
  7. Offline

    frozenpoptartmc

    I think you can do if(player.isOnline){ but I'm not sure
     
Thread Status:
Not open for further replies.

Share This Page