#pragma once #include "Properties.h" #include "Property.h" #include #include #include #include #include using std::string; using std::string_view; using std::unordered_map; namespace Feather::Config { class ServerProperties : public Properties { public: Property onlineMode = Property("online-mode", true); Property preventProxyConnections = Property("prevent-proxy-connections", false); Property serverIp = Property("server-ip", ""); Property spawnAnimals = Property("spawn-animals", true); Property spawnNpcs = Property("spawn-npcs", true); Property pvp = Property("pvp", true); Property allowFlight = Property("allow-flight", false); Property resourcePack = Property("resource-pack", ""); Property motd = Property("motd", "A Minecraft Server"); Property forceGameMode = Property("force-gamemode", false); Property enforceWhitelist = Property("enforce-whitelist", false); //Property difficulty = Property("difficulty", DedicatedServerProperties.dispatchNumberOrString(Difficulty::byId, Difficulty::byName), Difficulty::getKey, Difficulty.EASY); //Property gamemode = Property("gamemode", DedicatedServerProperties.dispatchNumberOrString(GameType::byId, GameType::byName), GameType::getName, GameType.SURVIVAL); Property levelName = Property("level-name", "world"); Property serverPort = Property("server-port", 25565); Property maxBuildHeight = Property("max-build-height", [](int n) { return std::clamp((n + 8) / 16 * 16, 64, 256); }, 256); // round to nearest 16, clamp to range [64, 256] // (REMOVED) Property announcePlayerAchievements = Property("announce-player-achievements"); Property enableQuery = Property("enable-query", false); Property queryPort = Property("query.port", 25565); Property enableRcon = Property("enable-rcon", false); Property rconPort = Property("rcon.port", 25575); Property rconPassword = Property("rcon.password", ""); // (REMOVED) Property resourcePackHash = Property("resource-pack-hash"); Property resourcePackSha1 = Property("resource-pack-sha1", ""); Property hardcore = Property("hardcore", false); Property allowNether = Property("allow-nether", true); Property spawnMonsters = Property("spawn-monsters", true); Property snooperEnabled = Property("snooper-enabled", true); Property useNativeTransport = Property("use-native-transport", true); Property enableCommandBlock = Property("enable-command-block", false); Property spawnProtection = Property("spawn-protection", 16); Property opPermissionLevel = Property("op-permission-level", 4); Property functionPermissionLevel = Property("function-permission-level", 2); Property maxTickTime = Property("max-tick-time");//, TimeUnit.MINUTES.toMillis(1L)); Property viewDistance = Property("view-distance", 10); Property maxPlayers = Property("max-players", 20); Property networkCompressionThreshold = Property("network-compression-threshold", 256); Property broadcastRconToOps = Property("broadcast-rcon-to-ops", true); Property broadcastConsoleToOps = Property("broadcast-console-to-ops", true); Property maxWorldSize = Property("max-world-size", [](int n) { return std::clamp(n, 1, 29999984); }, 29999984); Property syncChunkWrites = Property("sync-chunk-writes", true); Property enableJmxMonitoring = Property("enable-jmx-monitoring", false); Property enableStatus = Property("enable-status", true); Property entityBroadcastRangePercentage = Property("entity-broadcast-range-percentage", [](int n) { return std::clamp(n, 10, 1000); }, 100); /*mutable*/ Property playerIdleTimeout = Property("player-idle-timeout", 0); /*mutable*/ Property whiteList = Property("white-list", false); //Property worldGenSettings = WorldGenSettings.create(properties); ServerProperties(const char* path) : path(path) { Load(); onlineMode.Init(this); preventProxyConnections.Init(this); serverIp.Init(this); spawnAnimals.Init(this); spawnNpcs.Init(this); pvp.Init(this); allowFlight.Init(this); resourcePack.Init(this); motd.Init(this); forceGameMode.Init(this); enforceWhitelist.Init(this); levelName.Init(this); serverPort.Init(this); maxBuildHeight.Init(this); //announcePlayerAchievements.Init(this); enableQuery.Init(this); queryPort.Init(this); enableRcon.Init(this); rconPort.Init(this); rconPassword.Init(this); //resourcePackHash.Init(this); resourcePackSha1.Init(this); hardcore.Init(this); allowNether.Init(this); spawnMonsters.Init(this); snooperEnabled.Init(this); useNativeTransport.Init(this); enableCommandBlock.Init(this); spawnProtection.Init(this); opPermissionLevel.Init(this); functionPermissionLevel.Init(this); maxTickTime.Init(this); viewDistance.Init(this); maxPlayers.Init(this); networkCompressionThreshold.Init(this); broadcastRconToOps.Init(this); broadcastConsoleToOps.Init(this); maxWorldSize.Init(this); syncChunkWrites.Init(this); enableJmxMonitoring.Init(this); enableStatus.Init(this); entityBroadcastRangePercentage.Init(this); playerIdleTimeout.Init(this); whiteList.Init(this); } void Load(); void Save(); private: const char* path; }; }