mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 00:58:04 +01:00
Fixed settings. Implemented useowngenerator
This commit is contained in:
parent
a72a49975f
commit
a60bcc8a22
@ -166,7 +166,9 @@ public class Settings implements DataObject, WorldSettings {
|
|||||||
@ConfigEntry(path = "world.start-z", needsReset = true)
|
@ConfigEntry(path = "world.start-z", needsReset = true)
|
||||||
private int islandStartZ = 0;
|
private int islandStartZ = 0;
|
||||||
|
|
||||||
|
@ConfigEntry(path = "world.offset-x")
|
||||||
private int islandXOffset;
|
private int islandXOffset;
|
||||||
|
@ConfigEntry(path = "world.offset-z")
|
||||||
private int islandZOffset;
|
private int islandZOffset;
|
||||||
|
|
||||||
@ConfigComment("Island height - Lowest is 5.")
|
@ConfigComment("Island height - Lowest is 5.")
|
||||||
@ -174,6 +176,11 @@ public class Settings implements DataObject, WorldSettings {
|
|||||||
@ConfigEntry(path = "world.island-height")
|
@ConfigEntry(path = "world.island-height")
|
||||||
private int islandHeight = 100;
|
private int islandHeight = 100;
|
||||||
|
|
||||||
|
@ConfigComment("Use your own world generator for this world. In this case, the plugin will not generate")
|
||||||
|
@ConfigComment("anything.")
|
||||||
|
@ConfigEntry(path = "world.use-own-generator")
|
||||||
|
private boolean useOwnGenerator;
|
||||||
|
|
||||||
@ConfigComment("Sea height (don't changes this mid-game unless you delete the world)")
|
@ConfigComment("Sea height (don't changes this mid-game unless you delete the world)")
|
||||||
@ConfigComment("Minimum is 0, which means you are playing Skyblock!")
|
@ConfigComment("Minimum is 0, which means you are playing Skyblock!")
|
||||||
@ConfigComment("If sea height is less than about 10, then players will drop right through it")
|
@ConfigComment("If sea height is less than about 10, then players will drop right through it")
|
||||||
@ -422,8 +429,6 @@ public class Settings implements DataObject, WorldSettings {
|
|||||||
|
|
||||||
private EntityType companionType = EntityType.COW;
|
private EntityType companionType = EntityType.COW;
|
||||||
|
|
||||||
private boolean useOwnGenerator;
|
|
||||||
|
|
||||||
private Map<String,Integer> limitedBlocks = new HashMap<>();
|
private Map<String,Integer> limitedBlocks = new HashMap<>();
|
||||||
private boolean teamJoinDeathReset;
|
private boolean teamJoinDeathReset;
|
||||||
|
|
||||||
@ -943,6 +948,7 @@ public class Settings implements DataObject, WorldSettings {
|
|||||||
/**
|
/**
|
||||||
* @return the useOwnGenerator
|
* @return the useOwnGenerator
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isUseOwnGenerator() {
|
public boolean isUseOwnGenerator() {
|
||||||
return useOwnGenerator;
|
return useOwnGenerator;
|
||||||
}
|
}
|
||||||
|
@ -203,5 +203,10 @@ public interface WorldSettings {
|
|||||||
|
|
||||||
Map<Flag, Integer> getDefaultIslandSettings();
|
Map<Flag, Integer> getDefaultIslandSettings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the default world generator should not operate in this world
|
||||||
|
*/
|
||||||
|
boolean isUseOwnGenerator();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,25 @@ public class IslandWorldManager {
|
|||||||
worlds = new HashMap<>();
|
worlds = new HashMap<>();
|
||||||
worldSettings = new HashMap<>();
|
worldSettings = new HashMap<>();
|
||||||
if (plugin.getSettings().isUseOwnGenerator()) {
|
if (plugin.getSettings().isUseOwnGenerator()) {
|
||||||
// Do nothing
|
plugin.log("Default world generator disabled.");
|
||||||
|
islandWorld = Bukkit.getWorld(plugin.getSettings().getWorldName());
|
||||||
|
if (plugin.getSettings().isNetherGenerate()) {
|
||||||
|
netherWorld = plugin.getServer().getWorld(plugin.getSettings().getWorldName() + NETHER);
|
||||||
|
if (netherWorld == null) {
|
||||||
|
plugin.logError("Island nether world does not exist - you must create it manually");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (plugin.getSettings().isEndGenerate()) {
|
||||||
|
endWorld = plugin.getServer().getWorld(plugin.getSettings().getWorldName() + THE_END);
|
||||||
|
if (endWorld == null) {
|
||||||
|
plugin.logError("Island end world does not exist - you must create it manually");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (islandWorld != null) {
|
||||||
|
addWorld(islandWorld, plugin.getSettings());
|
||||||
|
} else {
|
||||||
|
plugin.logError("Island world does not exist - you must create it manually");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName()) == null) {
|
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName()) == null) {
|
||||||
@ -90,8 +108,12 @@ public class IslandWorldManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a world with Multiverse if the plugin exists
|
||||||
|
* @param world - world
|
||||||
|
*/
|
||||||
private void multiverseReg(World world) {
|
private void multiverseReg(World world) {
|
||||||
if (Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) {
|
if (!isUseOwnGenerator(world) && Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) {
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
Bukkit.getScheduler().runTask(plugin, () -> Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
MULTIVERSE_IMPORT + world.getName() + " normal -g " + plugin.getName()));
|
MULTIVERSE_IMPORT + world.getName() + " normal -g " + plugin.getName()));
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
@ -583,4 +605,9 @@ public class IslandWorldManager {
|
|||||||
public Map<Flag, Integer> getDefaultIslandSettings(World world) {
|
public Map<Flag, Integer> getDefaultIslandSettings(World world) {
|
||||||
return worldSettings.get(Util.getWorld(world)).getDefaultIslandSettings();
|
return worldSettings.get(Util.getWorld(world)).getDefaultIslandSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUseOwnGenerator(World world) {
|
||||||
|
return worldSettings.get(Util.getWorld(world)).isUseOwnGenerator();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ public class NewIsland {
|
|||||||
return Result.ISLAND_FOUND;
|
return Result.ISLAND_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getSettings().isUseOwnGenerator()) {
|
if (!plugin.getIWM().isUseOwnGenerator(location.getWorld())) {
|
||||||
// Block check
|
// Block check
|
||||||
if (!location.getBlock().isEmpty() && !location.getBlock().isLiquid()) {
|
if (!location.getBlock().isEmpty() && !location.getBlock().isLiquid()) {
|
||||||
plugin.getIslands().createIsland(location);
|
plugin.getIslands().createIsland(location);
|
||||||
|
Loading…
Reference in New Issue
Block a user