Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Mar 24, 2020
2 parents febd57d + 6e7d92a commit eb04642
Show file tree
Hide file tree
Showing 7 changed files with 243 additions and 68 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.11.0</build.version>
<build.version>1.12.0</build.version>
</properties>

<!-- Profiles will allow to automatically change build version. -->
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/world/bentobox/bskyblock/BSkyBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public void createWorlds() {

// Create the world if it does not exist
islandWorld = getWorld(worldName, World.Environment.NORMAL, chunkGenerator);

// Make the nether if it does not exist
if (settings.isNetherGenerate()) {
if (getServer().getWorld(worldName + NETHER) == null) {
Expand Down Expand Up @@ -118,7 +117,18 @@ private World getWorld(String worldName2, Environment env, ChunkGeneratorWorld c
worldName2 = env.equals(World.Environment.NETHER) ? worldName2 + NETHER : worldName2;
worldName2 = env.equals(World.Environment.THE_END) ? worldName2 + THE_END : worldName2;
WorldCreator wc = WorldCreator.name(worldName2).type(WorldType.FLAT).environment(env);
return settings.isUseOwnGenerator() ? wc.createWorld() : wc.generator(chunkGenerator2).createWorld();
World w = settings.isUseOwnGenerator() ? wc.createWorld() : wc.generator(chunkGenerator2).createWorld();
// Set spawn rates
if (w != null) {
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
w.setAmbientSpawnLimit(getSettings().getSpawnLimitAmbient());
w.setAnimalSpawnLimit(getSettings().getSpawnLimitAnimals());
w.setWaterAnimalSpawnLimit(getSettings().getSpawnLimitWaterAnimals());
w.setTicksPerAnimalSpawns(getSettings().getTicksPerAnimalSpawns());
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
}
return w;

}

@Override
Expand Down
143 changes: 123 additions & 20 deletions src/main/java/world/bentobox/bskyblock/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "world.difficulty")
private Difficulty difficulty = Difficulty.NORMAL;

@ConfigComment("Spawn limits. These override the limits set in bukkit.yml")
@ConfigComment("If set to a negative number, the server defaults will be used")
@ConfigEntry(path = "world.spawn-limits.monsters", since = "1.11.2")
private int spawnLimitMonsters = -1;
@ConfigEntry(path = "world.spawn-limits.animals", since = "1.11.2")
private int spawnLimitAnimals = -1;
@ConfigEntry(path = "world.spawn-limits.water-animals", since = "1.11.2")
private int spawnLimitWaterAnimals = -1;
@ConfigEntry(path = "world.spawn-limits.ambient", since = "1.11.2")
private int spawnLimitAmbient = -1;
@ConfigComment("Setting to 0 will disable animal spawns, but this is not recommended. Minecraft default is 400.")
@ConfigComment("A negative value uses the server default")
@ConfigEntry(path = "world.spawn-limits.ticks-per-animal-spawns", since = "1.11.2")
private int ticksPerAnimalSpawns = -1;
@ConfigComment("Setting to 0 will disable monster spawns, but this is not recommended. Minecraft default is 400.")
@ConfigComment("A negative value uses the server default")
@ConfigEntry(path = "world.spawn-limits.ticks-per-monster-spawns", since = "1.11.2")
private int ticksPerMonsterSpawns = -1;

@ConfigComment("Radius of island in blocks. (So distance between islands is twice this)")
@ConfigComment("It is the same for every dimension : Overworld, Nether and End.")
@ConfigComment("This value cannot be changed mid-game and the plugin will not start if it is different.")
Expand Down Expand Up @@ -328,8 +347,8 @@ public class Settings implements WorldSettings {
private boolean createIslandOnFirstLoginAbortOnLogout = true;

@ConfigComment("Toggles whether the player should be teleported automatically to his island when it is created.")
@ConfigComment("If set to false, the player will be told his island is ready but will have to teleport to his island using the command.")
@ConfigEntry(path = "island.teleport-player-to-island-when-created", since = "1.10.0")
@ConfigComment("If set to false, the player will be told his island is ready but will have to teleport to his island using the command.")
@ConfigEntry(path = "island.teleport-player-to-island-when-created", since = "1.10.0")
private boolean teleportPlayerToIslandUponIslandCreation = true;

@ConfigComment("Create Nether or End islands if they are missing when a player goes through a portal.")
Expand Down Expand Up @@ -1445,22 +1464,106 @@ public void setPasteMissingIslands(boolean pasteMissingIslands) {
this.pasteMissingIslands = pasteMissingIslands;
}

/**
* Toggles whether the player should be teleported automatically to his island when it is created.
* @return {@code true} if the player should be teleported automatically to his island when it is created,
* {@code false} otherwise.
* @since 1.10.0
*/
@Override
public boolean isTeleportPlayerToIslandUponIslandCreation() {
return teleportPlayerToIslandUponIslandCreation;
}

/**
* @param teleportPlayerToIslandUponIslandCreation the teleportPlayerToIslandUponIslandCreation to set
* @since 1.10.0
*/
public void setTeleportPlayerToIslandUponIslandCreation(boolean teleportPlayerToIslandUponIslandCreation) {
this.teleportPlayerToIslandUponIslandCreation = teleportPlayerToIslandUponIslandCreation;
}
/**
* Toggles whether the player should be teleported automatically to his island when it is created.
* @return {@code true} if the player should be teleported automatically to his island when it is created,
* {@code false} otherwise.
* @since 1.10.0
*/
@Override
public boolean isTeleportPlayerToIslandUponIslandCreation() {
return teleportPlayerToIslandUponIslandCreation;
}

/**
* @param teleportPlayerToIslandUponIslandCreation the teleportPlayerToIslandUponIslandCreation to set
* @since 1.10.0
*/
public void setTeleportPlayerToIslandUponIslandCreation(boolean teleportPlayerToIslandUponIslandCreation) {
this.teleportPlayerToIslandUponIslandCreation = teleportPlayerToIslandUponIslandCreation;
}

/**
* @return the spawnLimitMonsters
*/
public int getSpawnLimitMonsters() {
return spawnLimitMonsters;
}

/**
* @param spawnLimitMonsters the spawnLimitMonsters to set
*/
public void setSpawnLimitMonsters(int spawnLimitMonsters) {
this.spawnLimitMonsters = spawnLimitMonsters;
}

/**
* @return the spawnLimitAnimals
*/
public int getSpawnLimitAnimals() {
return spawnLimitAnimals;
}

/**
* @param spawnLimitAnimals the spawnLimitAnimals to set
*/
public void setSpawnLimitAnimals(int spawnLimitAnimals) {
this.spawnLimitAnimals = spawnLimitAnimals;
}

/**
* @return the spawnLimitWaterAnimals
*/
public int getSpawnLimitWaterAnimals() {
return spawnLimitWaterAnimals;
}

/**
* @param spawnLimitWaterAnimals the spawnLimitWaterAnimals to set
*/
public void setSpawnLimitWaterAnimals(int spawnLimitWaterAnimals) {
this.spawnLimitWaterAnimals = spawnLimitWaterAnimals;
}

/**
* @return the spawnLimitAmbient
*/
public int getSpawnLimitAmbient() {
return spawnLimitAmbient;
}

/**
* @param spawnLimitAmbient the spawnLimitAmbient to set
*/
public void setSpawnLimitAmbient(int spawnLimitAmbient) {
this.spawnLimitAmbient = spawnLimitAmbient;
}

/**
* @return the ticksPerAnimalSpawns
*/
public int getTicksPerAnimalSpawns() {
return ticksPerAnimalSpawns;
}

/**
* @param ticksPerAnimalSpawns the ticksPerAnimalSpawns to set
*/
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
this.ticksPerAnimalSpawns = ticksPerAnimalSpawns;
}

/**
* @return the ticksPerMonsterSpawns
*/
public int getTicksPerMonsterSpawns() {
return ticksPerMonsterSpawns;
}

/**
* @param ticksPerMonsterSpawns the ticksPerMonsterSpawns to set
*/
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
this.ticksPerMonsterSpawns = ticksPerMonsterSpawns;
}
}
3 changes: 3 additions & 0 deletions src/main/resources/addon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ permissions:
bskyblock.mod.bypasscooldowns:
description: Allow moderator to bypass cooldowns
default: op
bskyblock.mod.bypassdelays:
description: Allow moderator to bypass delays
default: op
bskyblock.mod.bypassprotect:
description: Allow moderator to bypass island protection
default: op
Expand Down
Loading

0 comments on commit eb04642

Please sign in to comment.