Remove public from config nodes and remove names that are the same as path

This commit is contained in:
Ben Woo 2023-09-11 17:06:06 +08:00
parent 61570b1a7f
commit 329901afa6
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8

View File

@ -35,24 +35,20 @@ public class WorldConfigNodes {
return node; return node;
} }
public final ConfigNode<Boolean> ADJUST_SPAWN = node(ConfigNode.builder("adjust-spawn", Boolean.class) final ConfigNode<Boolean> ADJUST_SPAWN = node(ConfigNode.builder("adjust-spawn", Boolean.class)
.defaultValue(false) .defaultValue(false)
.name("adjust-spawn")
.build()); .build());
public final ConfigNode<String> ALIAS = node(ConfigNode.builder("alias", String.class) final ConfigNode<String> ALIAS = node(ConfigNode.builder("alias", String.class)
.defaultValue("") .defaultValue("")
.name("alias")
.build()); .build());
public final ConfigNode<Boolean> ALLOW_FLIGHT = node(ConfigNode.builder("allow-flight", Boolean.class) final ConfigNode<Boolean> ALLOW_FLIGHT = node(ConfigNode.builder("allow-flight", Boolean.class)
.defaultValue(false) .defaultValue(false)
.name("allow-flight")
.build()); .build());
public final ConfigNode<Boolean> ALLOW_WEATHER = node(ConfigNode.builder("allow-weather", Boolean.class) final ConfigNode<Boolean> ALLOW_WEATHER = node(ConfigNode.builder("allow-weather", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("allow-weather")
.onSetValue((oldValue, newValue) -> { .onSetValue((oldValue, newValue) -> {
if (world == null) return; if (world == null) return;
world.getBukkitWorld().peek(world -> { world.getBukkitWorld().peek(world -> {
@ -64,112 +60,101 @@ public class WorldConfigNodes {
}) })
.build()); .build());
public final ConfigNode<Boolean> AUTO_HEAL = node(ConfigNode.builder("auto-heal", Boolean.class) final ConfigNode<Boolean> AUTO_HEAL = node(ConfigNode.builder("auto-heal", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("auto-heal")
.build()); .build());
public final ConfigNode<Boolean> AUTO_LOAD = node(ConfigNode.builder("auto-load", Boolean.class) final ConfigNode<Boolean> AUTO_LOAD = node(ConfigNode.builder("auto-load", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("auto-load")
.build()); .build());
public final ConfigNode<Boolean> BED_RESPAWN = node(ConfigNode.builder("bed-respawn", Boolean.class) final ConfigNode<Boolean> BED_RESPAWN = node(ConfigNode.builder("bed-respawn", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("bed-respawn")
.build()); .build());
public final ConfigNode<Difficulty> DIFFICULTY = node(ConfigNode.builder("difficulty", Difficulty.class) final ConfigNode<Difficulty> DIFFICULTY = node(ConfigNode.builder("difficulty", Difficulty.class)
.defaultValue(Difficulty.NORMAL) .defaultValue(Difficulty.NORMAL)
.name("difficulty")
.onSetValue((oldValue, newValue) -> { .onSetValue((oldValue, newValue) -> {
if (world == null) return; if (world == null) return;
world.getBukkitWorld().peek(world -> world.setDifficulty(newValue)); world.getBukkitWorld().peek(world -> world.setDifficulty(newValue));
}) })
.build()); .build());
public final ConfigNode<Double> ENTRY_FEE_AMOUNT = node(ConfigNode.builder("entry-fee.amount", Double.class) final ConfigNode<Double> ENTRY_FEE_AMOUNT = node(ConfigNode.builder("entry-fee.amount", Double.class)
.defaultValue(0.0) .defaultValue(0.0)
.name("entryfee-amount") .name("entryfee-amount")
.build()); .build());
public final ConfigNode<Material> ENTRY_FEE_CURRENCY = node(ConfigNode.builder("entry-fee.currency", Material.class) final ConfigNode<Material> ENTRY_FEE_CURRENCY = node(ConfigNode.builder("entry-fee.currency", Material.class)
.defaultValue(Material.AIR) // TODO: Convert from material ID .defaultValue(Material.AIR) // TODO: Convert from material ID
.name("entryfee-currency") .name("entryfee-currency")
.build()); .build());
public final ConfigNode<World.Environment> ENVIRONMENT = node(ConfigNode final ConfigNode<World.Environment> ENVIRONMENT = node(ConfigNode
.builder("environment", World.Environment.class) .builder("environment", World.Environment.class)
.defaultValue(World.Environment.NORMAL) .defaultValue(World.Environment.NORMAL)
.name(null) .name(null)
.build()); .build());
public final ConfigNode<GameMode> GAMEMODE = node(ConfigNode.builder("gamemode", GameMode.class) final ConfigNode<GameMode> GAMEMODE = node(ConfigNode.builder("gamemode", GameMode.class)
.defaultValue(GameMode.SURVIVAL) .defaultValue(GameMode.SURVIVAL)
.name("gamemode") // TODO: Set all gamemodes of players in world to this gamemode // TODO: Set all gamemodes of players in world to this gamemode
.build()); .build());
public final ConfigNode<String> GENERATOR = node(ConfigNode.builder("generator", String.class) final ConfigNode<String> GENERATOR = node(ConfigNode.builder("generator", String.class)
.defaultValue("@error") // this should be set on world creation .defaultValue("@error") // this should be set on world creation
.name(null) .name(null)
.build()); .build());
public final ConfigNode<Boolean> HIDDEN = node(ConfigNode.builder("hidden", Boolean.class) final ConfigNode<Boolean> HIDDEN = node(ConfigNode.builder("hidden", Boolean.class)
.defaultValue(false) .defaultValue(false)
.name("hidden")
.build()); .build());
public final ConfigNode<Boolean> HUNGER = node(ConfigNode.builder("hunger", Boolean.class) final ConfigNode<Boolean> HUNGER = node(ConfigNode.builder("hunger", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("hunger")
.build()); .build());
public final ConfigNode<Boolean> KEEP_SPAWN_IN_MEMORY = node(ConfigNode final ConfigNode<Boolean> KEEP_SPAWN_IN_MEMORY = node(ConfigNode
.builder("keep-spawn-in-memory", Boolean.class) .builder("keep-spawn-in-memory", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("keep-spawn-in-memory")
.onSetValue((oldValue, newValue) -> { .onSetValue((oldValue, newValue) -> {
if (world == null) return; if (world == null) return;
world.getBukkitWorld().peek(world -> world.setKeepSpawnInMemory(newValue)); world.getBukkitWorld().peek(world -> world.setKeepSpawnInMemory(newValue));
}) })
.build()); .build());
public final ConfigNode<Integer> PLAYER_LIMIT = node(ConfigNode.builder("player-limit", Integer.class) final ConfigNode<Integer> PLAYER_LIMIT = node(ConfigNode.builder("player-limit", Integer.class)
.defaultValue(-1) .defaultValue(-1)
.name("player-limit") .name("player-limit")
.build()); .build());
public final ConfigNode<AllowedPortalType> PORTAL_FORM = node(ConfigNode final ConfigNode<AllowedPortalType> PORTAL_FORM = node(ConfigNode
.builder("portal-form", AllowedPortalType.class) .builder("portal-form", AllowedPortalType.class)
.defaultValue(AllowedPortalType.ALL) .defaultValue(AllowedPortalType.ALL)
.name("portal-form")
.build()); .build());
public final ConfigNode<Boolean> PVP = node(ConfigNode.builder("pvp", Boolean.class) final ConfigNode<Boolean> PVP = node(ConfigNode.builder("pvp", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("pvp")
.onSetValue((oldValue, newValue) -> { .onSetValue((oldValue, newValue) -> {
if (world == null) return; if (world == null) return;
world.getBukkitWorld().peek(world -> world.setPVP(newValue)); world.getBukkitWorld().peek(world -> world.setPVP(newValue));
}) })
.build()); .build());
public final ConfigNode<String> RESPAWN_WORLD = node(ConfigNode.builder("respawn-world", String.class) final ConfigNode<String> RESPAWN_WORLD = node(ConfigNode.builder("respawn-world", String.class)
.defaultValue("") .defaultValue("")
.name("respawn-world")
.build()); .build());
public final ConfigNode<Double> SCALE = node(ConfigNode.builder("scale", Double.class) final ConfigNode<Double> SCALE = node(ConfigNode.builder("scale", Double.class)
.defaultValue(1.0) .defaultValue(1.0)
.name("scale")
.build()); .build());
public final ConfigNode<Long> SEED = node(ConfigNode.builder("seed", Long.class) final ConfigNode<Long> SEED = node(ConfigNode.builder("seed", Long.class)
.defaultValue(Long.MIN_VALUE) .defaultValue(Long.MIN_VALUE)
.name(null) .name(null)
.build()); .build());
public final ConfigNode<Location> SPAWN_LOCATION = node(ConfigNode.builder("spawn-location", Location.class) final ConfigNode<Location> SPAWN_LOCATION = node(ConfigNode.builder("spawn-location", Location.class)
.defaultValue(new NullLocation()) .defaultValue(new NullLocation())
.name(null) .name(null)
.onSetValue((oldValue, newValue) -> { .onSetValue((oldValue, newValue) -> {
@ -182,7 +167,7 @@ public class WorldConfigNodes {
}) })
.build()); .build());
public final ConfigNode<Boolean> SPAWNING_ANIMALS = node(ConfigNode.builder("spawning.animals.spawn", Boolean.class) final ConfigNode<Boolean> SPAWNING_ANIMALS = node(ConfigNode.builder("spawning.animals.spawn", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("spawning-animals") .name("spawning-animals")
.onSetValue((oldValue, newValue) -> { .onSetValue((oldValue, newValue) -> {
@ -191,7 +176,7 @@ public class WorldConfigNodes {
}) })
.build()); .build());
public final ConfigNode<Integer> SPAWNING_ANIMALS_TICKS = node(ConfigNode final ConfigNode<Integer> SPAWNING_ANIMALS_TICKS = node(ConfigNode
.builder("spawning.animals.tick-rate", Integer.class) .builder("spawning.animals.tick-rate", Integer.class)
.defaultValue(-1) .defaultValue(-1)
.name("spawning-animals-ticks") .name("spawning-animals-ticks")
@ -201,13 +186,13 @@ public class WorldConfigNodes {
}) })
.build()); .build());
public final ConfigNode<List> SPAWNING_ANIMALS_EXCEPTIONS = node(ConfigNode final ConfigNode<List> SPAWNING_ANIMALS_EXCEPTIONS = node(ConfigNode
.builder("spawning.animals.exceptions", List.class) .builder("spawning.animals.exceptions", List.class)
.defaultValue(new ArrayList<>()) .defaultValue(new ArrayList<>())
.name("spawning-animals-exceptions") .name("spawning-animals-exceptions")
.build()); .build());
public final ConfigNode<Boolean> SPAWNING_MONSTERS = node(ConfigNode final ConfigNode<Boolean> SPAWNING_MONSTERS = node(ConfigNode
.builder("spawning.monsters.spawn", Boolean.class) .builder("spawning.monsters.spawn", Boolean.class)
.defaultValue(true) .defaultValue(true)
.name("spawning-monsters") .name("spawning-monsters")
@ -217,7 +202,7 @@ public class WorldConfigNodes {
}) })
.build()); .build());
public final ConfigNode<Integer> SPAWNING_MONSTERS_TICKS = node(ConfigNode final ConfigNode<Integer> SPAWNING_MONSTERS_TICKS = node(ConfigNode
.builder("spawning.monsters.tick-rate", Integer.class) .builder("spawning.monsters.tick-rate", Integer.class)
.defaultValue(-1) .defaultValue(-1)
.name("spawning-monsters-ticks") .name("spawning-monsters-ticks")
@ -227,18 +212,17 @@ public class WorldConfigNodes {
}) })
.build()); .build());
public final ConfigNode<List> SPAWNING_MONSTERS_EXCEPTIONS = node(ConfigNode final ConfigNode<List> SPAWNING_MONSTERS_EXCEPTIONS = node(ConfigNode
.builder("spawning.monsters.exceptions", List.class) .builder("spawning.monsters.exceptions", List.class)
.defaultValue(new ArrayList<>()) .defaultValue(new ArrayList<>())
.name("spawning-monsters-exceptions") .name("spawning-monsters-exceptions")
.build()); .build());
public final ConfigNode<List> WORLD_BLACKLIST = node(ConfigNode.builder("world-blacklist", List.class) final ConfigNode<List> WORLD_BLACKLIST = node(ConfigNode.builder("world-blacklist", List.class)
.defaultValue(new ArrayList<>()) .defaultValue(new ArrayList<>())
.name("world-blacklist")
.build()); .build());
public final ConfigNode<Double> VERSION = node(ConfigNode.builder("version", Double.class) final ConfigNode<Double> VERSION = node(ConfigNode.builder("version", Double.class)
.defaultValue(CONFIG_VERSION) .defaultValue(CONFIG_VERSION)
.name(null) .name(null)
.build()); .build());