You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a small working example to create a 30 second timer with 2 bars
inttime = 30 * 20; // 30 seconds in ticksStringname = "testTimer"; // Timer nameJavaPluginplugin = this; // The plugin creating the timerTimertimer = newTimer(time, name, this); // Create a new timer with time and nametimer.addAllPlayers(); // Show the timer to all playerstimer.addBar("2", "2"); // Add a second bar with title "2"timer.addAllPlayers("2"); // Show the second bar to all playerstimer.setTitle("1"); // Set the title of the main bar to "1"TimeRunnabledone = newTimeRunnable() { // Create callback for when timer is donepublicvoidrun(Timertimer) {
Bukkit.getConsoleSender().sendMessage("Timer Done"); // Send a message to the console saying the timer is donetimer.stop(); // Stop the timer (Optional)timer.removeAllPlayers(); // Hide the main bar from all players (It wont show up if you restart it then)timer.removeAllPlayers("2"); // Hide the second bar from all players (It wont show up if you restart it then)
}
};
timer.addCallback(0,done); // Add the callback at 0 ticks remainingtimer.start(); // Start the timer