Add a config option to force server to always send only the highest detail

This commit is contained in:
s809
2025-01-07 01:25:31 +05:00
parent 6ce6145912
commit 56c09f5f5c
2 changed files with 16 additions and 0 deletions
@@ -1533,6 +1533,14 @@ public class Config
.setPerformance(EConfigEntryPerformance.HIGH)
.build();
public static ConfigEntry<Boolean> generateOnlyInHighestDetail = new ConfigEntry.Builder<Boolean>()
.setChatCommandName("generation.highestDetailOnly")
.set(false)
.comment(""
+ "Makes the server reject all generation requests for detail levels below the highest one.\n"
+ "")
.build();
// Real-time updates
public static ConfigEntry<Boolean> enableRealTimeUpdates = new ConfigEntry.Builder<Boolean>()
@@ -11,6 +11,7 @@ import com.seibel.distanthorizons.core.multiplayer.server.ServerPlayerState;
import com.seibel.distanthorizons.core.multiplayer.server.ServerPlayerStateManager;
import com.seibel.distanthorizons.core.network.exceptions.RequestOutOfRangeException;
import com.seibel.distanthorizons.core.network.exceptions.RequestRejectedException;
import com.seibel.distanthorizons.core.network.exceptions.SectionRequiresSplittingException;
import com.seibel.distanthorizons.core.network.messages.AbstractNetworkMessage;
import com.seibel.distanthorizons.core.network.messages.AbstractTrackableMessage;
import com.seibel.distanthorizons.core.network.messages.ILevelRelatedMessage;
@@ -149,6 +150,13 @@ public abstract class AbstractDhServerLevel extends AbstractDhLevel implements I
message.sendResponse(new RequestOutOfRangeException("Distance too large: " + distanceFromPlayer + " > " + Config.Server.maxGenerationRequestDistance.get()));
return;
}
if (Config.Server.generateOnlyInHighestDetail.get() && DhSectionPos.getDetailLevel(message.sectionPos) != DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL)
{
message.sendResponse(new SectionRequiresSplittingException("Only highest-detail sections are allowed"));
return;
}
this.requestHandler.queueWorldGenForRequestMessage(serverPlayerState, message, rateLimiterSet);
}
else