mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-02-07 02:26:43 +01:00
Run IntelliJ IDEA code formatter
This commit is contained in:
@@ -7,10 +7,10 @@ import emu.grasscutter.Grasscutter.ServerDebugMode;
|
||||
import emu.grasscutter.Grasscutter.ServerRunMode;
|
||||
import emu.grasscutter.utils.JsonUtils;
|
||||
|
||||
import java.util.Set;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import static emu.grasscutter.Grasscutter.config;
|
||||
|
||||
@@ -18,6 +18,14 @@ import static emu.grasscutter.Grasscutter.config;
|
||||
* *when your JVM fails*
|
||||
*/
|
||||
public class ConfigContainer {
|
||||
public Structure folderStructure = new Structure();
|
||||
public Database databaseInfo = new Database();
|
||||
public Language language = new Language();
|
||||
public Account account = new Account();
|
||||
public Server server = new Server();
|
||||
// DO NOT. TOUCH. THE VERSION NUMBER.
|
||||
public int version = version();
|
||||
|
||||
private static int version() {
|
||||
return 4;
|
||||
}
|
||||
@@ -32,7 +40,8 @@ public class ConfigContainer {
|
||||
Grasscutter.getLogger().info("Updating legacy ..");
|
||||
Grasscutter.saveConfig(null);
|
||||
}
|
||||
} catch (Exception ignored) { }
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
var existing = config.version;
|
||||
var latest = version();
|
||||
@@ -50,7 +59,8 @@ public class ConfigContainer {
|
||||
} catch (Exception exception) {
|
||||
Grasscutter.getLogger().error("Failed to update a configuration field.", exception);
|
||||
}
|
||||
}); updated.version = version();
|
||||
});
|
||||
updated.version = version();
|
||||
|
||||
try { // Save configuration & reload.
|
||||
Grasscutter.saveConfig(updated);
|
||||
@@ -60,15 +70,6 @@ public class ConfigContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public Structure folderStructure = new Structure();
|
||||
public Database databaseInfo = new Database();
|
||||
public Language language = new Language();
|
||||
public Account account = new Account();
|
||||
public Server server = new Server();
|
||||
|
||||
// DO NOT. TOUCH. THE VERSION NUMBER.
|
||||
public int version = version();
|
||||
|
||||
/* Option containers. */
|
||||
|
||||
public static class Database {
|
||||
@@ -174,7 +175,7 @@ public class ConfigContainer {
|
||||
}
|
||||
|
||||
/* Debug options container, used when jar launch argument is -debug | -debugall and override default values
|
||||
* (see StartupArguments.enableDebug) */
|
||||
* (see StartupArguments.enableDebug) */
|
||||
public static class DebugMode {
|
||||
/* Log level of the main server code (works only with -debug arg) */
|
||||
public Level serverLoggerLevel = Level.DEBUG;
|
||||
@@ -260,16 +261,16 @@ public class ConfigContainer {
|
||||
public static class Mail {
|
||||
public String title = "Welcome to Grasscutter!";
|
||||
public String content = """
|
||||
Hi there!\r
|
||||
First of all, welcome to Grasscutter. If you have any issues, please let us know so that Lawnmower can help you! \r
|
||||
\r
|
||||
Check out our:\r
|
||||
<type="browser" text="Discord" href="https://discord.gg/T5vZU6UyeG"/>
|
||||
""";
|
||||
Hi there!\r
|
||||
First of all, welcome to Grasscutter. If you have any issues, please let us know so that Lawnmower can help you! \r
|
||||
\r
|
||||
Check out our:\r
|
||||
<type="browser" text="Discord" href="https://discord.gg/T5vZU6UyeG"/>
|
||||
""";
|
||||
public String sender = "Lawnmower";
|
||||
public emu.grasscutter.game.mail.Mail.MailItem[] items = {
|
||||
new emu.grasscutter.game.mail.Mail.MailItem(13509, 1, 1),
|
||||
new emu.grasscutter.game.mail.Mail.MailItem(201, 99999, 1)
|
||||
new emu.grasscutter.game.mail.Mail.MailItem(13509, 1, 1),
|
||||
new emu.grasscutter.game.mail.Mail.MailItem(201, 99999, 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -292,21 +293,20 @@ public class ConfigContainer {
|
||||
/* Objects. */
|
||||
|
||||
public static class Region {
|
||||
public Region() { }
|
||||
|
||||
public Region(
|
||||
String name, String title,
|
||||
String address, int port
|
||||
) {
|
||||
this.Name = name;
|
||||
this.Title = title;
|
||||
this.Ip = address;
|
||||
this.Port = port;
|
||||
}
|
||||
|
||||
public String Name = "os_usa";
|
||||
public String Title = "Grasscutter";
|
||||
public String Ip = "127.0.0.1";
|
||||
public int Port = 22102;
|
||||
public Region() {
|
||||
}
|
||||
public Region(
|
||||
String name, String title,
|
||||
String address, int port
|
||||
) {
|
||||
this.Name = name;
|
||||
this.Title = title;
|
||||
this.Ip = address;
|
||||
this.Port = port;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import static emu.grasscutter.Grasscutter.config;
|
||||
|
||||
/**
|
||||
* A data container for the server's configuration.
|
||||
*
|
||||
* <p>
|
||||
* Use `import static emu.grasscutter.Configuration.*;`
|
||||
* to import all configuration constants.
|
||||
*/
|
||||
@@ -26,26 +26,22 @@ public final class Configuration extends ConfigContainer {
|
||||
public static final Locale LANGUAGE = config.language.language;
|
||||
public static final Locale FALLBACK_LANGUAGE = config.language.fallback;
|
||||
public static final String DOCUMENT_LANGUAGE = config.language.document;
|
||||
private static final String DATA_FOLDER = config.folderStructure.data;
|
||||
private static final String PLUGINS_FOLDER = config.folderStructure.plugins;
|
||||
private static final String SCRIPTS_FOLDER = config.folderStructure.scripts;
|
||||
private static final String PACKETS_FOLDER = config.folderStructure.packets;
|
||||
|
||||
public static final Server SERVER = config.server;
|
||||
public static final Database DATABASE = config.databaseInfo;
|
||||
public static final Account ACCOUNT = config.account;
|
||||
|
||||
public static final HTTP HTTP_INFO = config.server.http;
|
||||
public static final Game GAME_INFO = config.server.game;
|
||||
public static final Dispatch DISPATCH_INFO = config.server.dispatch;
|
||||
public static final DebugMode DEBUG_MODE_INFO = config.server.debugMode;
|
||||
|
||||
public static final Encryption HTTP_ENCRYPTION = config.server.http.encryption;
|
||||
public static final Policies HTTP_POLICIES = config.server.http.policies;
|
||||
public static final Files HTTP_STATIC_FILES = config.server.http.files;
|
||||
|
||||
public static final GameOptions GAME_OPTIONS = config.server.game.gameOptions;
|
||||
public static final GameOptions.InventoryLimits INVENTORY_LIMITS = config.server.game.gameOptions.inventoryLimits;
|
||||
private static final String DATA_FOLDER = config.folderStructure.data;
|
||||
private static final String PLUGINS_FOLDER = config.folderStructure.plugins;
|
||||
private static final String SCRIPTS_FOLDER = config.folderStructure.scripts;
|
||||
private static final String PACKETS_FOLDER = config.folderStructure.packets;
|
||||
|
||||
/*
|
||||
* Utilities
|
||||
@@ -91,7 +87,8 @@ public final class Configuration extends ConfigContainer {
|
||||
|
||||
/**
|
||||
* Fallback method.
|
||||
* @param left Attempt to use.
|
||||
*
|
||||
* @param left Attempt to use.
|
||||
* @param right Use if left is undefined.
|
||||
* @return Left or right.
|
||||
*/
|
||||
@@ -101,7 +98,8 @@ public final class Configuration extends ConfigContainer {
|
||||
|
||||
/**
|
||||
* {@link Configuration#lr(Object, Object)} for {@link String}s.
|
||||
* @param left Attempt to use.
|
||||
*
|
||||
* @param left Attempt to use.
|
||||
* @param right Use if left is empty.
|
||||
* @return Left or right.
|
||||
*/
|
||||
@@ -111,7 +109,8 @@ public final class Configuration extends ConfigContainer {
|
||||
|
||||
/**
|
||||
* {@link Configuration#lr(Object, Object)} for {@link Integer}s.
|
||||
* @param left Attempt to use.
|
||||
*
|
||||
* @param left Attempt to use.
|
||||
* @param right Use if left is 0.
|
||||
* @return Left or right.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user