craftbukkit/nms-patches/net/minecraft/server/dedicated/DedicatedServerProperties.patch

75 lines
4.3 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
2024-04-24 01:15:00 +10:00
@@ -43,11 +43,16 @@
2022-12-08 03:00:00 +11:00
import net.minecraft.world.level.levelgen.presets.WorldPresets;
2022-06-08 02:00:00 +10:00
import org.slf4j.Logger;
2019-04-23 12:00:00 +10:00
2021-03-09 08:47:33 +11:00
+// CraftBukkit start
+import joptsimple.OptionSet;
+// CraftBukkit end
+
2019-04-23 12:00:00 +10:00
public class DedicatedServerProperties extends PropertyManager<DedicatedServerProperties> {
2022-06-08 02:00:00 +10:00
static final Logger LOGGER = LogUtils.getLogger();
private static final Pattern SHA1 = Pattern.compile("^[a-fA-F0-9]{40}$");
2022-12-08 03:00:00 +11:00
private static final Splitter COMMA_SPLITTER = Splitter.on(',').trimResults();
2021-11-22 09:00:00 +11:00
+ 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", "");
2024-06-14 01:05:00 +10:00
@@ -105,8 +110,10 @@
2022-12-08 03:00:00 +11:00
public final WorldOptions worldOptions;
2024-04-24 01:15:00 +10:00
public boolean acceptsTransfers;
2019-04-23 12:00:00 +10:00
2021-06-11 15:00:00 +10:00
- public DedicatedServerProperties(Properties properties) {
2019-04-23 12:00:00 +10:00
- super(properties);
+ // CraftBukkit start
2021-06-11 15:00:00 +10:00
+ public DedicatedServerProperties(Properties properties, OptionSet optionset) {
2019-04-23 12:00:00 +10:00
+ super(properties, optionset);
+ // CraftBukkit end
2021-11-22 09:00:00 +11:00
this.difficulty = (EnumDifficulty) this.get("difficulty", dispatchNumberOrString(EnumDifficulty::byId, EnumDifficulty::byName), EnumDifficulty::getKey, EnumDifficulty.EASY);
this.gamemode = (EnumGamemode) this.get("gamemode", dispatchNumberOrString(EnumGamemode::byId, EnumGamemode::byName), EnumGamemode::getName, EnumGamemode.SURVIVAL);
this.levelName = this.get("level-name", "world");
2024-06-14 01:05:00 +10:00
@@ -165,13 +172,15 @@
2022-12-08 03:00:00 +11:00
this.initialDataPackConfiguration = getDatapackConfig(this.get("initial-enabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getEnabled())), this.get("initial-disabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getDisabled())));
2019-04-23 12:00:00 +10:00
}
2021-11-22 09:00:00 +11:00
- public static DedicatedServerProperties fromFile(Path path) {
- return new DedicatedServerProperties(loadFromFile(path));
2019-04-23 12:00:00 +10:00
+ // CraftBukkit start
2021-11-22 09:00:00 +11:00
+ public static DedicatedServerProperties fromFile(Path path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadFromFile(path), optionset);
2019-04-23 12:00:00 +10:00
}
@Override
2020-08-12 07:00:00 +10:00
- protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties) {
2022-12-08 03:00:00 +11:00
- return new DedicatedServerProperties(properties);
2020-08-12 07:00:00 +10:00
+ protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties, OptionSet optionset) {
2022-12-08 03:00:00 +11:00
+ return new DedicatedServerProperties(properties, optionset);
2019-04-23 12:00:00 +10:00
+ // CraftBukkit end
2022-12-08 03:00:00 +11:00
}
2021-06-11 15:00:00 +10:00
2022-12-08 03:00:00 +11:00
@Nullable
2024-06-14 01:05:00 +10:00
@@ -252,10 +261,10 @@
2022-06-08 02:00:00 +10:00
}).orElseThrow(() -> {
return new IllegalStateException("Invalid datapack contents: can't find default preset");
});
- Optional optional = Optional.ofNullable(MinecraftKey.tryParse(this.levelType)).map((minecraftkey) -> {
+ Optional<ResourceKey<WorldPreset>> optional = Optional.ofNullable(MinecraftKey.tryParse(this.levelType)).map((minecraftkey) -> { // CraftBukkit - decompile error
2022-12-08 03:00:00 +11:00
return ResourceKey.create(Registries.WORLD_PRESET, minecraftkey);
2022-06-08 02:00:00 +10:00
}).or(() -> {
2022-12-08 03:00:00 +11:00
- 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
2022-06-08 02:00:00 +10:00
});
2022-03-01 02:00:00 +11:00
2022-06-08 02:00:00 +10:00
Objects.requireNonNull(iregistry);
2024-06-14 01:05:00 +10:00
@@ -267,7 +276,7 @@
2022-03-01 02:00:00 +11:00
2022-12-08 03:00:00 +11:00
if (holder.is(WorldPresets.FLAT)) {
2024-04-24 01:15:00 +10:00
RegistryOps<JsonElement> registryops = iregistrycustom.createSerializationContext(JsonOps.INSTANCE);
2022-06-08 02:00:00 +10:00
- DataResult dataresult = GeneratorSettingsFlat.CODEC.parse(new Dynamic(registryops, this.generatorSettings()));
+ DataResult<GeneratorSettingsFlat> dataresult = GeneratorSettingsFlat.CODEC.parse(new Dynamic(registryops, this.generatorSettings())); // CraftBukkit - decompile error
Logger logger = DedicatedServerProperties.LOGGER;
2022-03-01 02:00:00 +11:00
2022-06-08 02:00:00 +10:00
Objects.requireNonNull(logger);