Hide all unrelated config entries
This commit is contained in:
@@ -155,6 +155,7 @@ public class Config
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Integer> lodChunkRenderDistanceRadius = new ConfigEntry.Builder<Integer>()
|
||||
.enableOnServer()
|
||||
.setMinDefaultMax(32, 128, 4096)
|
||||
.comment("The radius of the mod's render distance. (measured in chunks)")
|
||||
.setPerformance(EConfigEntryPerformance.HIGH)
|
||||
@@ -660,6 +661,7 @@ public class Config
|
||||
public static class WorldGenerator
|
||||
{
|
||||
public static ConfigEntry<Boolean> enableDistantGeneration = new ConfigEntry.Builder<Boolean>()
|
||||
.enableOnServer()
|
||||
.set(true)
|
||||
.comment(""
|
||||
+ " Should Distant Horizons slowly generate LODs \n"
|
||||
@@ -670,6 +672,7 @@ public class Config
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<EDhApiDistantGeneratorMode> distantGeneratorMode = new ConfigEntry.Builder<EDhApiDistantGeneratorMode>()
|
||||
.enableOnServer()
|
||||
.set(EDhApiDistantGeneratorMode.FEATURES)
|
||||
.comment(""
|
||||
+ "How detailed should LODs be generated outside the vanilla render distance? \n"
|
||||
@@ -711,6 +714,7 @@ public class Config
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Integer> worldGenerationTimeoutLengthInSeconds = new ConfigEntry.Builder<Integer>()
|
||||
.enableOnServer()
|
||||
.setMinDefaultMax(5, 60, 60 * 10/*10 minutes*/ )
|
||||
.comment(""
|
||||
+ "How long should a world generator thread run for before timing out? \n"
|
||||
@@ -754,6 +758,7 @@ public class Config
|
||||
public static class LodBuilding
|
||||
{
|
||||
public static ConfigEntry<Integer> minTimeBetweenChunkUpdatesInSeconds = new ConfigEntry.Builder<Integer>()
|
||||
.enableOnServer()
|
||||
.setMinDefaultMax(0, 1, 60)
|
||||
.comment(""
|
||||
+ "Determines how long must pass between LOD chunk updates before another. \n"
|
||||
@@ -819,6 +824,7 @@ public class Config
|
||||
public static class ServerNetworking
|
||||
{
|
||||
public static ConfigEntry<Boolean> enableServerNetworking = new ConfigEntry.Builder<Boolean>()
|
||||
.enableOnServer()
|
||||
.set(true)
|
||||
.comment(""
|
||||
+ "Attention: \n"
|
||||
@@ -833,6 +839,7 @@ public class Config
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Integer> requestRateLimit = new ConfigEntry.Builder<Integer>()
|
||||
.enableOnServer()
|
||||
.setMinDefaultMax(1, 20, 100)
|
||||
.comment(""
|
||||
+ "Limits the amount of sent/processed LOD requests concurrently. \n"
|
||||
@@ -842,6 +849,7 @@ public class Config
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Boolean> enableRealTimeUpdates = new ConfigEntry.Builder<Boolean>()
|
||||
.enableOnServer()
|
||||
.set(false)
|
||||
.comment(""
|
||||
+ "Enables real time updates from server."
|
||||
@@ -849,6 +857,7 @@ public class Config
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Boolean> enablePostRelogUpdate = new ConfigEntry.Builder<Boolean>()
|
||||
.enableOnServer()
|
||||
.set(false)
|
||||
.comment(""
|
||||
+ "Enables updating of LODs after relog."
|
||||
@@ -856,6 +865,7 @@ public class Config
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Integer> serverPort = new ConfigEntry.Builder<Integer>()
|
||||
.enableOnServer()
|
||||
.set(25049)
|
||||
.comment(""
|
||||
+ "The port on the server that's used for sending LOD data."
|
||||
|
||||
@@ -192,6 +192,8 @@ public class ConfigFileHandling
|
||||
public void saveEntry(ConfigEntry<?> entry, CommentedFileConfig workConfig)
|
||||
{
|
||||
if (!entry.getAppearance().showInFile) return;
|
||||
if (SingletonInjector.INSTANCE.get(IMinecraftSharedWrapper.class).isDedicatedServer() && !entry.isEnabledOnServer())
|
||||
return;
|
||||
if (entry.getTrueValue() == null)
|
||||
throw new IllegalArgumentException("Entry [" + entry.getNameWCategory() + "] is null, this may be a problem with [" + configBase.modName + "]. Please contact the authors");
|
||||
|
||||
@@ -254,6 +256,9 @@ public class ConfigFileHandling
|
||||
)
|
||||
return;
|
||||
|
||||
if (SingletonInjector.INSTANCE.get(IMinecraftSharedWrapper.class).isDedicatedServer() && !entry.isEnabledOnServer())
|
||||
return;
|
||||
|
||||
nightConfig.setComment(entry.getNameWCategory(), " " + entry.getComment().replaceAll("\n", "\n ") + "\n ");
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +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 boolean enabledOnServer;
|
||||
|
||||
// API control //
|
||||
/**
|
||||
@@ -57,13 +58,14 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
|
||||
|
||||
|
||||
/** Creates the entry */
|
||||
private ConfigEntry(EConfigEntryAppearance appearance, T value, String comment, T min, T max, boolean allowApiOverride, EConfigEntryPerformance performance, ArrayList<IConfigListener> listenerList)
|
||||
private ConfigEntry(EConfigEntryAppearance appearance, T value, String comment, T min, T max, boolean enabledOnServer, boolean allowApiOverride, EConfigEntryPerformance performance, ArrayList<IConfigListener> listenerList)
|
||||
{
|
||||
super(appearance, value);
|
||||
|
||||
this.comment = comment;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.enabledOnServer = enabledOnServer;
|
||||
this.allowApiOverride = allowApiOverride;
|
||||
this.performance = performance;
|
||||
this.listenerList = listenerList;
|
||||
@@ -179,6 +181,8 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
|
||||
if (validness == 1) this.value = (T) NumberUtil.getMaximum(this.value.getClass());
|
||||
}
|
||||
|
||||
public boolean isEnabledOnServer() { return this.enabledOnServer; }
|
||||
|
||||
@Override
|
||||
public String getComment() { return this.comment; }
|
||||
@Override
|
||||
@@ -297,6 +301,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
|
||||
private String tmpComment = null;
|
||||
private T tmpMin = null;
|
||||
private T tmpMax = null;
|
||||
protected boolean tmpEnabledOnServer = false;
|
||||
private boolean tmpUseApiOverwrite = true;
|
||||
private EConfigEntryPerformance tmpPerformance = EConfigEntryPerformance.DONT_SHOW;
|
||||
protected ArrayList<IConfigListener> tmpIConfigListener = new ArrayList<>();
|
||||
@@ -334,6 +339,12 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> enableOnServer()
|
||||
{
|
||||
this.tmpEnabledOnServer = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> setUseApiOverwrite(boolean newUseApiOverwrite)
|
||||
{
|
||||
this.tmpUseApiOverwrite = newUseApiOverwrite;
|
||||
@@ -376,7 +387,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
|
||||
|
||||
public ConfigEntry<T> build()
|
||||
{
|
||||
return new ConfigEntry<>(this.tmpAppearance, this.tmpValue, this.tmpComment, this.tmpMin, this.tmpMax, this.tmpUseApiOverwrite, this.tmpPerformance, this.tmpIConfigListener);
|
||||
return new ConfigEntry<>(this.tmpAppearance, this.tmpValue, this.tmpComment, this.tmpMin, this.tmpMax, this.tmpEnabledOnServer, this.tmpUseApiOverwrite, this.tmpPerformance, this.tmpIConfigListener);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class DhClientWorld extends AbstractDhWorld implements IDhClientWorld
|
||||
|
||||
if (Config.Client.Advanced.Multiplayer.ServerNetworking.enableServerNetworking.get())
|
||||
{
|
||||
// TODO server specific configs
|
||||
// TODO per server configs
|
||||
NetworkClient networkClient = new NetworkClient(MC_CLIENT.getCurrentServerIp().split(":")[0], Config.Client.Advanced.Multiplayer.ServerNetworking.serverPort.get());
|
||||
this.networkState = new ClientNetworkState(networkClient, MC_CLIENT.getPlayerUUID());
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.world;
|
||||
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.file.structure.LocalSaveStructure;
|
||||
import com.seibel.distanthorizons.core.level.DhServerLevel;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
@@ -51,8 +52,7 @@ public class DhServerWorld extends AbstractDhWorld implements IDhServerWorld
|
||||
this.saveStructure = new LocalSaveStructure();
|
||||
this.levels = new HashMap<>();
|
||||
|
||||
// TODO move to global payload once server specific configs are implemented
|
||||
NetworkServer networkServer = new NetworkServer(25049);
|
||||
NetworkServer networkServer = new NetworkServer(Config.Client.Advanced.Multiplayer.ServerNetworking.serverPort.get());
|
||||
this.remotePlayerConnectionHandler = new RemotePlayerConnectionHandler(networkServer);
|
||||
|
||||
LOGGER.info("Started "+DhServerWorld.class.getSimpleName()+" of type "+this.environment);
|
||||
|
||||
Reference in New Issue
Block a user