Item rewarding for playtime.

Discussion in 'Plugin Development' started by jellohouse, May 15, 2019.

  1. Offline

    jellohouse

    I am making a plugin that creates a custom item that can be sold for special items and traded between players. so I want the special item to be given to players for each hour of playtime. I'm not sure how to track play time for each player. Also if I figure out how to track playtime how can I get the plugin to keep track and know when to give each player another item when they hit another hour mark?
     
  2. Offline

    KarimAKL

  3. Offline

    jellohouse

    Okay so I see what you are saying, I tested the statistic and it prints out total ticks played on the server. So how would I get a runnable to be able to tell every time an hour has gone by for a player?
     
  4. Offline

    DerDonut

    You could do something like this:
    Code:Java
    1. if((Double.valueOf(ticksPlayed) / 20) % 3600 == 0) {
    2. //Give Item
    3. }


    I'm not sure if this is the best way to do it but it should work.
     
    KarimAKL likes this.

Share This Page