First join message help

Discussion in 'Server & Community Management' started by MrsKliper, Jun 10, 2016.

  1. When players first join server their message says
    Welcome back (name) to Server,
    then under that it says Welcome (name) has joined the server for the first time.
    I can't figure out why it's giving 2 messages when it's the first time they joined the server. Any one have any ideas not sure if its essentials or a plugin that's conflicting with it.
     
  2. mathhulk

    mathhulk Retired Moderator
    Retired

    Essentials displays both the default join message and first join message when a player join for the first time.
     
  3. any way to fix it so it doesn't do two messages at first time join?
     
  4. You could change your regular join message from "Welcome back (name)" to "(name) has joined" or something like that.
    If you really want just one message to show you'd probably need to get a separate plugin, there are plenty out there.
     
  5. Check the essentials config @ Essentials CHat
     
  6. You have to register new players. Then check if the player is already registered. For example:

    Code (Text):
    ArrayList<String> Registered = new ArrayList<String>();

    @EventHandler
    public void onJoin(PlayerJoinEvent e){
      if (!(Registered.contains(e.getPlayer())) {
        Registered.add(e.getPlayer());
        e.setJoinmessage(<whatever you want if the player is new>);
        return;
    }
      if (Registered.contains(e.getPlayer())) {
       e.setJoinmessage(<whatever you want if the player isn't new>);
    }
    }
    The only thing you still have to do is adding non-registered players to the registered list like in the example.
     
  7. You will need to recode it or why dont you just remove the first join message?
     
  8. Code (Java):
    @EventHandler
    public void onJoin(PlayerLoginEvent e)
    {
       Player p = e.getPlayer();
         
        if (p.hasPlayedBefore())
        {
            p.sendMessage("welcome back!");
        }
        else
        {
            p.sendMessage("welcome new!");
        }
    }