Record Time online... How?

Discussion in 'Plugin Development' started by anonym110, Sep 9, 2012.

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

    anonym110

    Ok so I want to pay players for the time they are online including some other things too, now the thing is I have no idea how to get the players time online? I assume I would call an event when they join and when they logout again? Or do I run a check every 5 mins?
     
  2. Yes, you would listen for PlayerJoinEvent and PlayerQuitEvent.
    Make some @EventHandler methods. I bet you know how that works.

    You can get the current time with Calendar.getInstance().getTimeInMills() or something.
    Remember that time, untill he quits. And check the time again.
    Subtract the two times, and your done! :)
     
    Zidkon likes this.
  3. Offline

    SirTyler

    player.getFirstPlayed() compared to current date?
     
  4. That doesn't count online-time.
    That counts total time since first-join.
     
  5. Offline

    SirTyler

    Ah, this was an attempt at just seeing how long they have been part of the server. If it is how long they have been online it is a simple store of what time (or minutes) they have been online since login to leave (as already stated).
     
  6. exactly
     
  7. Offline

    anonym110

    Ok thanks thats what I figured :)
     
Thread Status:
Not open for further replies.

Share This Page