hasPlayedBefore

Discussion in 'Plugin Development' started by iKeirNez, Mar 24, 2012.

Thread Status:
Not open for further replies.
  1. I am using the PlayerLoginEvemt to check if the user has joined before by using player.hasPlayedBefore. If the player hasn't joined before then it will send them a welcome message.

    Apparently by the time the PlayerLogin event is fired the user dat file has already been created.

    I then tried using the PlayerPreLogin event and message is not shown to the user.

    So what way could I use to get this working? I have also tried the PlayerJoinEvent but it too doesn't work.

    Thanks
    Keir
     
  2. Offline

    comp8nerd4u2

    You will not be able to accomplish this with one single method. Make a Queue object (or something like that) and in your PlayerPreLoginEvent, put the player in the queue, and then in a PlayerRespawnEvent, check if the player is in the queue, and if they are, then display the message. I have not tested this but it SHOULD work.

    Edit: It is important for you guys to realize that you have the full Sun JRE 7 (or 6) at your disposal. Use it. :)
     
  3. PHP:
    public void event(PlayerJoinEvent ev)
    {
        
    Player p ev.getPlayer();
        if(!
    p.hasPlayedBefore()
        {
            
    p.sendMessage("blah blah welcome blah");
        }
    }
    Thats what i use, and it works fine :)
     
  4. Offline

    Justin Quach

    That way won't work on Multi-world though.

    I'm already trying to develop a plugin that welcome's new players.
    Currently adding a config.yml but I'm having trouble detecting if the config exists.
     
  5. Offline

    chaseoes

  6. Offline

    Justin Quach

  7. Offline

    chaseoes

    Are you serious? You used the exact same code that mine uses, down to the same variable names. My source is free and available to use for a reason, and I don't mind if people "borrow" it, but I thought that it would at least be used for something better than what my plugin has to offer. All you did was flat out copy what mine does with less functionality (and stole another plugin's name in the process, at least I respected not using the original name).

    http://cache.ohinternet.com/images/...dFacepalm.jpg/618px-JeanLucPicardFacepalm.jpg
     
Thread Status:
Not open for further replies.

Share This Page