124 lines
3.3 KiB
Java
124 lines
3.3 KiB
Java
package eu.univento.lobby;
|
||
|
||
import java.util.ArrayList;
|
||
import java.util.logging.Level;
|
||
import java.util.logging.Logger;
|
||
|
||
import org.bukkit.Bukkit;
|
||
import org.bukkit.Difficulty;
|
||
import org.bukkit.World;
|
||
import org.bukkit.entity.Player;
|
||
import org.bukkit.plugin.PluginManager;
|
||
import org.bukkit.plugin.java.JavaPlugin;
|
||
|
||
import eu.univento.core.api.Messages;
|
||
import eu.univento.core.api.Settings;
|
||
import eu.univento.lobby.commands.SetNPC;
|
||
import eu.univento.lobby.commands.Setloc;
|
||
import eu.univento.lobby.commands.StatusSign;
|
||
import eu.univento.lobby.listeners.Events;
|
||
import eu.univento.lobby.listeners.ItemEvents;
|
||
import eu.univento.lobby.listeners.JoinQuit;
|
||
import eu.univento.lobby.listeners.Jumppads;
|
||
import eu.univento.lobby.listeners.Menu;
|
||
import eu.univento.lobby.listeners.PlayerHider;
|
||
import eu.univento.lobby.listeners.StatusSigns;
|
||
import eu.univento.lobby.listeners.Teleport;
|
||
import eu.univento.lobby.utils.StatusSignUtil;
|
||
|
||
/**
|
||
* main class...
|
||
* @author joethei
|
||
* @version 1.0
|
||
*/
|
||
public class Lobby extends JavaPlugin{
|
||
|
||
/**
|
||
* list of StatusSigns
|
||
*/
|
||
private static ArrayList<StatusSignUtil> signs = new ArrayList<StatusSignUtil>();
|
||
/**
|
||
* @return list of StatusSigns
|
||
*/
|
||
public static ArrayList<StatusSignUtil> returnSigns() {
|
||
return signs;
|
||
}
|
||
|
||
/**
|
||
* opened Inventorys
|
||
*/
|
||
private static ArrayList<Player> openInventorys = new ArrayList<Player>();
|
||
/**
|
||
* @return list of players that have a inventory open
|
||
*/
|
||
public static ArrayList<Player> getOpenInventorys() {
|
||
return openInventorys;
|
||
}
|
||
|
||
/**
|
||
* plugin instance
|
||
*/
|
||
public static Lobby instance;
|
||
/**
|
||
* @return instance of plugin
|
||
*/
|
||
public static Lobby getInstance() {
|
||
return instance;
|
||
}
|
||
|
||
/**
|
||
* Logger to log to
|
||
*/
|
||
private static Logger log = Bukkit.getLogger();
|
||
|
||
/**
|
||
* Prefix for messages
|
||
*/
|
||
|
||
/**
|
||
* @param level Log level
|
||
* @param string String
|
||
*/
|
||
public static void log(Level level, String string) {
|
||
log.log(level, "[" + Messages.CONSOLE_PREFIX + Lobby.getInstance().getDescription().getName() + "] " + string);
|
||
}
|
||
|
||
|
||
@Override
|
||
public void onEnable() {
|
||
instance = this;
|
||
PluginManager pm = Bukkit.getPluginManager();
|
||
pm.registerEvents(new Jumppads(), this);
|
||
pm.registerEvents(new JoinQuit(), this);
|
||
pm.registerEvents(new Teleport(), this);
|
||
pm.registerEvents(new Events(), this);
|
||
pm.registerEvents(new Menu(), this);
|
||
pm.registerEvents(new PlayerHider(), this);
|
||
pm.registerEvents(new StatusSigns(), this);
|
||
pm.registerEvents(new ItemEvents(), this);
|
||
if(Settings.isDebug()) log.log(Level.INFO, "Events registriert");
|
||
|
||
String[] setloc = {""};
|
||
new Setloc(this, "setloc", "Setzt Teleport Punkte", setloc);
|
||
|
||
String[] statussign = {""};
|
||
new StatusSign(this, "statussign", "Setzt Server Status Schilder", statussign);
|
||
|
||
String[] setnpc = {""};
|
||
new SetNPC(this, "setnpc", "Setzt NPC f<>r Server Auswahl", setnpc);
|
||
|
||
if(Settings.isDebug()) log.log(Level.INFO, "Befehle registriert");
|
||
|
||
for(World w : Bukkit.getWorlds()) {
|
||
w.setDifficulty(Difficulty.PEACEFUL);
|
||
}
|
||
|
||
log.log(Level.INFO, " Plugin ver." + getDescription().getVersion() + " gestartet");
|
||
}
|
||
|
||
@Override
|
||
public void onDisable() {
|
||
log.log(Level.INFO, "[Lobby] Plugin beendet");
|
||
}
|
||
|
||
} |