Implement world blacklist config

This commit is contained in:
Ben Woo 2023-08-31 10:47:49 +08:00
parent c569bc797f
commit 6888783d01
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8
2 changed files with 18 additions and 0 deletions

View File

@ -7,6 +7,8 @@ import org.bukkit.configuration.ConfigurationSection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class WorldConfig {
private final WorldConfigNodes configNodes;
private final ConfigurationSectionHandle configHandle;
@ -44,4 +46,12 @@ public class WorldConfig {
public boolean isHidden() {
return configHandle.get(configNodes.HIDDEN);
}
public List<String> getWorldBlacklist() {
return (List<String>) configHandle.get(configNodes.WORLD_BLACKLIST);
}
public void setWorldBlacklist(List<String> worldBlacklist) {
configHandle.set(configNodes.WORLD_BLACKLIST, worldBlacklist);
}
}

View File

@ -10,6 +10,9 @@ import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.World;
import java.util.ArrayList;
import java.util.List;
public class WorldConfigNodes {
private static final NodeSerializer<?> ENUM_NODE_SERIALIZER = new EnumNodeSerializer<>();
@ -126,6 +129,11 @@ public class WorldConfigNodes {
.name("seed")
.build());
public final ConfigNode<List> WORLD_BLACKLIST = node(ConfigNode.builder("world-blacklist", List.class)
.defaultValue(new ArrayList<>())
.name("world-blacklist")
.build());
//todo: color and style
//todo: spawning
//todo: entryfee