SPIGOT-5496: API to create and manipulate hardcore worlds

This commit is contained in:
md_5 2020-01-04 10:14:23 +11:00
parent 9820cd2db0
commit e7202cd444
2 changed files with 11 additions and 2 deletions

View File

@ -910,7 +910,7 @@ public final class CraftServer implements Server {
} }
} }
} while(used); } while(used);
boolean hardcore = false; boolean hardcore = creator.hardcore();
WorldNBTStorage sdm = new WorldNBTStorage(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager); WorldNBTStorage sdm = new WorldNBTStorage(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager);
WorldData worlddata = sdm.getWorldData(); WorldData worlddata = sdm.getWorldData();

View File

@ -88,7 +88,6 @@ import net.minecraft.server.Ticket;
import net.minecraft.server.TicketType; import net.minecraft.server.TicketType;
import net.minecraft.server.Unit; import net.minecraft.server.Unit;
import net.minecraft.server.Vec3D; import net.minecraft.server.Vec3D;
import net.minecraft.server.WorldGenFeatureEmptyConfiguration;
import net.minecraft.server.WorldGenerator; import net.minecraft.server.WorldGenerator;
import net.minecraft.server.WorldServer; import net.minecraft.server.WorldServer;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
@ -1880,6 +1879,16 @@ public class CraftWorld implements World {
return world.getWorldData().shouldGenerateMapFeatures(); return world.getWorldData().shouldGenerateMapFeatures();
} }
@Override
public boolean isHardcore() {
return world.getWorldData().isHardcore();
}
@Override
public void setHardcore(boolean hardcore) {
world.getWorldData().g(hardcore);
}
@Override @Override
public long getTicksPerAnimalSpawns() { public long getTicksPerAnimalSpawns() {
return world.ticksPerAnimalSpawns; return world.ticksPerAnimalSpawns;