diff --git a/src/main/java/emu/grasscutter/DebugConstants.java b/src/main/java/emu/grasscutter/DebugConstants.java index 474db035f..1338fcbc7 100644 --- a/src/main/java/emu/grasscutter/DebugConstants.java +++ b/src/main/java/emu/grasscutter/DebugConstants.java @@ -1,12 +1,12 @@ package emu.grasscutter; public final class DebugConstants { - public static boolean LOG_ABILITIES = false; - public static boolean LOG_LUA_SCRIPTS = false; - public static boolean LOG_QUEST_START = false; - public static boolean LOG_MISSING_ABILITIES = false; - public static boolean LOG_MISSING_LUA_SCRIPTS = false; - public static boolean LOG_MISSING_ABILITY_HANDLERS = false; + public static final boolean LOG_ABILITIES = false; + public static final boolean LOG_LUA_SCRIPTS = false; + public static final boolean LOG_QUEST_START = false; + public static final boolean LOG_MISSING_ABILITIES = false; + public static final boolean LOG_MISSING_LUA_SCRIPTS = false; + public static final boolean LOG_MISSING_ABILITY_HANDLERS = false; /** * WARNING: THIS IS A DANGEROUS SETTING. DO NOT ENABLE UNLESS YOU KNOW WHAT YOU ARE DOING. This diff --git a/src/main/java/emu/grasscutter/GameConstants.java b/src/main/java/emu/grasscutter/GameConstants.java index 8923b3380..30a4ce31e 100644 --- a/src/main/java/emu/grasscutter/GameConstants.java +++ b/src/main/java/emu/grasscutter/GameConstants.java @@ -7,8 +7,8 @@ import emu.grasscutter.utils.objects.SparseSet; import java.util.Arrays; public final class GameConstants { - public static String VERSION = "4.0.0"; - public static int[] VERSION_PARTS = {4, 0, 0}; + public static final String VERSION = "4.0.0"; + public static final int[] VERSION_PARTS = {4, 0, 0}; public static boolean DEBUG = false; public static final int DEFAULT_TEAMS = 4; diff --git a/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java b/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java index 6cd5b0f14..992899c1e 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java @@ -291,9 +291,9 @@ public final class SetPropCommand implements CommandHandler { } static class Prop { - String name; - PlayerProperty prop; - PseudoProp pseudoProp; + final String name; + final PlayerProperty prop; + final PseudoProp pseudoProp; public Prop(PlayerProperty prop) { this(prop.toString(), prop, PseudoProp.NONE); diff --git a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java index f88239926..1cc63d35c 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java @@ -171,8 +171,8 @@ public final class SetStatsCommand implements CommandHandler { } private static class Stat { - String name; - FightProperty prop; + final String name; + final FightProperty prop; public Stat(FightProperty prop) { this.name = prop.toString(); diff --git a/src/main/java/emu/grasscutter/config/ConfigContainer.java b/src/main/java/emu/grasscutter/config/ConfigContainer.java index 2b6d20978..1cb60fe91 100644 --- a/src/main/java/emu/grasscutter/config/ConfigContainer.java +++ b/src/main/java/emu/grasscutter/config/ConfigContainer.java @@ -78,11 +78,11 @@ 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(); + public final Structure folderStructure = new Structure(); + public final Database databaseInfo = new Database(); + public final Language language = new Language(); + public final Account account = new Account(); + public final Server server = new Server(); // DO NOT. TOUCH. THE VERSION NUMBER. public int version = version(); @@ -90,99 +90,99 @@ public class ConfigContainer { /* Option containers. */ public static class Database { - public DataStore server = new DataStore(); - public DataStore game = new DataStore(); + public final DataStore server = new DataStore(); + public final DataStore game = new DataStore(); public static class DataStore { - public String connectionUri = "mongodb://localhost:27017"; - public String collection = "grasscutter"; + public final String connectionUri = "mongodb://localhost:27017"; + public final String collection = "grasscutter"; } } public static class Structure { - public String resources = "./resources/"; - public String data = "./data/"; - public String packets = "./packets/"; - public String scripts = "resources:Scripts/"; - public String plugins = "./plugins/"; - public String cache = "./cache/"; + public final String resources = "./resources/"; + public final String data = "./data/"; + public final String packets = "./packets/"; + public final String scripts = "resources:Scripts/"; + public final String plugins = "./plugins/"; + public final String cache = "./cache/"; // UNUSED (potentially added later?) // public String dumps = "./dumps/"; } public static class Server { - public Set debugWhitelist = Set.of(); - public Set debugBlacklist = Set.of(); - public ServerRunMode runMode = ServerRunMode.HYBRID; - public boolean logCommands = false; + public final Set debugWhitelist = Set.of(); + public final Set debugBlacklist = Set.of(); + public final ServerRunMode runMode = ServerRunMode.HYBRID; + public final boolean logCommands = false; /** * If enabled, the 'require' Lua function will load the script's compiled varient into the context. (faster; doesn't work as well) * If disabled, all 'require' calls will be replaced with the referenced script's source. (slower; works better) */ - public boolean fastRequire = true; + public final boolean fastRequire = true; - public HTTP http = new HTTP(); - public Game game = new Game(); + public final HTTP http = new HTTP(); + public final Game game = new Game(); - public Dispatch dispatch = new Dispatch(); - public DebugMode debugMode = new DebugMode(); + public final Dispatch dispatch = new Dispatch(); + public final DebugMode debugMode = new DebugMode(); } public static class Language { public Locale language = Locale.getDefault(); - public Locale fallback = Locale.US; - public String document = "EN"; + public final Locale fallback = Locale.US; + public final String document = "EN"; } public static class Account { - public boolean autoCreate = false; - public boolean EXPERIMENTAL_RealPassword = false; - public String[] defaultPermissions = {}; - public String playerEmail = "grasscutter.io"; - public int maxPlayer = -1; + public final boolean autoCreate = false; + public final boolean EXPERIMENTAL_RealPassword = false; + public final String[] defaultPermissions = {}; + public final String playerEmail = "grasscutter.io"; + public final int maxPlayer = -1; } /* Server options. */ public static class HTTP { /* This starts the HTTP server before the game server. */ - public boolean startImmediately = false; + public final boolean startImmediately = false; - public String bindAddress = "0.0.0.0"; - public int bindPort = 443; + public final String bindAddress = "0.0.0.0"; + public final int bindPort = 443; /* This is the address used in URLs. */ - public String accessAddress = "127.0.0.1"; + public final String accessAddress = "127.0.0.1"; /* This is the port used in URLs. */ - public int accessPort = 0; + public final int accessPort = 0; - public Encryption encryption = new Encryption(); - public Policies policies = new Policies(); - public Files files = new Files(); + public final Encryption encryption = new Encryption(); + public final Policies policies = new Policies(); + public final Files files = new Files(); } public static class Game { - public String bindAddress = "0.0.0.0"; - public int bindPort = 22102; + public final String bindAddress = "0.0.0.0"; + public final int bindPort = 22102; /* This is the address used in the default region. */ - public String accessAddress = "127.0.0.1"; + public final String accessAddress = "127.0.0.1"; /* This is the port used in the default region. */ - public int accessPort = 0; + public final int accessPort = 0; /* Enabling this will generate a unique packet encryption key for each player. */ - public boolean useUniquePacketKey = true; + public final boolean useUniquePacketKey = true; /* Entities within a certain range will be loaded for the player */ - public int loadEntitiesForPlayerRange = 300; + public final int loadEntitiesForPlayerRange = 300; /* Start in 'unstable-quests', Lua scripts will be enabled by default. */ - public boolean enableScriptInBigWorld = true; + public final boolean enableScriptInBigWorld = true; public boolean enableConsole = true; /* Kcp internal work interval (milliseconds) */ - public int kcpInterval = 20; + public final int kcpInterval = 20; /* Controls whether packets should be logged in console or not */ public ServerDebugMode logPackets = ServerDebugMode.NONE; /* Show packet payload in console or no (in any case the payload is shown in encrypted view) */ @@ -190,13 +190,13 @@ public class ConfigContainer { /* Show annoying loop packets or no */ public boolean isShowLoopPackets = false; - public boolean cacheSceneEntitiesEveryRun = false; + public final boolean cacheSceneEntitiesEveryRun = false; - public GameOptions gameOptions = new GameOptions(); - public JoinOptions joinOptions = new JoinOptions(); - public ConsoleAccount serverAccount = new ConsoleAccount(); + public final GameOptions gameOptions = new GameOptions(); + public final JoinOptions joinOptions = new JoinOptions(); + public final ConsoleAccount serverAccount = new ConsoleAccount(); - public VisionOptions[] visionOptions = new VisionOptions[] { + public final VisionOptions[] visionOptions = new VisionOptions[] { new VisionOptions("VISION_LEVEL_NORMAL" , 80 , 20), new VisionOptions("VISION_LEVEL_LITTLE_REMOTE" , 16 , 40), new VisionOptions("VISION_LEVEL_REMOTE" , 1000 , 250), @@ -210,17 +210,17 @@ public class ConfigContainer { public static class Dispatch { /* An array of servers. */ - public List regions = List.of(); + public final List regions = List.of(); /* The URL used to make HTTP requests to the dispatch server. */ - public String dispatchUrl = "ws://127.0.0.1:1111"; + public final String dispatchUrl = "ws://127.0.0.1:1111"; /* A unique key used for encryption. */ - public byte[] encryptionKey = Crypto.createSessionKey(32); + public final byte[] encryptionKey = Crypto.createSessionKey(32); /* A unique key used for authentication. */ - public String dispatchKey = Utils.base64Encode( + public final String dispatchKey = Utils.base64Encode( Crypto.createSessionKey(32)); - public String defaultName = "Grasscutter"; + public final String defaultName = "Grasscutter"; /* Controls whether http requests should be logged in console or not */ public ServerDebugMode logRequests = ServerDebugMode.NONE; @@ -230,127 +230,127 @@ public class ConfigContainer { * (see StartupArguments.enableDebug) */ public static class DebugMode { /* Log level of the main server code (works only with -debug arg) */ - public Level serverLoggerLevel = Level.DEBUG; + public final Level serverLoggerLevel = Level.DEBUG; /* Log level of the third-party services (works only with -debug arg): javalin, quartz, reflections, jetty, mongodb.driver */ - public Level servicesLoggersLevel = Level.INFO; + public final Level servicesLoggersLevel = Level.INFO; /* Controls whether packets should be logged in console or not */ - public ServerDebugMode logPackets = ServerDebugMode.ALL; + public final ServerDebugMode logPackets = ServerDebugMode.ALL; /* Show packet payload in console or no (in any case the payload is shown in encrypted view) */ - public boolean isShowPacketPayload = false; + public final boolean isShowPacketPayload = false; /* Show annoying loop packets or no */ - public boolean isShowLoopPackets = false; + public final boolean isShowLoopPackets = false; /* Controls whether http requests should be logged in console or not */ - public ServerDebugMode logRequests = ServerDebugMode.ALL; + public final ServerDebugMode logRequests = ServerDebugMode.ALL; } public static class Encryption { public boolean useEncryption = true; /* Should 'https' be appended to URLs? */ public boolean useInRouting = true; - public String keystore = "./keystore.p12"; - public String keystorePassword = "123456"; + public final String keystore = "./keystore.p12"; + public final String keystorePassword = "123456"; } public static class Policies { - public Policies.CORS cors = new Policies.CORS(); + public final Policies.CORS cors = new Policies.CORS(); public static class CORS { - public boolean enabled = true; - public String[] allowedOrigins = new String[]{"*"}; + public final boolean enabled = true; + public final String[] allowedOrigins = new String[]{"*"}; } } public static class GameOptions { - public InventoryLimits inventoryLimits = new InventoryLimits(); - public AvatarLimits avatarLimits = new AvatarLimits(); - public int sceneEntityLimit = 1000; // Unenforced. TODO: Implement. + public final InventoryLimits inventoryLimits = new InventoryLimits(); + public final AvatarLimits avatarLimits = new AvatarLimits(); + public final int sceneEntityLimit = 1000; // Unenforced. TODO: Implement. - public boolean watchGachaConfig = false; - public boolean enableShopItems = true; - public boolean staminaUsage = true; - public boolean energyUsage = true; - public boolean fishhookTeleport = true; - public boolean trialCostumes = false; + public final boolean watchGachaConfig = false; + public final boolean enableShopItems = true; + public final boolean staminaUsage = true; + public final boolean energyUsage = true; + public final boolean fishhookTeleport = true; + public final boolean trialCostumes = false; @SerializedName(value = "questing", alternate = "questOptions") - public Questing questing = new Questing(); - public ResinOptions resinOptions = new ResinOptions(); - public Rates rates = new Rates(); + public final Questing questing = new Questing(); + public final ResinOptions resinOptions = new ResinOptions(); + public final Rates rates = new Rates(); - public HandbookOptions handbook = new HandbookOptions(); + public final HandbookOptions handbook = new HandbookOptions(); public static class InventoryLimits { - public int weapons = 2000; - public int relics = 2000; - public int materials = 2000; - public int furniture = 2000; - public int all = 30000; + public final int weapons = 2000; + public final int relics = 2000; + public final int materials = 2000; + public final int furniture = 2000; + public final int all = 30000; } public static class AvatarLimits { - public int singlePlayerTeam = 4; - public int multiplayerTeam = 4; + public final int singlePlayerTeam = 4; + public final int multiplayerTeam = 4; } public static class Rates { - public float adventureExp = 1.0f; + public final float adventureExp = 1.0f; public float mora = 1.0f; public float leyLines = 1.0f; } public static class ResinOptions { - public boolean resinUsage = false; - public int cap = 160; - public int rechargeTime = 480; + public final boolean resinUsage = false; + public final int cap = 160; + public final int rechargeTime = 480; } public static class Questing { /* Should questing behavior be used? */ - public boolean enabled = true; + public final boolean enabled = true; } public static class HandbookOptions { - public boolean enable = false; - public boolean allowCommands = true; + public final boolean enable = false; + public final boolean allowCommands = true; - public Limits limits = new Limits(); - public Server server = new Server(); + public final Limits limits = new Limits(); + public final Server server = new Server(); public static class Limits { /* Are rate limits checked? */ - public boolean enabled = false; + public final boolean enabled = false; /* The time for limits to expire. */ - public int interval = 3; + public final int interval = 3; /* The maximum amount of normal requests. */ - public int maxRequests = 10; + public final int maxRequests = 10; /* The maximum amount of entities to be spawned in one request. */ - public int maxEntities = 25; + public final int maxEntities = 25; } public static class Server { /* Are the server settings sent to the handbook? */ - public boolean enforced = false; + public final boolean enforced = false; /* The default server address for the handbook's authentication. */ - public String address = "127.0.0.1"; + public final String address = "127.0.0.1"; /* The default server port for the handbook's authentication. */ - public int port = 443; + public final int port = 443; /* Should the defaults be enforced? */ - public boolean canChange = true; + public final boolean canChange = true; } } } public static class VisionOptions { - public String name; - public int visionRange; - public int gridWidth; + public final String name; + public final int visionRange; + public final int gridWidth; public VisionOptions(String name, int visionRange, int gridWidth) { this.name = name; @@ -360,21 +360,21 @@ public class ConfigContainer { } public static class JoinOptions { - public int[] welcomeEmotes = {2007, 1002, 4010}; - public String welcomeMessage = "Welcome to a Grasscutter server."; - public JoinOptions.Mail welcomeMail = new JoinOptions.Mail(); + public final int[] welcomeEmotes = {2007, 1002, 4010}; + public final String welcomeMessage = "Welcome to a Grasscutter server."; + public final JoinOptions.Mail welcomeMail = new JoinOptions.Mail(); public static class Mail { - public String title = "Welcome to Grasscutter!"; - public String content = """ + public final String title = "Welcome to Grasscutter!"; + public final 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 """; - public String sender = "Lawnmower"; - public emu.grasscutter.game.mail.Mail.MailItem[] items = { + public final String sender = "Lawnmower"; + public final 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) }; @@ -382,18 +382,18 @@ public class ConfigContainer { } public static class ConsoleAccount { - public int avatarId = 10000007; - public int nameCardId = 210001; - public int adventureRank = 1; - public int worldLevel = 0; + public final int avatarId = 10000007; + public final int nameCardId = 210001; + public final int adventureRank = 1; + public final int worldLevel = 0; - public String nickName = "Server"; - public String signature = "Welcome to Grasscutter!"; + public final String nickName = "Server"; + public final String signature = "Welcome to Grasscutter!"; } public static class Files { - public String indexFile = "./index.html"; - public String errorFile = "./404.html"; + public final String indexFile = "./index.html"; + public final String errorFile = "./404.html"; } /* Objects. */ diff --git a/src/main/java/emu/grasscutter/data/binout/AbilityModifierEntry.java b/src/main/java/emu/grasscutter/data/binout/AbilityModifierEntry.java index 9b519ab9c..9087b94cc 100644 --- a/src/main/java/emu/grasscutter/data/binout/AbilityModifierEntry.java +++ b/src/main/java/emu/grasscutter/data/binout/AbilityModifierEntry.java @@ -4,9 +4,9 @@ import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import java.util.*; public class AbilityModifierEntry { - public List onModifierAdded; - public List onThinkInterval; - public List onRemoved; + public final List onModifierAdded; + public final List onThinkInterval; + public final List onRemoved; private final String name; // Custom value public AbilityModifierEntry(String name) { diff --git a/src/main/java/emu/grasscutter/data/common/DynamicFloat.java b/src/main/java/emu/grasscutter/data/common/DynamicFloat.java index 99dc12433..5a035f632 100644 --- a/src/main/java/emu/grasscutter/data/common/DynamicFloat.java +++ b/src/main/java/emu/grasscutter/data/common/DynamicFloat.java @@ -92,7 +92,7 @@ public class DynamicFloat { } public static class StackOp { - public Op op; + public final Op op; public float fValue; public String sValue; diff --git a/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TowerResult.java b/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TowerResult.java index b42e041ec..1c87e908f 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TowerResult.java +++ b/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TowerResult.java @@ -9,11 +9,11 @@ import emu.grasscutter.net.proto.TowerLevelEndNotifyOuterClass.TowerLevelEndNoti import emu.grasscutter.net.proto.TowerLevelEndNotifyOuterClass.TowerLevelEndNotify.ContinueStateType; public class TowerResult extends BaseDungeonResult { - WorldChallenge challenge; - boolean canJump; - boolean hasNextLevel; - int nextFloorId; - int currentStars; + final WorldChallenge challenge; + final boolean canJump; + final boolean hasNextLevel; + final int nextFloorId; + final int currentStars; public TowerResult( DungeonData dungeonData, diff --git a/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TrialAvatarDungeonResult.java b/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TrialAvatarDungeonResult.java index dd20fec49..c344d4d90 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TrialAvatarDungeonResult.java +++ b/src/main/java/emu/grasscutter/game/dungeons/dungeon_results/TrialAvatarDungeonResult.java @@ -6,7 +6,7 @@ import emu.grasscutter.net.proto.DungeonSettleNotifyOuterClass; import emu.grasscutter.net.proto.TrialAvatarFirstPassDungeonNotifyOuterClass.TrialAvatarFirstPassDungeonNotify; public class TrialAvatarDungeonResult extends BaseDungeonResult { - int trialCharacterIndexId; + final int trialCharacterIndexId; public TrialAvatarDungeonResult( DungeonData dungeonData, DungeonEndStats dungeonStats, int trialCharacterIndexId) { diff --git a/src/main/java/emu/grasscutter/game/mail/Mail.java b/src/main/java/emu/grasscutter/game/mail/Mail.java index 89161b950..9f9404091 100644 --- a/src/main/java/emu/grasscutter/game/mail/Mail.java +++ b/src/main/java/emu/grasscutter/game/mail/Mail.java @@ -17,14 +17,14 @@ import org.bson.types.ObjectId; public final class Mail { @Id private ObjectId id; @Indexed private int ownerUid; - public MailContent mailContent; - public List itemList; - public long sendTime; + public final MailContent mailContent; + public final List itemList; + public final long sendTime; public long expireTime; public int importance; public boolean isRead; public boolean isAttachmentGot; - public int stateValue; + public final int stateValue; @Transient private boolean shouldDelete; public Mail() { @@ -122,9 +122,9 @@ public final class Mail { @Entity public static class MailItem { - public int itemId; - public int itemCount; - public int itemLevel; + public final int itemId; + public final int itemCount; + public final int itemLevel; public MailItem() { this.itemId = 11101; diff --git a/src/main/java/emu/grasscutter/game/props/ItemUseAction/UseItemParams.java b/src/main/java/emu/grasscutter/game/props/ItemUseAction/UseItemParams.java index d5f946735..da319d3a9 100644 --- a/src/main/java/emu/grasscutter/game/props/ItemUseAction/UseItemParams.java +++ b/src/main/java/emu/grasscutter/game/props/ItemUseAction/UseItemParams.java @@ -6,8 +6,8 @@ import emu.grasscutter.game.props.ItemUseTarget; public class UseItemParams { // Don't want to change 40 method signatures when this gets extended! - public Player player; - public ItemUseTarget itemUseTarget; + public final Player player; + public final ItemUseTarget itemUseTarget; public Avatar targetAvatar = null; public int count = 1; public int optionId = 0; diff --git a/src/main/java/emu/grasscutter/net/packet/BasePacket.java b/src/main/java/emu/grasscutter/net/packet/BasePacket.java index bc65ae184..da9a9436b 100644 --- a/src/main/java/emu/grasscutter/net/packet/BasePacket.java +++ b/src/main/java/emu/grasscutter/net/packet/BasePacket.java @@ -7,7 +7,7 @@ import java.io.*; public class BasePacket { private static final int const1 = 17767; // 0x4567 private static final int const2 = -30293; // 0x89ab - public boolean shouldEncrypt = true; + public final boolean shouldEncrypt = true; private int opcode; private boolean shouldBuildHeader = false; private byte[] header; diff --git a/src/main/java/emu/grasscutter/plugin/PluginManager.java b/src/main/java/emu/grasscutter/plugin/PluginManager.java index 8ca612061..b085735c8 100644 --- a/src/main/java/emu/grasscutter/plugin/PluginManager.java +++ b/src/main/java/emu/grasscutter/plugin/PluginManager.java @@ -20,7 +20,7 @@ public final class PluginManager { * A 'breaking change' is something which changes the existing logic of the API. */ @SuppressWarnings("FieldCanBeLocal") - public static int API_VERSION = 2; + public static final int API_VERSION = 2; /* All loaded plugins. */ private final Map plugins = new LinkedHashMap<>(); diff --git a/src/main/java/emu/grasscutter/server/http/objects/ComboTokenResJson.java b/src/main/java/emu/grasscutter/server/http/objects/ComboTokenResJson.java index c229a1e19..279f1ab37 100644 --- a/src/main/java/emu/grasscutter/server/http/objects/ComboTokenResJson.java +++ b/src/main/java/emu/grasscutter/server/http/objects/ComboTokenResJson.java @@ -3,7 +3,7 @@ package emu.grasscutter.server.http.objects; public class ComboTokenResJson { public String message; public int retcode; - public LoginData data = new LoginData(); + public final LoginData data = new LoginData(); public static class LoginData { public int account_type = 1; diff --git a/src/main/java/emu/grasscutter/server/http/objects/LoginResultJson.java b/src/main/java/emu/grasscutter/server/http/objects/LoginResultJson.java index 0557c9c05..87d63dafb 100644 --- a/src/main/java/emu/grasscutter/server/http/objects/LoginResultJson.java +++ b/src/main/java/emu/grasscutter/server/http/objects/LoginResultJson.java @@ -3,10 +3,10 @@ package emu.grasscutter.server.http.objects; public class LoginResultJson { public String message; public int retcode; - public VerifyData data = new VerifyData(); + public final VerifyData data = new VerifyData(); public static class VerifyData { - public VerifyAccountData account = new VerifyAccountData(); + public final VerifyAccountData account = new VerifyAccountData(); public boolean device_grant_required = false; public String realname_operation = "NONE"; public boolean realperson_required = false; diff --git a/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java b/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java index 57f574f1b..d9ac86513 100644 --- a/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java +++ b/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java @@ -14,7 +14,7 @@ import org.quartz.*; triggerName = "AnnouncementTrigger") public final class AnnouncementTask extends TaskHandler { - static Map intervalMap = new ConcurrentHashMap<>(); + static final Map intervalMap = new ConcurrentHashMap<>(); @Override public void onEnable() { diff --git a/src/main/java/emu/grasscutter/utils/Crypto.java b/src/main/java/emu/grasscutter/utils/Crypto.java index 597aa4c40..01b515b7b 100644 --- a/src/main/java/emu/grasscutter/utils/Crypto.java +++ b/src/main/java/emu/grasscutter/utils/Crypto.java @@ -19,12 +19,12 @@ public final class Crypto { public static byte[] DISPATCH_SEED; public static byte[] ENCRYPT_KEY; - public static long ENCRYPT_SEED = Long.parseUnsignedLong("11468049314633205968"); + public static final long ENCRYPT_SEED = Long.parseUnsignedLong("11468049314633205968"); public static byte[] ENCRYPT_SEED_BUFFER = new byte[0]; public static PrivateKey CUR_SIGNING_KEY; - public static Map EncryptionKeys = new HashMap<>(); + public static final Map EncryptionKeys = new HashMap<>(); public static void loadKeys() { DISPATCH_KEY = FileUtils.readResource("/keys/dispatchKey.bin"); diff --git a/src/main/java/emu/grasscutter/utils/algorithms/KahnsSort.java b/src/main/java/emu/grasscutter/utils/algorithms/KahnsSort.java index 38dee3c59..1127ef9a4 100644 --- a/src/main/java/emu/grasscutter/utils/algorithms/KahnsSort.java +++ b/src/main/java/emu/grasscutter/utils/algorithms/KahnsSort.java @@ -4,7 +4,8 @@ import java.util.*; public class KahnsSort { public static class Node { - int source, dest; // Dest is a value, and source too + final int source; + final int dest; // Dest is a value, and source too public Node(int source, int dest) { this.source = source; @@ -13,10 +14,10 @@ public class KahnsSort { } public static class Graph { - Map> mainList; - Map degreeList; + final Map> mainList; + final Map degreeList; - List nodeList; + final List nodeList; public Graph(List nodes, List nodeList) { mainList = new HashMap<>();