Make spawning amount apply and rename it

This commit is contained in:
Ben Woo 2023-09-04 23:58:47 +08:00
parent f519639893
commit fe26ccb1eb
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8
7 changed files with 44 additions and 37 deletions

View File

@ -232,12 +232,12 @@ public class OfflineWorld {
return worldConfig.setSpawningAnimals(spawningAnimals);
}
public int getSpawningAnimalsAmount() {
return worldConfig.getSpawningAnimalsAmount();
public int getSpawningAnimalsTicks() {
return worldConfig.getSpawningAnimalsTicks();
}
public Try<Void> setSpawningAnimalsAmount(int spawningAnimalsAmount) {
return worldConfig.setSpawningAnimalsAmount(spawningAnimalsAmount);
public Try<Void> setSpawningAnimalsTicks(int spawningAnimalsAmount) {
return worldConfig.setSpawningAnimalsTicks(spawningAnimalsAmount);
}
public List<String> getSpawningAnimalsExceptions() {
@ -256,12 +256,12 @@ public class OfflineWorld {
return worldConfig.setSpawningMonsters(spawningMonsters);
}
public int getSpawningMonstersAmount() {
return worldConfig.getSpawningMonstersAmount();
public int getSpawningMonstersTicks() {
return worldConfig.getSpawningMonstersTicks();
}
public Try<Void> setSpawningMonstersAmount(int spawningMonstersAmount) {
return worldConfig.setSpawningMonstersAmount(spawningMonstersAmount);
public Try<Void> setSpawningMonstersTicks(int spawningMonstersAmount) {
return worldConfig.setSpawningMonstersTicks(spawningMonstersAmount);
}
public List<String> getSpawningMonstersExceptions() {

View File

@ -241,12 +241,12 @@ public class WorldConfig {
return configHandle.set(configNodes.SPAWNING_ANIMALS, spawningAnimals);
}
public int getSpawningAnimalsAmount() {
return configHandle.get(configNodes.SPAWNING_ANIMALS_AMOUNT);
public int getSpawningAnimalsTicks() {
return configHandle.get(configNodes.SPAWNING_ANIMALS_TICKS);
}
public Try<Void> setSpawningAnimalsAmount(int spawningAnimalsAmount) {
return configHandle.set(configNodes.SPAWNING_ANIMALS_AMOUNT, spawningAnimalsAmount);
public Try<Void> setSpawningAnimalsTicks(int spawningAnimalsAmount) {
return configHandle.set(configNodes.SPAWNING_ANIMALS_TICKS, spawningAnimalsAmount);
}
public List<String> getSpawningAnimalsExceptions() {
@ -265,12 +265,12 @@ public class WorldConfig {
return configHandle.set(configNodes.SPAWNING_MONSTERS, spawningMonsters);
}
public int getSpawningMonstersAmount() {
return configHandle.get(configNodes.SPAWNING_MONSTERS_AMOUNT);
public int getSpawningMonstersTicks() {
return configHandle.get(configNodes.SPAWNING_MONSTERS_TICKS);
}
public Try<Void> setSpawningMonstersAmount(int spawningMonstersAmount) {
return configHandle.set(configNodes.SPAWNING_MONSTERS_AMOUNT, spawningMonstersAmount);
public Try<Void> setSpawningMonstersTicks(int spawningMonstersAmount) {
return configHandle.set(configNodes.SPAWNING_MONSTERS_TICKS, spawningMonstersAmount);
}
public List<String> getSpawningMonstersExceptions() {

View File

@ -10,7 +10,6 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -183,9 +182,13 @@ public class WorldConfigNodes {
})
.build());
public final ConfigNode<Integer> SPAWNING_ANIMALS_AMOUNT = node(ConfigNode.builder("spawning.animals.amount", Integer.class)
public final ConfigNode<Integer> SPAWNING_ANIMALS_TICKS = node(ConfigNode.builder("spawning.animals.tick-rate", Integer.class)
.defaultValue(-1)
.name("spawning-animals-amount")
.name("spawning-animals-ticks")
.onSetValue((oldValue, newValue) -> {
if (world == null) { return; }
world.getBukkitWorld().peek(world -> world.setTicksPerAnimalSpawns(newValue));
})
.build());
public final ConfigNode<List> SPAWNING_ANIMALS_EXCEPTIONS = node(ConfigNode.builder("spawning.animals.exceptions", List.class)
@ -202,9 +205,13 @@ public class WorldConfigNodes {
})
.build());
public final ConfigNode<Integer> SPAWNING_MONSTERS_AMOUNT = node(ConfigNode.builder("spawning.monsters.amount", Integer.class)
public final ConfigNode<Integer> SPAWNING_MONSTERS_TICKS = node(ConfigNode.builder("spawning.monsters.tick-rate", Integer.class)
.defaultValue(-1)
.name("spawning-monsters-amount")
.name("spawning-monsters-ticks")
.onSetValue((oldValue, newValue) -> {
if (world == null) { return; }
world.getBukkitWorld().peek(world -> world.setTicksPerMonsterSpawns(newValue));
})
.build());
public final ConfigNode<List> SPAWNING_MONSTERS_EXCEPTIONS = node(ConfigNode.builder("spawning.monsters.exceptions", List.class)

View File

@ -27,11 +27,11 @@ world:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []
world_nether:
@ -63,10 +63,10 @@ world_nether:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []

View File

@ -27,10 +27,10 @@ world_nether:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []

View File

@ -27,11 +27,11 @@ world:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []
world_nether:
@ -63,11 +63,11 @@ world_nether:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []
newworld:
@ -99,10 +99,10 @@ newworld:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []

View File

@ -32,11 +32,11 @@ world:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []
world_nether:
@ -68,10 +68,10 @@ world_nether:
spawning:
animals:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
monsters:
spawn: true
amount: -1
tick-rate: -1
exceptions: []
world-blacklist: []