Rename serversideShortName to chatCommandName

This commit is contained in:
s809
2025-01-02 19:42:57 +05:00
parent 3648c83b2a
commit 56e430dff2
3 changed files with 30 additions and 30 deletions
@@ -87,7 +87,7 @@ public class Config
.build();
public static ConfigEntry<EDhApiThreadPreset> threadPresetSetting = new ConfigEntry.Builder<EDhApiThreadPreset>()
.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<Boolean> enableDistantGeneration = new ConfigEntry.Builder<Boolean>()
.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<EDhApiDistantGeneratorMode> distantGeneratorMode = new ConfigEntry.Builder<EDhApiDistantGeneratorMode>()
.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<Integer> numberOfThreads = new ConfigEntry.Builder<Integer>()
.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<Double> threadRunTimeRatio = new ConfigEntry.Builder<Double>()
.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<EDhApiLoggerMode> logWorldGenEvent = new ConfigEntry.Builder<EDhApiLoggerMode>()
.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<EDhApiLoggerMode> logWorldGenPerformance = new ConfigEntry.Builder<EDhApiLoggerMode>()
.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<EDhApiLoggerMode> logWorldGenLoadEvent = new ConfigEntry.Builder<EDhApiLoggerMode>()
.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<EDhApiLoggerMode> logNetworkEvent = new ConfigEntry.Builder<EDhApiLoggerMode>()
.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<Boolean> sendLevelKeys = new ConfigEntry.Builder<Boolean>()
.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<String> levelKeyPrefix = new ConfigEntry.Builder<String>()
.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<Integer> generationRequestRateLimit = new ConfigEntry.Builder<Integer>()
.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<Integer> maxGenerationRequestDistance = new ConfigEntry.Builder<Integer>()
.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<Boolean> enableRealTimeUpdates = new ConfigEntry.Builder<Boolean>()
.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<Integer> realTimeUpdateDistanceRadiusInChunks = new ConfigEntry.Builder<Integer>()
.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<Boolean> synchronizeOnLoad = new ConfigEntry.Builder<Boolean>()
.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<Integer> syncOnLoadRateLimit = new ConfigEntry.Builder<Integer>()
.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<Integer> maxSyncOnLoadRequestDistance = new ConfigEntry.Builder<Integer>()
.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<Integer> maxDataTransferSpeed = new ConfigEntry.Builder<Integer>()
.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"
@@ -44,7 +44,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
private T min;
private T max;
private final ArrayList<IConfigListener> listenerList;
private final String serversideShortName;
private final String chatCommandName;
private final EConfigEntryPerformance performance;
@@ -62,7 +62,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
private ConfigEntry(
EConfigEntryAppearance appearance,
T value, String comment, T min, T max,
String serversideShortName, boolean allowApiOverride,
String chatCommandName, boolean allowApiOverride,
EConfigEntryPerformance performance,
ArrayList<IConfigListener> listenerList)
{
@@ -71,7 +71,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> 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<T> extends AbstractConfigType<T, ConfigEntry<T>> 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<T> extends AbstractConfigType<T, ConfigEntry<T>> 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<IConfigListener> tmpIConfigListener = new ArrayList<>();
@@ -364,9 +364,9 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
return this;
}
public Builder<T> setServersideShortName(String name)
public Builder<T> setChatCommandName(String name)
{
this.tmpServersideShortName = name;
this.tmpChatCommandName = name;
return this;
}
@@ -415,7 +415,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> 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);
}
@@ -84,10 +84,10 @@ public class SessionConfig implements INetworkObject
private static <T> void registerConfigEntry(ConfigEntry<T> configEntry, BiFunction<T, T, T> 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> T getValue(ConfigEntry<T> configEntry) { return this.getValue(configEntry.getServersideShortName()); }
private <T> T getValue(ConfigEntry<T> configEntry) { return this.getValue(configEntry.getChatCommandName()); }
@SuppressWarnings("unchecked")
private <T> T getValue(String name)
{