Time Left

Discussion in 'Plugin Development' started by bubblefat_, Jun 3, 2015.

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


    I'm making a tempmute command, the way I'm doing it is that when the player is muted after the
    scheduleSyncDelayedTask they are removed from the HashMap. I want to be able to tell the player how much time until the scheduleSyncDelayedTask is over/done. So basically when a player is muted I send them this messages

    player.sendMessage("You are muted for another "  + timeleft);
    this is the scheduleSyncDelayedTask
                            Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable(){
                                public void run(){
                            }, 1000);
  2. Offline


    You can either :
    A) Change this to a repeatableTask and count down each second, and once it is equal to 0, remove them from the map. For the message, you would just get the seconds from the map.

    B) Store the timeinmilliseconds from the start and compare it to the Millisoconds when you want to send the message (e.g. CurrentMilis - pastMillis)
Thread Status:
Not open for further replies.

Share This Page