mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-21 05:44:17 +00:00
SPIGOT-5496: API to create and manipulate hardcore worlds
This commit is contained in:
parent
72e3dfd4b2
commit
adf331f101
2 changed files with 47 additions and 0 deletions
|
@ -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
|
||||
* <p>
|
||||
|
|
|
@ -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.
|
||||
* <p>
|
||||
|
|
Loading…
Add table
Reference in a new issue