1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -41,10 +44,15 @@
import net.minecraft.world.level.levelgen.presets.WorldPresets;
import org.slf4j.Logger;
+// CraftBukkit start
+import joptsimple.OptionSet;
+// CraftBukkit end
+
public class DedicatedServerProperties extends Settings<DedicatedServerProperties> {
static final Logger LOGGER = LogUtils.getLogger();
private static final Pattern SHA1 = Pattern.compile("^[a-fA-F0-9]{40}$");
private static final Splitter COMMA_SPLITTER = Splitter.on(',').trimResults();
+ public final boolean debug = this.get("debug", false); // CraftBukkit
public final boolean onlineMode = this.get("online-mode", true);
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
public final String serverIp = this.get("server-ip", "");
@@ -101,9 +108,53 @@
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
public final WorldOptions worldOptions;
- public DedicatedServerProperties(Properties properties) {
- super(properties);
- String string = this.get("level-seed", "");
+ // CraftBukkit start
+ public DedicatedServerProperties(Properties properties, OptionSet optionset) {
+ super(properties, optionset);
+ // CraftBukkit end
+ this.difficulty = (Difficulty) this.get("difficulty", dispatchNumberOrString(Difficulty::byId, Difficulty::byName), Difficulty::getKey, Difficulty.EASY);
+ this.gamemode = (GameType) this.get("gamemode", dispatchNumberOrString(GameType::byId, GameType::byName), GameType::getName, GameType.SURVIVAL);
+ this.levelName = this.get("level-name", "world");
+ this.serverPort = this.get("server-port", 25565);
+ this.announcePlayerAchievements = this.getLegacyBoolean("announce-player-achievements");
+ this.enableQuery = this.get("enable-query", false);
+ this.queryPort = this.get("query.port", 25565);
+ this.enableRcon = this.get("enable-rcon", false);
+ this.rconPort = this.get("rcon.port", 25575);
+ this.rconPassword = this.get("rcon.password", "");
+ this.hardcore = this.get("hardcore", false);
+ this.allowNether = this.get("allow-nether", true);
+ this.spawnMonsters = this.get("spawn-monsters", true);
+ this.useNativeTransport = this.get("use-native-transport", true);
+ this.enableCommandBlock = this.get("enable-command-block", false);
+ this.spawnProtection = this.get("spawn-protection", 16);
+ this.opPermissionLevel = this.get("op-permission-level", 4);
+ this.functionPermissionLevel = this.get("function-permission-level", 2);
+ this.maxTickTime = this.get("max-tick-time", TimeUnit.MINUTES.toMillis(1L));
+ this.maxChainedNeighborUpdates = this.get("max-chained-neighbor-updates", 1000000);
+ this.rateLimitPacketsPerSecond = this.get("rate-limit", 0);
+ this.viewDistance = this.get("view-distance", 10);
+ this.simulationDistance = this.get("simulation-distance", 10);
+ this.maxPlayers = this.get("max-players", 20);
+ this.networkCompressionThreshold = this.get("network-compression-threshold", 256);
+ this.broadcastRconToOps = this.get("broadcast-rcon-to-ops", true);
+ this.broadcastConsoleToOps = this.get("broadcast-console-to-ops", true);
+ this.maxWorldSize = this.get("max-world-size", (integer) -> {
+ return Mth.clamp(integer, 1, 29999984);
+ }, 29999984);
+ this.syncChunkWrites = this.get("sync-chunk-writes", true);
+ this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
+ this.enableStatus = this.get("enable-status", true);
+ this.hideOnlinePlayers = this.get("hide-online-players", false);
+ this.entityBroadcastRangePercentage = this.get("entity-broadcast-range-percentage", (integer) -> {
+ return Mth.clamp(integer, 10, 1000);
+ }, 100);
+ this.textFilteringConfig = this.get("text-filtering-config", "");
+ this.playerIdleTimeout = this.getMutable("player-idle-timeout", 0);
+ this.whiteList = this.getMutable("white-list", false);
+ this.enforceSecureProfile = this.get("enforce-secure-profile", true);
+ this.logIPs = this.get("log-ips", true);
+ String s = this.get("level-seed", "");
boolean flag = this.get("generate-structures", true);
long l = WorldOptions.parseSeed(string).orElse(WorldOptions.randomSeed());
this.worldOptions = new WorldOptions(l, flag, false);
@@ -125,13 +168,15 @@
);
}
- public static DedicatedServerProperties fromFile(Path path) {
- return new DedicatedServerProperties(loadFromFile(path));
+ // CraftBukkit start
+ public static DedicatedServerProperties fromFile(Path path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadFromFile(path), optionset);
}
@Override
- protected DedicatedServerProperties reload(RegistryAccess registryAccess, Properties properties) {
- return new DedicatedServerProperties(properties);
+ protected DedicatedServerProperties reload(RegistryAccess iregistrycustom, Properties properties, OptionSet optionset) {
+ return new DedicatedServerProperties(properties, optionset);
+ // CraftBukkit end
}
@Nullable
|