geforkt von Mirrors/Paper
21f51ebd74
Execute processQueue tasks during sleep: needed for console tab completions, pre join event, etc. Upstream has set precedent that the bukkit scheduler will still tick during sleep, which avoids some problems with plugins not accounting for the new sleep feature, but can still lead to others. Because of this we have disabled sleep by default, which avoids the problem and makes it more obvious to check if this is the cause of issues when enabled. We also unload chunks during sleep to prevent memory leaks caused by plugin chunk loads.
107 Zeilen
6.5 KiB
Diff
107 Zeilen
6.5 KiB
Diff
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
|
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
|
@@ -43,11 +43,16 @@
|
|
import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
|
import org.slf4j.Logger;
|
|
|
|
+// CraftBukkit start
|
|
+import joptsimple.OptionSet;
|
|
+// CraftBukkit end
|
|
+
|
|
public class DedicatedServerProperties extends Settings<DedicatedServerProperties> {
|
|
|
|
static final Logger LOGGER = LogUtils.getLogger();
|
|
private static final Pattern SHA1 = Pattern.compile("^[a-fA-F0-9]{40}$");
|
|
private static final Splitter COMMA_SPLITTER = Splitter.on(',').trimResults();
|
|
+ public final boolean debug = this.get("debug", false); // CraftBukkit
|
|
public final boolean onlineMode = this.get("online-mode", true);
|
|
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
|
public final String serverIp = this.get("server-ip", "");
|
|
@@ -100,13 +105,17 @@
|
|
public final Settings<DedicatedServerProperties>.MutableValue<Boolean> whiteList;
|
|
public final boolean enforceSecureProfile;
|
|
public final boolean logIPs;
|
|
- public final int pauseWhenEmptySeconds;
|
|
+ public int pauseWhenEmptySeconds;
|
|
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
|
|
public final WorldOptions worldOptions;
|
|
public boolean acceptsTransfers;
|
|
|
|
- public DedicatedServerProperties(Properties properties) {
|
|
- super(properties);
|
|
+ public final String rconIp; // Paper - Configurable rcon ip
|
|
+
|
|
+ // CraftBukkit start
|
|
+ public DedicatedServerProperties(Properties properties, OptionSet optionset) {
|
|
+ super(properties, optionset);
|
|
+ // CraftBukkit end
|
|
this.difficulty = (Difficulty) this.get("difficulty", dispatchNumberOrString(Difficulty::byId, Difficulty::byName), Difficulty::getKey, Difficulty.EASY);
|
|
this.gamemode = (GameType) this.get("gamemode", dispatchNumberOrString(GameType::byId, GameType::byName), GameType::getName, GameType.SURVIVAL);
|
|
this.levelName = this.get("level-name", "world");
|
|
@@ -137,7 +146,7 @@
|
|
this.maxWorldSize = this.get("max-world-size", (integer) -> {
|
|
return Mth.clamp(integer, 1, 29999984);
|
|
}, 29999984);
|
|
- this.syncChunkWrites = this.get("sync-chunk-writes", true);
|
|
+ this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag
|
|
this.regionFileComression = this.get("region-file-compression", "deflate");
|
|
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
|
|
this.enableStatus = this.get("enable-status", true);
|
|
@@ -151,7 +160,7 @@
|
|
this.whiteList = this.getMutable("white-list", false);
|
|
this.enforceSecureProfile = this.get("enforce-secure-profile", true);
|
|
this.logIPs = this.get("log-ips", true);
|
|
- this.pauseWhenEmptySeconds = this.get("pause-when-empty-seconds", 60);
|
|
+ this.pauseWhenEmptySeconds = this.get("pause-when-empty-seconds", -1); // Paper - disable tick sleeping by default
|
|
this.acceptsTransfers = this.get("accepts-transfers", false);
|
|
String s = this.get("level-seed", "");
|
|
boolean flag = this.get("generate-structures", true);
|
|
@@ -165,15 +174,21 @@
|
|
}, WorldPresets.NORMAL.location().toString()));
|
|
this.serverResourcePackInfo = DedicatedServerProperties.getServerPackInfo(this.get("resource-pack-id", ""), this.get("resource-pack", ""), this.get("resource-pack-sha1", ""), this.getLegacyString("resource-pack-hash"), this.get("require-resource-pack", false), this.get("resource-pack-prompt", ""));
|
|
this.initialDataPackConfiguration = DedicatedServerProperties.getDatapackConfig(this.get("initial-enabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getEnabled())), this.get("initial-disabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getDisabled())));
|
|
+ // Paper start - Configurable rcon ip
|
|
+ final String rconIp = this.getStringRaw("rcon.ip");
|
|
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
|
|
+ // Paper end - Configurable rcon ip
|
|
}
|
|
|
|
- public static DedicatedServerProperties fromFile(Path path) {
|
|
- return new DedicatedServerProperties(loadFromFile(path));
|
|
+ // CraftBukkit start
|
|
+ public static DedicatedServerProperties fromFile(Path path, OptionSet optionset) {
|
|
+ return new DedicatedServerProperties(loadFromFile(path), optionset);
|
|
}
|
|
|
|
@Override
|
|
- protected DedicatedServerProperties reload(RegistryAccess registryManager, Properties properties) {
|
|
- return new DedicatedServerProperties(properties);
|
|
+ public DedicatedServerProperties reload(RegistryAccess iregistrycustom, Properties properties, OptionSet optionset) {
|
|
+ return new DedicatedServerProperties(properties, optionset);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
@Nullable
|
|
@@ -254,10 +269,10 @@
|
|
}).orElseThrow(() -> {
|
|
return new IllegalStateException("Invalid datapack contents: can't find default preset");
|
|
});
|
|
- Optional optional = Optional.ofNullable(ResourceLocation.tryParse(this.levelType)).map((minecraftkey) -> {
|
|
+ Optional<ResourceKey<WorldPreset>> optional = Optional.ofNullable(ResourceLocation.tryParse(this.levelType)).map((minecraftkey) -> { // CraftBukkit - decompile error
|
|
return ResourceKey.create(Registries.WORLD_PRESET, minecraftkey);
|
|
}).or(() -> {
|
|
- return Optional.ofNullable((ResourceKey) DedicatedServerProperties.WorldDimensionData.LEGACY_PRESET_NAMES.get(this.levelType));
|
|
+ return Optional.ofNullable(DedicatedServerProperties.WorldDimensionData.LEGACY_PRESET_NAMES.get(this.levelType)); // CraftBukkit - decompile error
|
|
});
|
|
|
|
Objects.requireNonNull(holderlookup);
|
|
@@ -269,7 +284,7 @@
|
|
|
|
if (holder.is(WorldPresets.FLAT)) {
|
|
RegistryOps<JsonElement> registryops = registries.createSerializationContext(JsonOps.INSTANCE);
|
|
- DataResult dataresult = FlatLevelGeneratorSettings.CODEC.parse(new Dynamic(registryops, this.generatorSettings()));
|
|
+ DataResult<FlatLevelGeneratorSettings> dataresult = FlatLevelGeneratorSettings.CODEC.parse(new Dynamic(registryops, this.generatorSettings())); // CraftBukkit - decompile error
|
|
Logger logger = DedicatedServerProperties.LOGGER;
|
|
|
|
Objects.requireNonNull(logger);
|