diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index 50fe188ea8..baa1f6b975 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -1464,6 +1464,24 @@ public interface World extends PluginMessageRecipient, Metadatable { */ public boolean canGenerateStructures(); + /** + * Gets whether the world is hardcore or not. + * + * In a hardcore world the difficulty is locked to hard. + * + * @return hardcore status + */ + public boolean isHardcore(); + + /** + * Sets whether the world is hardcore or not. + * + * In a hardcore world the difficulty is locked to hard. + * + * @param hardcore Whether the world is hardcore + */ + public void setHardcore(boolean hardcore); + /** * Gets the world's ticks per animal spawns value *

diff --git a/paper-api/src/main/java/org/bukkit/WorldCreator.java b/paper-api/src/main/java/org/bukkit/WorldCreator.java index 435fce5b0c..5f44526ff6 100644 --- a/paper-api/src/main/java/org/bukkit/WorldCreator.java +++ b/paper-api/src/main/java/org/bukkit/WorldCreator.java @@ -18,6 +18,7 @@ public class WorldCreator { private WorldType type = WorldType.NORMAL; private boolean generateStructures = true; private String generatorSettings = ""; + private boolean hardcore = false; /** * Creates an empty WorldCreationOptions for the given world name @@ -50,6 +51,7 @@ public class WorldCreator { generator = world.getGenerator(); type = world.getWorldType(); generateStructures = world.canGenerateStructures(); + hardcore = world.isHardcore(); return this; } @@ -72,6 +74,7 @@ public class WorldCreator { type = creator.type(); generateStructures = creator.generateStructures(); generatorSettings = creator.generatorSettings(); + hardcore = creator.hardcore(); return this; } @@ -271,6 +274,32 @@ public class WorldCreator { return generateStructures; } + /** + * Sets whether the world will be hardcore or not. + * + * In a hardcore world the difficulty will be locked to hard. + * + * @param hardcore Whether the world will be hardcore + * @return This object, for chaining + */ + @NotNull + public WorldCreator hardcore(boolean hardcore) { + this.hardcore = hardcore; + + return this; + } + + /** + * Gets whether the world will be hardcore or not. + * + * In a hardcore world the difficulty will be locked to hard. + * + * @return hardcore status + */ + public boolean hardcore() { + return hardcore; + } + /** * Creates a world with the specified options. *