From 2ac1d02d25d831e869f06d2ff3cab2fdfa9b6bf8 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sat, 11 May 2024 20:12:41 +0800 Subject: [PATCH] fix: remove "final" in config class --- .../java/org/allaymc/api/server/BanInfo.java | 4 +- .../allaymc/api/server/ServerSettings.java | 66 +++++++++---------- .../org/allaymc/api/server/Whitelist.java | 2 +- .../org/allaymc/api/world/WorldSettings.java | 3 +- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Allay-API/src/main/java/org/allaymc/api/server/BanInfo.java b/Allay-API/src/main/java/org/allaymc/api/server/BanInfo.java index 86fe460c6..9afec04a7 100644 --- a/Allay-API/src/main/java/org/allaymc/api/server/BanInfo.java +++ b/Allay-API/src/main/java/org/allaymc/api/server/BanInfo.java @@ -19,9 +19,9 @@ public class BanInfo extends OkaeriConfig { @CustomKey("banned-players") @Comment("Banned player list. The value can be player's name or uuid") - private final Set bannedPlayers = Sets.newConcurrentHashSet(); + private Set bannedPlayers = Sets.newConcurrentHashSet(); @CustomKey("banned-ips") @Comment("Banned ip list") - private final Set bannedIps = Sets.newConcurrentHashSet(); + private Set bannedIps = Sets.newConcurrentHashSet(); } diff --git a/Allay-API/src/main/java/org/allaymc/api/server/ServerSettings.java b/Allay-API/src/main/java/org/allaymc/api/server/ServerSettings.java index e9d8f405c..29f4fc5d3 100644 --- a/Allay-API/src/main/java/org/allaymc/api/server/ServerSettings.java +++ b/Allay-API/src/main/java/org/allaymc/api/server/ServerSettings.java @@ -19,17 +19,17 @@ public class ServerSettings extends OkaeriConfig { @CustomKey("generic-settings") - private final GenericSettings genericSettings = new GenericSettings(); + private GenericSettings genericSettings = new GenericSettings(); @CustomKey("network-settings") - private final NetworkSettings networkSettings = new NetworkSettings(); + private NetworkSettings networkSettings = new NetworkSettings(); @CustomKey("world-settings") - private final WorldConfig worldSettings = new WorldConfig(); + private WorldConfig worldSettings = new WorldConfig(); @CustomKey("entity-settings") - private final EntitySettings entitySettings = new EntitySettings(); + private EntitySettings entitySettings = new EntitySettings(); @CustomKey("storage-settings") - private final StorageSettings storageSettings = new StorageSettings(); + private StorageSettings storageSettings = new StorageSettings(); @CustomKey("resource-pack-settings") - private final ResourcePackSettings resourcePackSettings = new ResourcePackSettings(); + private ResourcePackSettings resourcePackSettings = new ResourcePackSettings(); @Getter @Setter @@ -68,28 +68,28 @@ public static class GenericSettings extends OkaeriConfig { @Accessors(fluent = true) public static class NetworkSettings extends OkaeriConfig { - private final String ip = "127.0.0.1"; + private String ip = "127.0.0.1"; - private final int port = 19132; + private int port = 19132; @CustomKey("xbox-auth") - private final boolean xboxAuth = true; + private boolean xboxAuth = true; @Comment("Turning this on is highly recommended for security reasons") @CustomKey("enable-network-encryption") - private final boolean enableNetworkEncryption = true; + private boolean enableNetworkEncryption = true; @Comment("Possible values: ZLIB, SNAPPY") @CustomKey("compression-algorithm") - private final PacketCompressionAlgorithm compressionAlgorithm = PacketCompressionAlgorithm.ZLIB; + private PacketCompressionAlgorithm compressionAlgorithm = PacketCompressionAlgorithm.ZLIB; @CustomKey("network-thread-number") @Comment("0 == the server will automatically determine the number of netty threads") - private final int networkThreadNumber = 0; + private int networkThreadNumber = 0; @CustomKey("max-synced-packets-handle-count-once") @Comment("The maximum number of packets that can be processed at once") - private final int maxSyncedPacketsHandleCountAtOnce = 128; + private int maxSyncedPacketsHandleCountAtOnce = 128; } @Getter @@ -97,29 +97,29 @@ public static class NetworkSettings extends OkaeriConfig { public static class WorldConfig extends OkaeriConfig { @CustomKey("ticking-radius") - private final int tickingRadius = 8; + private int tickingRadius = 8; @CustomKey("view-distance") - private final int viewDistance = 16; + private int viewDistance = 16; @CustomKey("chunk-try-send-count-per-tick") - private final int chunkTrySendCountPerTick = 16; + private int chunkTrySendCountPerTick = 16; @CustomKey("use-sub-chunk-sending-system") - private final boolean useSubChunkSendingSystem = false; + private boolean useSubChunkSendingSystem = false; @Comment("Possible values: ASYNC, SYNC") @Comment("This only works if sub-chunk sending system is not enabled") @Comment("And will be forced to SYNC if sub-chunk sending system is enabled") @CustomKey("chunk-sending-strategy") - private final ChunkSendingStrategy chunkSendingStrategy = ChunkSendingStrategy.ASYNC; + private ChunkSendingStrategy chunkSendingStrategy = ChunkSendingStrategy.ASYNC; @CustomKey("do-first-spawn-chunk-threshold") - private final int doFirstSpawnChunkThreshold = 56; + private int doFirstSpawnChunkThreshold = 56; @Comment("Determines how long a chunk without chunk loaders will remain loaded (gt)") @CustomKey("remove-unneeded-chunk-cycle") - private final int removeUnneededChunkCycle = 1200; + private int removeUnneededChunkCycle = 1200; public enum ChunkSendingStrategy { ASYNC, @@ -134,7 +134,7 @@ public static class EntitySettings extends OkaeriConfig { @Comment("Entity physics engine settings") @Comment("Do not change them if you don't know what you are doing!") @CustomKey("physics-engine-settings") - private final PhysicsEngineSettings physicsEngineSettings = new PhysicsEngineSettings(); + private PhysicsEngineSettings physicsEngineSettings = new PhysicsEngineSettings(); @Getter @Accessors(fluent = true) @@ -143,30 +143,30 @@ public static class PhysicsEngineSettings extends OkaeriConfig { @Comment("This threshold acts on each axis individually") @Comment("Increasing this threshold will reduce bandwidth pressure, but may result in untimely motion updates") @CustomKey("diff-position-threshold") - private final float diffPositionThreshold = 0.0001f; + private float diffPositionThreshold = 0.0001f; @Comment("Similar to \"diffPositionThreshold\"") @CustomKey("diff-rotation-threshold") - private final float diffRotationThreshold = 0.1f; + private float diffRotationThreshold = 0.1f; @Comment("When the motion falls below this value, its motion is zeroed") @CustomKey("motion-threshold") - private final float motionThreshold = 0.003f; + private float motionThreshold = 0.003f; @Comment("Walk assist offset") @CustomKey("stepping-offset") - private final float steppingOffset = 0.05f; + private float steppingOffset = 0.05f; @Comment("This usually determines how quickly an entity item is moved when getting stuck in a block") @CustomKey("block-collision-motion") - private final float blockCollisionMotion = 0.2f; + private float blockCollisionMotion = 0.2f; @CustomKey("fat-aabb-margin") - private final float fatAABBMargin = 0.0005f; + private float fatAABBMargin = 0.0005f; @Comment("Delta move packet will reduce the network pressure if there are a lot of entities") @CustomKey("use-delta-move-packet") - private final boolean useDeltaMovePacket = false; + private boolean useDeltaMovePacket = false; } } @@ -175,11 +175,11 @@ public static class PhysicsEngineSettings extends OkaeriConfig { public static class StorageSettings extends OkaeriConfig { @CustomKey("save-player-data") @Comment("If set to false, the player's data will not be saved") - private final boolean savePlayerData = true; + private boolean savePlayerData = true; @CustomKey("save-player-data-cycle") @Comment("Determines the cycle of player data auto saving") - private final int playerDataAutoSaveCycle = 20 * 60; + private int playerDataAutoSaveCycle = 20 * 60; } @Getter @@ -188,18 +188,18 @@ public static class ResourcePackSettings extends OkaeriConfig { @CustomKey("auto-encrypt") @Comment("If set to true, packs will be automatically encrypted") - private final boolean autoEncrypt = true; + private boolean autoEncrypt = true; @CustomKey("max-chunk-size") @Comment("The maximum size of a resource pack chunk (unit: KB)") @Comment("Decrease this value may reduce the pressure on the network when sending packs to multiple clients") @Comment("However, it may also increase the time it takes to send the packs") - private final int maxChunkSize = 100; // 100KB, from BDS + private int maxChunkSize = 100; // 100KB, from BDS @Comment("true - the player must accept resource packs, otherwise he will not log in to the server") @Comment("false - the player can log in to the server without accepting resource packs") @CustomKey("force-resource-packs") - private final boolean forceResourcePacks = false; + private boolean forceResourcePacks = false; // TODO: URL packs configuration } diff --git a/Allay-API/src/main/java/org/allaymc/api/server/Whitelist.java b/Allay-API/src/main/java/org/allaymc/api/server/Whitelist.java index cef9bbb07..f08115fc2 100644 --- a/Allay-API/src/main/java/org/allaymc/api/server/Whitelist.java +++ b/Allay-API/src/main/java/org/allaymc/api/server/Whitelist.java @@ -17,5 +17,5 @@ @Accessors(fluent = true) public class Whitelist extends OkaeriConfig { @Comment("Whitelisted player list. The value can be player's name or uuid") - private final Set whitelist = Sets.newConcurrentHashSet(); + private Set whitelist = Sets.newConcurrentHashSet(); } diff --git a/Allay-API/src/main/java/org/allaymc/api/world/WorldSettings.java b/Allay-API/src/main/java/org/allaymc/api/world/WorldSettings.java index 540b73368..793b0277c 100644 --- a/Allay-API/src/main/java/org/allaymc/api/world/WorldSettings.java +++ b/Allay-API/src/main/java/org/allaymc/api/world/WorldSettings.java @@ -28,7 +28,8 @@ public class WorldSettings extends OkaeriConfig { .overworld(new WorldEntry.DimensionSettings("FLAT", "")) .build(); - private final Map worlds = Map.of(DEFAULT_WORLD_NAME, DEFAULT); + @CustomKey("worlds") + private Map worlds = Map.of(DEFAULT_WORLD_NAME, DEFAULT); @CustomKey("default-world") @Setter