Added settings

This commit is contained in:
Nanit 2022-01-24 17:14:12 +02:00
parent 26c8dbba20
commit 9f3fa80eef
2 changed files with 28 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import org.spongepowered.configurate.serialize.TypeSerializerCollection;
import org.spongepowered.configurate.yaml.YamlConfigurationLoader; import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
import ru.nanit.limbo.server.data.*; import ru.nanit.limbo.server.data.*;
import ru.nanit.limbo.util.Colors; import ru.nanit.limbo.util.Colors;
import ru.nanit.limbo.world.Location;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -41,8 +42,11 @@ public final class LimboConfig {
private int maxPlayers; private int maxPlayers;
private PingData pingData; private PingData pingData;
private boolean useSchematic;
private Path schematicPath;
private String dimensionType; private String dimensionType;
private Position spawnPosition; private Location spawnPosition;
private int gameMode; private int gameMode;
private boolean useBrandName; private boolean useBrandName;
@ -78,14 +82,18 @@ public final class LimboConfig {
address = conf.node("bind").get(SocketAddress.class); address = conf.node("bind").get(SocketAddress.class);
maxPlayers = conf.node("maxPlayers").getInt(); maxPlayers = conf.node("maxPlayers").getInt();
pingData = conf.node("ping").get(PingData.class); pingData = conf.node("ping").get(PingData.class);
useSchematic = conf.node("world", "enable").getBoolean(false);
dimensionType = conf.node("dimension").getString(); dimensionType = conf.node("dimension").getString();
spawnPosition = conf.node("spawnPosition").get(Position.class); spawnPosition = conf.node("spawnPosition").get(Location.class);
gameMode = conf.node("gameMode").getInt(); gameMode = conf.node("gameMode").getInt();
useBrandName = conf.node("brandName", "enable").getBoolean(); useBrandName = conf.node("brandName", "enable").getBoolean();
useJoinMessage = conf.node("joinMessage", "enable").getBoolean(); useJoinMessage = conf.node("joinMessage", "enable").getBoolean();
useBossBar = conf.node("bossBar", "enable").getBoolean(); useBossBar = conf.node("bossBar", "enable").getBoolean();
useTitle = conf.node("title", "enable").getBoolean(); useTitle = conf.node("title", "enable").getBoolean();
if (useSchematic)
schematicPath = Paths.get(conf.node("world", "path").getString("./spawn.schem"));
if(useBrandName) if(useBrandName)
brandName = conf.node("brandName", "content").getString(); brandName = conf.node("brandName", "content").getString();
@ -130,7 +138,7 @@ public final class LimboConfig {
.register(PingData.class, new PingData.Serializer()) .register(PingData.class, new PingData.Serializer())
.register(BossBar.class, new BossBar.Serializer()) .register(BossBar.class, new BossBar.Serializer())
.register(Title.class, new Title.Serializer()) .register(Title.class, new Title.Serializer())
.register(Position.class, new Position.Serializer()) .register(Location.class, new Location.Serializer())
.build(); .build();
} }
@ -146,11 +154,19 @@ public final class LimboConfig {
return pingData; return pingData;
} }
public boolean isUseSchematic() {
return useSchematic;
}
public Path getSchematicPath() {
return schematicPath;
}
public String getDimensionType() { public String getDimensionType() {
return dimensionType; return dimensionType;
} }
public Position getSpawnPosition() { public Location getSpawnPosition() {
return spawnPosition; return spawnPosition;
} }

View File

@ -16,6 +16,14 @@ ping:
description: '{"text": "&9NanoLimbo"}' description: '{"text": "&9NanoLimbo"}'
version: 'NanoLimbo' version: 'NanoLimbo'
# World settings
world:
# Enable schematic loading.
# If false, then player will be spawned in the void
enable: false
# Relative path to schematic file
path: "./spawn.schem"
# Available dimensions: OVERWORLD, NETHER, THE_END # Available dimensions: OVERWORLD, NETHER, THE_END
dimension: THE_END dimension: THE_END