30 lines
922 B
Java
30 lines
922 B
Java
package eu.univento.maya;
|
|
|
|
import eu.univento.maya.game.GameStage;
|
|
import eu.univento.maya.game.RestartCounter;
|
|
import org.bukkit.Bukkit;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 0.1
|
|
*/
|
|
public class Utils {
|
|
|
|
public static void endGame(GameStage stage) {
|
|
Maya.setStage(GameStage.Restart);
|
|
Maya.restartID = Maya.getInstance().getServer().getScheduler().scheduleSyncRepeatingTask(Maya.getInstance(), new RestartCounter(), 20L, 20L);
|
|
Bukkit.getScheduler().cancelTask(getSchedulerId(stage));
|
|
}
|
|
|
|
static int getSchedulerId(GameStage stage) {
|
|
switch (stage) {
|
|
case Lobby: return Maya.lobbyID;
|
|
case Warmup: return Maya.warmupID;
|
|
case InGame: return Maya.gameID;
|
|
case Buy: return Maya.buyID;
|
|
case DeathMatch: return Maya.deathmatchID;
|
|
case Restart: return Maya.restartID;
|
|
default: return 0;
|
|
}
|
|
}
|
|
} |