Solved Simple time-related request

Discussion in 'Plugin Development' started by Reinified, Feb 18, 2018.

Thread Status:
Not open for further replies.
  1. I need to know how the following might be done:

    I would like to have 2 commands (like /start and /end). Upon doing /start a timer starts. when doing /end the timer ends and displays the time between start and end to the player. The times should be different per-player, as in 1 player doing /start does not count as a timer for everyone, just one player instead.

    How would this be done?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Reinified When /start is being used, save the System.currentMillis() in a hashmap, on /end use System.currentMillis()-<value in hashmap> then do the math to convert to seconds, minutes, hours or anything else.
     
  3. thanks, I got what I needed. For future reference, the actual method is "System.currentTimeMillis()".
     
Thread Status:
Not open for further replies.

Share This Page