Solved Get time how long a player has played on your server

Discussion in 'Plugin Development' started by PikaThieme, Feb 3, 2017.

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

    PikaThieme

    So I'm trying to make a plugin that if you play like 5 minutes a message wil be send to you but I don't know what is wrong with this code:

    I know this is o.5 sec :p

    Code:java
    1.  
    2. if (p.hasPlayedBefore() && p.getPlayerTime() > 10) {
     
  2. Offline

    timtower Administrator Administrator Moderator

    Moved to plugin development
     
  3. Offline

    Zombie_Striker

    @PikaThieme
    Are you using Schedulers? When a player joins, create a new delayed task. Set the delay to be 20*60*5l (5 minutes, in ticks)
     
  4. Offline

    PikaThieme

    @Zombie_Striker isn't it possible without schedulers (schedulers were deprecated or I used the wrong one)?
    btw: I don't need the time how long a player is online since join, but since first time played :)
     
  5. @PikaThieme schedulers are not deprecated, are you using:
    Code:
    new BukkitRunable() {
             @Override
               public void run {
                  //code
                }
    }.runTaskTimer(plugin, delay, how often to repeat);
    

    Sent from my iPhone using Tapatalk
     
  6. Offline

    PikaThieme

    yeah I used Runable instead of BukkitRunible thanks :D
     
Thread Status:
Not open for further replies.

Share This Page