SteamWar/SpigotCore
Archiviert
13
0

Provide embedded capability
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-02-02 11:37:44 +01:00
Ursprung 846147b521
Commit 91aada8a62

Datei anzeigen

@ -39,11 +39,9 @@ import java.util.logging.Level;
public class Core extends JavaPlugin{ public class Core extends JavaPlugin{
public static final Message MESSAGE = new Message("SpigotCore", Core.class.getClassLoader());
private static final int VERSION; private static final int VERSION;
public static final Message MESSAGE;
private static Core instance;
static{ static{
String packageName = Bukkit.getServer().getClass().getPackage().getName(); String packageName = Bukkit.getServer().getClass().getPackage().getName();
if(packageName.contains("1_18")) if(packageName.contains("1_18"))
@ -62,13 +60,30 @@ public class Core extends JavaPlugin{
VERSION = 8; VERSION = 8;
else else
VERSION = 18; 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 ErrorHandler errorHandler;
private File sqlConfig;
private boolean standalone;
@Override @Override
public void onLoad() { public void onLoad() {
@ -77,8 +92,7 @@ public class Core extends JavaPlugin{
@Override @Override
public void onEnable() { public void onEnable() {
sqlConfig = new File(Core.getInstance().getDataFolder(), "MySQL.yml"); setSqlConfig();
standalone = !sqlConfig.exists();
errorHandler = new ErrorHandler(); errorHandler = new ErrorHandler();
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this); Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
@ -99,26 +113,13 @@ public class Core extends JavaPlugin{
public void onDisable() { public void onDisable() {
TinyProtocol.instance.close(); TinyProtocol.instance.close();
errorHandler.unregister(); errorHandler.unregister();
Statement.close(); if(!standalone) {
Statement.close();
}
} }
public static File sqlConfig() { private static void setSqlConfig() {
return instance.sqlConfig; sqlConfig = new File(Core.getInstance().getDataFolder(), "MySQL.yml");
} standalone = !sqlConfig.exists();
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;
} }
} }