Paper config files

== AT ==
public org.spigotmc.SpigotWorldConfig getBoolean(Ljava/lang/String;Z)Z
public org.spigotmc.SpigotWorldConfig getDouble(Ljava/lang/String;)D
public org.spigotmc.SpigotWorldConfig getDouble(Ljava/lang/String;D)D
public org.spigotmc.SpigotWorldConfig getInt(Ljava/lang/String;)I
public org.spigotmc.SpigotWorldConfig getInt(Ljava/lang/String;I)I
public org.spigotmc.SpigotWorldConfig getList(Ljava/lang/String;Ljava/lang/Object;)Ljava/util/List;
public org.spigotmc.SpigotWorldConfig getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
public net.minecraft.server.dedicated.DedicatedServerProperties reload(Lnet/minecraft/core/RegistryAccess;Ljava/util/Properties;Ljoptsimple/OptionSet;)Lnet/minecraft/server/dedicated/DedicatedServerProperties;
public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES
This commit is contained in:
Jake Potrebic
2022-06-08 22:20:16 -07:00
parent e954a5a260
commit 769119f918
81 changed files with 4997 additions and 103 deletions

View File

@@ -132,7 +132,7 @@
thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start();
@@ -126,13 +194,18 @@
@@ -126,13 +194,22 @@
this.setPreventProxyConnections(dedicatedserverproperties.preventProxyConnections);
this.setLocalIp(dedicatedserverproperties.serverIp);
}
@@ -141,6 +141,10 @@
+ org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
+ org.spigotmc.SpigotConfig.registerCommands();
+ // Spigot end
+ // Paper start - initialize global and world-defaults configuration
+ this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
+ this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
+ // Paper end - initialize global and world-defaults configuration
this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
@@ -152,17 +156,16 @@
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null;
@@ -155,11 +228,24 @@
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
@@ -156,10 +233,23 @@
return false;
}
+
+ // CraftBukkit start
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // Spigot - moved up
+ this.server.loadPlugins();
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
+ // CraftBukkit end
+
if (!this.usesAuthentication()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -178,7 +181,7 @@
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
@@ -170,7 +256,7 @@
@@ -170,7 +260,7 @@
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
} else {
@@ -187,7 +190,7 @@
this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList());
this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME);
long i = Util.getNanos();
@@ -178,13 +264,13 @@
@@ -178,13 +268,13 @@
SkullBlockEntity.setup(this.services, this);
GameProfileCache.setUsesAuthentication(this.usesAuthentication());
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
@@ -203,7 +206,7 @@
}
if (dedicatedserverproperties.enableQuery) {
@@ -197,7 +283,7 @@
@@ -197,7 +287,7 @@
this.rconThread = RconThread.create(this);
}
@@ -212,7 +215,7 @@
Thread thread1 = new Thread(new ServerWatchdog(this));
thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(DedicatedServer.LOGGER));
@@ -293,6 +379,7 @@
@@ -293,6 +383,7 @@
this.queryThreadGs4.stop();
}
@@ -220,7 +223,7 @@
}
@Override
@@ -302,8 +389,8 @@
@@ -302,8 +393,8 @@
}
@Override
@@ -231,7 +234,7 @@
}
public void handleConsoleInput(String command, CommandSourceStack commandSource) {
@@ -311,12 +398,22 @@
@@ -311,12 +402,22 @@
}
public void handleConsoleInputs() {
@@ -255,7 +258,7 @@
}
@Override
@@ -383,7 +480,7 @@
@@ -383,7 +484,7 @@
@Override
public boolean isUnderSpawnProtection(ServerLevel world, BlockPos pos, Player player) {
@@ -264,7 +267,7 @@
return false;
} else if (this.getPlayerList().getOps().isEmpty()) {
return false;
@@ -541,16 +638,52 @@
@@ -541,16 +642,52 @@
@Override
public String getPluginNames() {
@@ -321,7 +324,7 @@
}
public void storeUsingWhiteList(boolean useWhitelist) {
@@ -660,4 +793,15 @@
@@ -660,4 +797,15 @@
}
}
}

View File

@@ -43,19 +43,20 @@
Properties properties;
Properties properties1;
@@ -97,6 +117,11 @@
@@ -97,6 +117,12 @@
public void store(Path path) {
try {
+ // CraftBukkit start - Don't attempt writing to file if it's read only
+ if (path.toFile().exists() && !path.toFile().canWrite()) {
+ Settings.LOGGER.warn("Can not write to file {}, skipping.", path); // Paper - log message file is read-only
+ return;
+ }
+ // CraftBukkit end
BufferedWriter bufferedwriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
try {
@@ -125,7 +150,7 @@
@@ -125,7 +151,7 @@
private static <V extends Number> Function<String, V> wrapNumberDeserializer(Function<String, V> parser) {
return (s) -> {
try {
@@ -64,7 +65,7 @@
} catch (NumberFormatException numberformatexception) {
return null;
}
@@ -144,7 +169,7 @@
@@ -144,7 +170,7 @@
@Nullable
public String getStringRaw(String key) {
@@ -73,7 +74,7 @@
}
@Nullable
@@ -160,10 +185,20 @@
@@ -160,10 +186,20 @@
}
protected <V> V get(String key, Function<String, V> parser, Function<V, String> stringifier, V fallback) {
@@ -97,7 +98,7 @@
return v1;
}
@@ -172,7 +207,7 @@
@@ -172,7 +208,7 @@
V v1 = MoreObjects.firstNonNull(s1 != null ? parser.apply(s1) : null, fallback);
this.properties.put(key, stringifier.apply(v1));
@@ -106,7 +107,7 @@
}
protected <V> V get(String key, Function<String, V> parser, UnaryOperator<V> parsedTransformer, Function<V, String> stringifier, V fallback) {
@@ -236,7 +271,7 @@
@@ -236,7 +272,7 @@
return properties;
}
@@ -115,7 +116,7 @@
public class MutableValue<V> implements Supplier<V> {
@@ -244,7 +279,7 @@
@@ -244,7 +280,7 @@
private final V value;
private final Function<V, String> serializer;
@@ -124,7 +125,7 @@
this.key = s;
this.value = object;
this.serializer = function;
@@ -258,7 +293,7 @@
@@ -258,7 +294,7 @@
Properties properties = Settings.this.cloneProperties();
properties.put(this.key, this.serializer.apply(value));