81 lines
2.1 KiB
Java
81 lines
2.1 KiB
Java
package eu.univento.maya;
|
|
|
|
import eu.univento.commons.server.ServerType;
|
|
import eu.univento.core.api.server.ServerSettings;
|
|
import eu.univento.maya.game.GameStage;
|
|
import eu.univento.maya.game.LobbyCounter;
|
|
import eu.univento.maya.listener.PlayerEvents;
|
|
import lombok.Getter;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.GameMode;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.plugin.PluginManager;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
/**
|
|
* main class
|
|
* @author joethei
|
|
* @version 0.1
|
|
*/
|
|
public class Maya extends JavaPlugin{
|
|
|
|
@Getter
|
|
private static Maya instance;
|
|
|
|
private static Logger logger = Bukkit.getLogger();
|
|
|
|
private static GameStage stage;
|
|
|
|
public static GameStage getStage() {
|
|
return stage;
|
|
}
|
|
|
|
public static void setStage(GameStage stage) {
|
|
Maya.stage = stage;
|
|
}
|
|
|
|
public static int getMinPlayers() {
|
|
return 1;
|
|
}
|
|
|
|
public static int getMaxPlayers() {
|
|
return 12;
|
|
}
|
|
|
|
@Getter
|
|
private static ArrayList<Player> players = new ArrayList<>();
|
|
|
|
public static int lobbyID;
|
|
public static int warmupID;
|
|
public static int gameID;
|
|
public static int buyID;
|
|
public static int deathmatchID;
|
|
public static int restartID;
|
|
|
|
public static void log(Level level, String string) {
|
|
logger.log(level, "[" + getInstance().getDescription().getName() + "] " + string);
|
|
}
|
|
|
|
@Override
|
|
public void onEnable() {
|
|
instance = this;
|
|
PluginManager pm = Bukkit.getPluginManager();
|
|
pm.registerEvents(new PlayerEvents(), this);
|
|
ServerSettings.setServerType(ServerType.GAME_MAYA);
|
|
ServerSettings.setGameMode(GameMode.ADVENTURE);
|
|
log(Level.INFO, "Plugin Version: " + getDescription().getVersion() + " gestartet");
|
|
stage = GameStage.Lobby;
|
|
lobbyID = getServer().getScheduler().scheduleSyncRepeatingTask(getInstance(), new LobbyCounter(), 20L, 20L);
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onDisable() {
|
|
log(Level.INFO, "Plugin beendet");
|
|
}
|
|
|
|
} |