From e7202cd4449505a601e82be3b44278acc46effcb Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 4 Jan 2020 10:14:23 +1100 Subject: [PATCH] SPIGOT-5496: API to create and manipulate hardcore worlds --- src/main/java/org/bukkit/craftbukkit/CraftServer.java | 2 +- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 87d0ab609f..0dfe176b4e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -910,7 +910,7 @@ public final class CraftServer implements Server { } } } while(used); - boolean hardcore = false; + boolean hardcore = creator.hardcore(); WorldNBTStorage sdm = new WorldNBTStorage(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager); WorldData worlddata = sdm.getWorldData(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 517969d765..5173c2d451 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -88,7 +88,6 @@ import net.minecraft.server.Ticket; import net.minecraft.server.TicketType; import net.minecraft.server.Unit; import net.minecraft.server.Vec3D; -import net.minecraft.server.WorldGenFeatureEmptyConfiguration; import net.minecraft.server.WorldGenerator; import net.minecraft.server.WorldServer; import org.apache.commons.lang.Validate; @@ -1880,6 +1879,16 @@ public class CraftWorld implements World { return world.getWorldData().shouldGenerateMapFeatures(); } + @Override + public boolean isHardcore() { + return world.getWorldData().isHardcore(); + } + + @Override + public void setHardcore(boolean hardcore) { + world.getWorldData().g(hardcore); + } + @Override public long getTicksPerAnimalSpawns() { return world.ticksPerAnimalSpawns;