From 56e430dff2def2029b4d2b09c69511c5cb972887 Mon Sep 17 00:00:00 2001 From: s809 <43530948+s809@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:42:57 +0500 Subject: [PATCH] Rename serversideShortName to chatCommandName --- .../distanthorizons/core/config/Config.java | 38 +++++++++---------- .../core/config/types/ConfigEntry.java | 16 ++++---- .../multiplayer/config/SessionConfig.java | 6 +-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index 0b07f12f5..fa358061e 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -87,7 +87,7 @@ public class Config .build(); public static ConfigEntry threadPresetSetting = new ConfigEntry.Builder() - .setServersideShortName("common.threadPreset") + .setChatCommandName("common.threadPreset") .set(EDhApiThreadPreset.BALANCED) // the default value is set via the listener when accessed .comment("" + "Changing this setting will modify a number of different settings that will change \n" @@ -1188,7 +1188,7 @@ public class Config public static class WorldGenerator { public static ConfigEntry enableDistantGeneration = new ConfigEntry.Builder() - .setServersideShortName("generation.enable") + .setChatCommandName("generation.enable") .set(true) .comment("" + " Should Distant Horizons slowly generate LODs \n" @@ -1196,7 +1196,7 @@ public class Config .build(); public static ConfigEntry distantGeneratorMode = new ConfigEntry.Builder() - .setServersideShortName("generation.mode") + .setChatCommandName("generation.mode") .set(EDhApiDistantGeneratorMode.FEATURES) .comment("" + "How detailed should LODs be generated outside the vanilla render distance? \n" @@ -1348,7 +1348,7 @@ public class Config public static class MultiThreading { public static final ConfigEntry numberOfThreads = new ConfigEntry.Builder() - .setServersideShortName("threading.numberOfThreads") + .setChatCommandName("threading.numberOfThreads") .setMinDefaultMax(1, ThreadPresetConfigEventHandler.getDefaultThreadCount(), Runtime.getRuntime().availableProcessors()) @@ -1357,7 +1357,7 @@ public class Config + "") .build(); public static final ConfigEntry threadRunTimeRatio = new ConfigEntry.Builder() - .setServersideShortName("threading.threadRunTimeRatio") + .setChatCommandName("threading.threadRunTimeRatio") .setMinDefaultMax(0.01, ThreadPresetConfigEventHandler.getDefaultRunTimeRatio(), 1.0) .comment("" + "A value between 1.0 and 0.0 that represents the percentage \n" @@ -1378,7 +1378,7 @@ public class Config // TODO add change all option // TODO default to error chat and info file public static ConfigEntry logWorldGenEvent = new ConfigEntry.Builder() - .setServersideShortName("logging.logWorldGenEvent") + .setChatCommandName("logging.logWorldGenEvent") .set(EDhApiLoggerMode.LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE) .comment("" + "If enabled, the mod will log information about the world generation process. \n" @@ -1386,7 +1386,7 @@ public class Config .build(); public static ConfigEntry logWorldGenPerformance = new ConfigEntry.Builder() - .setServersideShortName("logging.logWorldGenPerformance") + .setChatCommandName("logging.logWorldGenPerformance") .set(EDhApiLoggerMode.LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE) .comment("" + "If enabled, the mod will log performance about the world generation process. \n" @@ -1394,7 +1394,7 @@ public class Config .build(); public static ConfigEntry logWorldGenLoadEvent = new ConfigEntry.Builder() - .setServersideShortName("logging.logWorldGenPerformance") + .setChatCommandName("logging.logWorldGenPerformance") .set(EDhApiLoggerMode.LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE) .comment("" + "If enabled, the mod will log information about the world generation process. \n" @@ -1416,7 +1416,7 @@ public class Config .build(); public static ConfigEntry logNetworkEvent = new ConfigEntry.Builder() - .setServersideShortName("logging.logNetworkEvent") + .setChatCommandName("logging.logNetworkEvent") .set(EDhApiLoggerMode.LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE) .comment("" + "If enabled, the mod will log information about network operations. \n" @@ -1471,7 +1471,7 @@ public class Config { // Level keys public static ConfigEntry sendLevelKeys = new ConfigEntry.Builder() - .setServersideShortName("levelKeys.send") + .setChatCommandName("levelKeys.send") .setAppearance(EConfigEntryAppearance.ONLY_IN_FILE) .set(true) .comment("" @@ -1481,7 +1481,7 @@ public class Config .build(); public static ConfigEntry levelKeyPrefix = new ConfigEntry.Builder() - .setServersideShortName("levelKeys.prefix") + .setChatCommandName("levelKeys.prefix") .set("") .comment("" + "Prefix of the level keys sent to the clients.\n" @@ -1493,7 +1493,7 @@ public class Config // Generation public static ConfigEntry generationRequestRateLimit = new ConfigEntry.Builder() - .setServersideShortName("generation.requestRateLimit") + .setChatCommandName("generation.requestRateLimit") .setMinDefaultMax(1, 20, 100) .comment("" + "How many LOD generation requests per second should a client send? \n" @@ -1502,7 +1502,7 @@ public class Config .build(); public static ConfigEntry maxGenerationRequestDistance = new ConfigEntry.Builder() - .setServersideShortName("generation.maxRequestDistance") + .setChatCommandName("generation.maxRequestDistance") .setMinDefaultMax(256, 4096, 4096) .comment("" + "Defines the distance allowed to generate around the player." + @@ -1513,7 +1513,7 @@ public class Config // Real-time updates public static ConfigEntry enableRealTimeUpdates = new ConfigEntry.Builder() - .setServersideShortName("realTimeUpdates.enable") + .setChatCommandName("realTimeUpdates.enable") .set(true) .comment("" + "If true, clients will receive real-time LOD updates for chunks outside the client's render distance." @@ -1521,7 +1521,7 @@ public class Config .build(); public static ConfigEntry realTimeUpdateDistanceRadiusInChunks = new ConfigEntry.Builder() - .setServersideShortName("realTimeUpdates.playerDistance") + .setChatCommandName("realTimeUpdates.playerDistance") .setMinDefaultMax(32, 256, 4096) .comment("" + "Defines the distance the player will receive updates around." + @@ -1532,7 +1532,7 @@ public class Config // Sync on load public static ConfigEntry synchronizeOnLoad = new ConfigEntry.Builder() - .setServersideShortName("syncOnLoad.enable") + .setChatCommandName("syncOnLoad.enable") .set(true) .comment("" + "If true, clients will receive updated LODs when joining or loading new LODs. \n" @@ -1540,7 +1540,7 @@ public class Config .build(); public static ConfigEntry syncOnLoadRateLimit = new ConfigEntry.Builder() - .setServersideShortName("syncOnLoad.rateLimit") + .setChatCommandName("syncOnLoad.rateLimit") .setMinDefaultMax(1, 50, 100) .comment("" + "How many LOD sync requests per second should a client send? \n" @@ -1549,7 +1549,7 @@ public class Config .build(); public static ConfigEntry maxSyncOnLoadRequestDistance = new ConfigEntry.Builder() - .setServersideShortName("syncOnLoad.maxRequestDistance") + .setChatCommandName("syncOnLoad.maxRequestDistance") .setMinDefaultMax(256, 4096, 4096) .comment("" + "Defines the distance allowed to be synchronized around the player. \n" + @@ -1561,7 +1561,7 @@ public class Config // Common public static ConfigEntry maxDataTransferSpeed = new ConfigEntry.Builder() - .setServersideShortName("common.maxDataTransferSpeed") + .setChatCommandName("common.maxDataTransferSpeed") .setMinDefaultMax(0, 500, 1000000 /* 1 GB/s */) .comment("" + "Maximum speed for uploading LODs to the clients, in KB/s.\n" diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/types/ConfigEntry.java b/core/src/main/java/com/seibel/distanthorizons/core/config/types/ConfigEntry.java index 7de7bcaf9..1dc48124b 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/types/ConfigEntry.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/types/ConfigEntry.java @@ -44,7 +44,7 @@ public class ConfigEntry extends AbstractConfigType> implem private T min; private T max; private final ArrayList listenerList; - private final String serversideShortName; + private final String chatCommandName; private final EConfigEntryPerformance performance; @@ -62,7 +62,7 @@ public class ConfigEntry extends AbstractConfigType> implem private ConfigEntry( EConfigEntryAppearance appearance, T value, String comment, T min, T max, - String serversideShortName, boolean allowApiOverride, + String chatCommandName, boolean allowApiOverride, EConfigEntryPerformance performance, ArrayList listenerList) { @@ -71,7 +71,7 @@ public class ConfigEntry extends AbstractConfigType> implem this.comment = comment; this.min = min; this.max = max; - this.serversideShortName = serversideShortName; + this.chatCommandName = chatCommandName; this.allowApiOverride = allowApiOverride; this.performance = performance; this.listenerList = listenerList; @@ -188,7 +188,7 @@ public class ConfigEntry extends AbstractConfigType> implem } // TODO is this for command line use? - public String getServersideShortName() { return this.serversideShortName; } + public String getChatCommandName() { return this.chatCommandName; } @Override public String getComment() { return this.comment; } @@ -326,7 +326,7 @@ public class ConfigEntry extends AbstractConfigType> implem private String tmpComment = null; private T tmpMin = null; private T tmpMax = null; - protected String tmpServersideShortName = null; + protected String tmpChatCommandName = null; private boolean tmpUseApiOverwrite = true; private EConfigEntryPerformance tmpPerformance = EConfigEntryPerformance.DONT_SHOW; protected ArrayList tmpIConfigListener = new ArrayList<>(); @@ -364,9 +364,9 @@ public class ConfigEntry extends AbstractConfigType> implem return this; } - public Builder setServersideShortName(String name) + public Builder setChatCommandName(String name) { - this.tmpServersideShortName = name; + this.tmpChatCommandName = name; return this; } @@ -415,7 +415,7 @@ public class ConfigEntry extends AbstractConfigType> implem return new ConfigEntry<>( this.tmpAppearance, this.tmpValue, this.tmpComment, this.tmpMin, this.tmpMax, - this.tmpServersideShortName, this.tmpUseApiOverwrite, + this.tmpChatCommandName, this.tmpUseApiOverwrite, this.tmpPerformance, this.tmpIConfigListener); } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/config/SessionConfig.java b/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/config/SessionConfig.java index 6ace4c042..af5b2448e 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/config/SessionConfig.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/config/SessionConfig.java @@ -84,10 +84,10 @@ public class SessionConfig implements INetworkObject private static void registerConfigEntry(ConfigEntry configEntry, BiFunction valueConstrainer) { - CONFIG_ENTRIES.compute(Objects.requireNonNull(configEntry.getServersideShortName()), (key, existingEntry) -> { + CONFIG_ENTRIES.compute(Objects.requireNonNull(configEntry.getChatCommandName()), (key, existingEntry) -> { if (existingEntry != null) { - throw new IllegalArgumentException("Attempted to register config entry with duplicate serversideShortName: " + key); + throw new IllegalArgumentException("Attempted to register config entry with duplicate chatCommandName: " + key); } return new Entry(configEntry, valueConstrainer); @@ -100,7 +100,7 @@ public class SessionConfig implements INetworkObject // internal getters // //==================// - private T getValue(ConfigEntry configEntry) { return this.getValue(configEntry.getServersideShortName()); } + private T getValue(ConfigEntry configEntry) { return this.getValue(configEntry.getChatCommandName()); } @SuppressWarnings("unchecked") private T getValue(String name) {