Dieser Commit ist enthalten in:
Ursprung
846147b521
Commit
91aada8a62
@ -39,11 +39,9 @@ import java.util.logging.Level;
|
||||
|
||||
public class Core extends JavaPlugin{
|
||||
|
||||
public static final Message MESSAGE = new Message("SpigotCore", Core.class.getClassLoader());
|
||||
|
||||
private static final int VERSION;
|
||||
public static final Message MESSAGE;
|
||||
|
||||
private static Core instance;
|
||||
|
||||
static{
|
||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||
if(packageName.contains("1_18"))
|
||||
@ -62,13 +60,30 @@ public class Core extends JavaPlugin{
|
||||
VERSION = 8;
|
||||
else
|
||||
VERSION = 18;
|
||||
}
|
||||
public static int getVersion(){
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
MESSAGE = new Message("SpigotCore", Core.class.getClassLoader());
|
||||
private static JavaPlugin instance;
|
||||
public static JavaPlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
public static void setInstance(JavaPlugin instance) {
|
||||
Core.instance = instance;
|
||||
}
|
||||
|
||||
private static boolean standalone = true;
|
||||
public static boolean standalone() {
|
||||
return standalone;
|
||||
}
|
||||
|
||||
private static File sqlConfig;
|
||||
public static File sqlConfig() {
|
||||
return sqlConfig;
|
||||
}
|
||||
|
||||
private ErrorHandler errorHandler;
|
||||
private File sqlConfig;
|
||||
private boolean standalone;
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
@ -77,8 +92,7 @@ public class Core extends JavaPlugin{
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
sqlConfig = new File(Core.getInstance().getDataFolder(), "MySQL.yml");
|
||||
standalone = !sqlConfig.exists();
|
||||
setSqlConfig();
|
||||
errorHandler = new ErrorHandler();
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
|
||||
@ -99,26 +113,13 @@ public class Core extends JavaPlugin{
|
||||
public void onDisable() {
|
||||
TinyProtocol.instance.close();
|
||||
errorHandler.unregister();
|
||||
Statement.close();
|
||||
if(!standalone) {
|
||||
Statement.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static File sqlConfig() {
|
||||
return instance.sqlConfig;
|
||||
}
|
||||
|
||||
public static boolean standalone() {
|
||||
return instance.standalone;
|
||||
}
|
||||
|
||||
public static Core getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static int getVersion(){
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
private static void setInstance(Core instance) {
|
||||
Core.instance = instance;
|
||||
private static void setSqlConfig() {
|
||||
sqlConfig = new File(Core.getInstance().getDataFolder(), "MySQL.yml");
|
||||
standalone = !sqlConfig.exists();
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren