13
0
geforkt von Mirrors/Paper

SPIGOT-5496: API to create and manipulate hardcore worlds

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2020-01-04 10:14:11 +11:00
Ursprung 588b818f57
Commit 281754ffbd
2 geänderte Dateien mit 47 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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>

Datei anzeigen

@ -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>