Files
PlazmaBukkitMC/plazma-server/minecraft-patches/features/0001-Remove-demo-feature.patch
2025-02-23 22:35:05 +09:00

128 lines
7.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 19 Feb 2025 22:54:37 +0900
Subject: [PATCH] Remove demo feature
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index 42a2c150acf154d2184e0b422d3d97618c60a72c..6c54e929f87dd873e0713f5178c05e9c25eaa4c3 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -294,25 +294,25 @@ public class Main {
LevelSettings levelSettings;
WorldOptions worldOptions;
WorldDimensions worldDimensions;
+ // Plazma start - Remove demo feature
if (optionSet.has("demo")) { // CraftBukkit
- levelSettings = MinecraftServer.DEMO_SETTINGS;
- worldOptions = WorldOptions.DEMO_OPTIONS;
- worldDimensions = WorldPresets.createNormalWorldDimensions(context.datapackWorldgen());
- } else {
- DedicatedServerProperties properties = dedicatedServerSettings.getProperties();
- levelSettings = new LevelSettings(
- properties.levelName,
- properties.gamemode,
- properties.hardcore,
- properties.difficulty,
- false,
- new GameRules(context.dataConfiguration().enabledFeatures()),
- context.dataConfiguration()
- );
- worldOptions = optionSet.has("bonusChest") ? properties.worldOptions.withBonusChest(true) : properties.worldOptions; // CraftBukkit
- worldDimensions = properties.createDimensions(context.datapackWorldgen());
+ LOGGER.warn("Demo feature is removed since Plazma 1.21.4, defaulting to normal generation...");
}
+ DedicatedServerProperties properties = dedicatedServerSettings.getProperties();
+ levelSettings = new LevelSettings(
+ properties.levelName,
+ properties.gamemode,
+ properties.hardcore,
+ properties.difficulty,
+ false,
+ new GameRules(context.dataConfiguration().enabledFeatures()),
+ context.dataConfiguration()
+ );
+ worldOptions = optionSet.has("bonusChest") ? properties.worldOptions.withBonusChest(true) : properties.worldOptions; // CraftBukkit
+ worldDimensions = properties.createDimensions(context.datapackWorldgen());
+ // Plazma end - Remove demo feature
+
WorldDimensions.Complete complete = worldDimensions.bake(registry);
Lifecycle lifecycle = complete.lifecycle().add(context.datapackWorldgen().allRegistriesLifecycle());
return new WorldLoader.DataLoadOutput<>(
@@ -348,7 +348,6 @@ public class Main {
if (optionSet.has("serverId")) {
server.setId((String) optionSet.valueOf("serverId"));
}
- dedicatedServer1.setDemo(optionSet.has("demo"));
// Paper end
if (!optionSet.has("nogui") && !optionSet.nonOptionArguments().contains("nogui") && !GraphicsEnvironment.isHeadless()) {
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 83873873e3db91e178d2bddad7543494a7fc393e..ef5f1131e594036e318e2e1bdb0bf3d0abf8c0ab 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -603,24 +603,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LevelSettings levelSettings;
WorldOptions worldOptions;
net.minecraft.world.level.levelgen.WorldDimensions worldDimensions;
- if (this.isDemo()) {
- levelSettings = MinecraftServer.DEMO_SETTINGS;
- worldOptions = WorldOptions.DEMO_OPTIONS;
- worldDimensions = net.minecraft.world.level.levelgen.presets.WorldPresets.createNormalWorldDimensions(context.datapackWorldgen());
- } else {
- net.minecraft.server.dedicated.DedicatedServerProperties properties = ((net.minecraft.server.dedicated.DedicatedServer) this).getProperties();
- levelSettings = new LevelSettings(
- properties.levelName,
- properties.gamemode,
- properties.hardcore,
- properties.difficulty,
- false,
- new GameRules(context.dataConfiguration().enabledFeatures()),
- context.dataConfiguration()
- );
- worldOptions = this.options.has("bonusChest") ? properties.worldOptions.withBonusChest(true) : properties.worldOptions; // CraftBukkit
- worldDimensions = properties.createDimensions(context.datapackWorldgen());
- }
+ // Plazma start - Remove demo feature
+ net.minecraft.server.dedicated.DedicatedServerProperties properties = ((net.minecraft.server.dedicated.DedicatedServer) this).getProperties();
+ levelSettings = new LevelSettings(
+ properties.levelName,
+ properties.gamemode,
+ properties.hardcore,
+ properties.difficulty,
+ false,
+ new GameRules(context.dataConfiguration().enabledFeatures()),
+ context.dataConfiguration()
+ );
+ worldOptions = this.options.has("bonusChest") ? properties.worldOptions.withBonusChest(true) : properties.worldOptions; // CraftBukkit
+ worldDimensions = properties.createDimensions(context.datapackWorldgen());
+ // Plazma end - Remove demo feature
net.minecraft.world.level.levelgen.WorldDimensions.Complete complete = worldDimensions.bake(contextLevelStemRegistry);
com.mojang.serialization.Lifecycle lifecycle = complete.lifecycle().add(context.datapackWorldgen().allRegistriesLifecycle());
@@ -1958,14 +1954,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.worldData.getDifficulty() != Difficulty.PEACEFUL;
}
- public boolean isDemo() {
- return this.isDemo;
- }
-
- public void setDemo(boolean demo) {
- this.isDemo = demo;
- }
-
public Optional<MinecraftServer.ServerResourcePackInfo> getServerResourcePack() {
return Optional.empty();
}
@@ -2674,7 +2662,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ServerPlayerGameMode createGameModeForPlayer(ServerPlayer player) {
- return (ServerPlayerGameMode)(this.isDemo() ? new DemoMode(player) : new ServerPlayerGameMode(player));
+ return new ServerPlayerGameMode(player); // Plazma - Remove demo feature
}
@Nullable