mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-11 18:22:08 -07:00
SPIGOT-5496: API to create and manipulate hardcore worlds
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -1464,6 +1464,24 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
*/
|
*/
|
||||||
public boolean canGenerateStructures();
|
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
|
* Gets the world's ticks per animal spawns value
|
||||||
* <p>
|
* <p>
|
||||||
|
@@ -18,6 +18,7 @@ public class WorldCreator {
|
|||||||
private WorldType type = WorldType.NORMAL;
|
private WorldType type = WorldType.NORMAL;
|
||||||
private boolean generateStructures = true;
|
private boolean generateStructures = true;
|
||||||
private String generatorSettings = "";
|
private String generatorSettings = "";
|
||||||
|
private boolean hardcore = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty WorldCreationOptions for the given world name
|
* Creates an empty WorldCreationOptions for the given world name
|
||||||
@@ -50,6 +51,7 @@ public class WorldCreator {
|
|||||||
generator = world.getGenerator();
|
generator = world.getGenerator();
|
||||||
type = world.getWorldType();
|
type = world.getWorldType();
|
||||||
generateStructures = world.canGenerateStructures();
|
generateStructures = world.canGenerateStructures();
|
||||||
|
hardcore = world.isHardcore();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -72,6 +74,7 @@ public class WorldCreator {
|
|||||||
type = creator.type();
|
type = creator.type();
|
||||||
generateStructures = creator.generateStructures();
|
generateStructures = creator.generateStructures();
|
||||||
generatorSettings = creator.generatorSettings();
|
generatorSettings = creator.generatorSettings();
|
||||||
|
hardcore = creator.hardcore();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -271,6 +274,32 @@ public class WorldCreator {
|
|||||||
return generateStructures;
|
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.
|
* Creates a world with the specified options.
|
||||||
* <p>
|
* <p>
|
||||||
|
Reference in New Issue
Block a user