mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-02-03 06:32:52 +08:00
Lombokify Grasscutter.java some more
This commit is contained in:
parent
ae51f4c046
commit
a5579368bb
@ -48,27 +48,27 @@ import static emu.grasscutter.config.Configuration.SERVER;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
public final class Grasscutter {
|
public final class Grasscutter {
|
||||||
private static final Logger log = (Logger) LoggerFactory.getLogger(Grasscutter.class);
|
@Getter private static final Logger logger = (Logger) LoggerFactory.getLogger(Grasscutter.class);
|
||||||
private static LineReader consoleLineReader = null;
|
private static LineReader consoleLineReader = null;
|
||||||
|
|
||||||
private static Language language;
|
@Getter @Setter private static Language language;
|
||||||
|
|
||||||
public static final File configFile = new File("./config.json");
|
public static final File configFile = new File("./config.json");
|
||||||
@Setter private static ServerRunMode runModeOverride = null; // Config override for run mode
|
@Setter private static ServerRunMode runModeOverride = null; // Config override for run mode
|
||||||
|
|
||||||
private static int day; // Current day of week.
|
@Getter private static int currentDayOfWeek;
|
||||||
@Getter @Setter private static String preferredLanguage;
|
@Getter @Setter private static String preferredLanguage;
|
||||||
|
|
||||||
private static HttpServer httpServer;
|
@Getter private static HttpServer httpServer;
|
||||||
private static GameServer gameServer;
|
@Getter private static GameServer gameServer;
|
||||||
private static PluginManager pluginManager;
|
@Getter private static PluginManager pluginManager;
|
||||||
@Getter private static CommandMap commandMap;
|
@Getter private static CommandMap commandMap;
|
||||||
|
|
||||||
private static AuthenticationSystem authenticationSystem;
|
@Getter @Setter private static AuthenticationSystem authenticationSystem;
|
||||||
private static PermissionHandler permissionHandler;
|
@Getter @Setter private static PermissionHandler permissionHandler;
|
||||||
|
|
||||||
public static final Reflections reflector = new Reflections("emu.grasscutter");
|
public static final Reflections reflector = new Reflections("emu.grasscutter");
|
||||||
public static ConfigContainer config;
|
@Getter public static ConfigContainer config;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Declare logback configuration.
|
// Declare logback configuration.
|
||||||
@ -230,18 +230,6 @@ public final class Grasscutter {
|
|||||||
* Getters for the various server components.
|
* Getters for the various server components.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static ConfigContainer getConfig() {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Language getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setLanguage(Language language) {
|
|
||||||
Grasscutter.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Language getLanguage(String langCode) {
|
public static Language getLanguage(String langCode) {
|
||||||
return Language.getLanguage(langCode);
|
return Language.getLanguage(langCode);
|
||||||
}
|
}
|
||||||
@ -250,10 +238,6 @@ public final class Grasscutter {
|
|||||||
return Grasscutter.runModeOverride != null ? Grasscutter.runModeOverride : SERVER.runMode;
|
return Grasscutter.runModeOverride != null ? Grasscutter.runModeOverride : SERVER.runMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Logger getLogger() {
|
|
||||||
return log;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LineReader getConsole() {
|
public static LineReader getConsole() {
|
||||||
if (consoleLineReader == null) {
|
if (consoleLineReader == null) {
|
||||||
Terminal terminal = null;
|
Terminal terminal = null;
|
||||||
@ -274,38 +258,14 @@ public final class Grasscutter {
|
|||||||
return consoleLineReader;
|
return consoleLineReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HttpServer getHttpServer() {
|
|
||||||
return httpServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameServer getGameServer() {
|
|
||||||
return gameServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PluginManager getPluginManager() {
|
|
||||||
return pluginManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AuthenticationSystem getAuthenticationSystem() {
|
|
||||||
return authenticationSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PermissionHandler getPermissionHandler() {
|
|
||||||
return permissionHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getCurrentDayOfWeek() {
|
|
||||||
return day;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utility methods.
|
* Utility methods.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static void updateDayOfWeek() {
|
public static void updateDayOfWeek() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
day = calendar.get(Calendar.DAY_OF_WEEK);
|
Grasscutter.currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
|
||||||
Grasscutter.getLogger().debug("Set day of week to "+day);
|
Grasscutter.getLogger().debug("Set day of week to "+currentDayOfWeek);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startConsole() {
|
public static void startConsole() {
|
||||||
@ -346,24 +306,6 @@ public final class Grasscutter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the authentication system for the server.
|
|
||||||
*
|
|
||||||
* @param authenticationSystem The authentication system to use.
|
|
||||||
*/
|
|
||||||
public static void setAuthenticationSystem(AuthenticationSystem authenticationSystem) {
|
|
||||||
Grasscutter.authenticationSystem = authenticationSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the permission handler for the server.
|
|
||||||
*
|
|
||||||
* @param permissionHandler The permission handler to use.
|
|
||||||
*/
|
|
||||||
public static void setPermissionHandler(PermissionHandler permissionHandler) {
|
|
||||||
Grasscutter.permissionHandler = permissionHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enums for the configuration.
|
* Enums for the configuration.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user