mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 03:55:14 +01:00
Migrate paper log ips option to new server.properties option
This commit is contained in:
parent
9624451ffd
commit
6be43952eb
@ -11,6 +11,7 @@ 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
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
@ -440,10 +441,10 @@ index 0000000000000000000000000000000000000000..9ef6712c70fcd8912a79f3f61e351aac
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4b3bb5fad1d80c9baea20ca224663b1ebc2b83e9
|
||||
index 0000000000000000000000000000000000000000..dcfc085d355410723dbeef369579e1875a7a997b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -0,0 +1,294 @@
|
||||
@@ -0,0 +1,293 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import co.aikar.timings.MinecraftTimings;
|
||||
@ -466,7 +467,7 @@ index 0000000000000000000000000000000000000000..4b3bb5fad1d80c9baea20ca224663b1e
|
||||
+
|
||||
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
|
||||
+public class GlobalConfiguration extends ConfigurationPart {
|
||||
+ static final int CURRENT_VERSION = 28;
|
||||
+ static final int CURRENT_VERSION = 29;
|
||||
+ private static GlobalConfiguration instance;
|
||||
+ public static GlobalConfiguration get() {
|
||||
+ return instance;
|
||||
@ -611,7 +612,6 @@ index 0000000000000000000000000000000000000000..4b3bb5fad1d80c9baea20ca224663b1e
|
||||
+ public Logging logging;
|
||||
+
|
||||
+ public class Logging extends ConfigurationPart {
|
||||
+ public boolean logPlayerIpAddresses = true;
|
||||
+ public boolean deobfuscateStacktraces = true;
|
||||
+ }
|
||||
+
|
||||
@ -951,10 +951,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2d3068b7748032342edd81e6ea4a7c08988fb28d
|
||||
index 0000000000000000000000000000000000000000..9b5c2abaa28fa60cedd9f0111e5eb018f93a0561
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -0,0 +1,445 @@
|
||||
@@ -0,0 +1,450 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.google.common.base.Suppliers;
|
||||
@ -974,6 +974,7 @@ index 0000000000000000000000000000000000000000..2d3068b7748032342edd81e6ea4a7c08
|
||||
+import io.papermc.paper.configuration.serializer.registry.RegistryValueSerializer;
|
||||
+import io.papermc.paper.configuration.transformation.Transformations;
|
||||
+import io.papermc.paper.configuration.transformation.global.LegacyPaperConfig;
|
||||
+import io.papermc.paper.configuration.transformation.global.versioned.V29_LogIPs;
|
||||
+import io.papermc.paper.configuration.transformation.world.FeatureSeedsGeneration;
|
||||
+import io.papermc.paper.configuration.transformation.world.LegacyPaperWorldConfig;
|
||||
+import io.papermc.paper.configuration.transformation.world.versioned.V29_ZeroWorldHeight;
|
||||
@ -1212,8 +1213,12 @@ index 0000000000000000000000000000000000000000..2d3068b7748032342edd81e6ea4a7c08
|
||||
+ for (NodePath path : RemovedConfigurations.REMOVED_GLOBAL_PATHS) {
|
||||
+ builder.addAction(path, TransformAction.remove());
|
||||
+ }
|
||||
+ // ADD FUTURE TRANSFORMS TO builder HERE
|
||||
+ builder.build().apply(node);
|
||||
+
|
||||
+ final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
||||
+ V29_LogIPs.apply(versionedBuilder);
|
||||
+ // ADD FUTURE VERSIONED TRANSFORMS TO versionedBuilder HERE
|
||||
+ versionedBuilder.build().apply(node);
|
||||
+ }
|
||||
+
|
||||
+ private static final List<Transformations.DefaultsAware> DEFAULT_AWARE_TRANSFORMATIONS = List.of(FeatureSeedsGeneration::apply);
|
||||
@ -3373,6 +3378,58 @@ index 0000000000000000000000000000000000000000..ef0e834c164b0ccc1a61b349348e6799
|
||||
+ });
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/global/versioned/V29_LogIPs.java b/src/main/java/io/papermc/paper/configuration/transformation/global/versioned/V29_LogIPs.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f250ea5acd2edce924ee52b8ec16a23261f5e90d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/global/versioned/V29_LogIPs.java
|
||||
@@ -0,0 +1,46 @@
|
||||
+package io.papermc.paper.configuration.transformation.global.versioned;
|
||||
+
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.spongepowered.configurate.ConfigurateException;
|
||||
+import org.spongepowered.configurate.ConfigurationNode;
|
||||
+import org.spongepowered.configurate.NodePath;
|
||||
+import org.spongepowered.configurate.transformation.ConfigurationTransformation;
|
||||
+import org.spongepowered.configurate.transformation.TransformAction;
|
||||
+
|
||||
+import java.util.Properties;
|
||||
+
|
||||
+import static org.spongepowered.configurate.NodePath.path;
|
||||
+
|
||||
+public class V29_LogIPs implements TransformAction {
|
||||
+
|
||||
+ private static final int VERSION = 29;
|
||||
+ private static final NodePath PATH = path("logging", "log-player-ip-addresses");
|
||||
+ private static final V29_LogIPs INSTANCE = new V29_LogIPs();
|
||||
+
|
||||
+ private V29_LogIPs() {
|
||||
+ }
|
||||
+
|
||||
+ public static void apply(ConfigurationTransformation.VersionedBuilder builder) {
|
||||
+ builder.addVersion(VERSION, ConfigurationTransformation.builder().addAction(PATH, INSTANCE).build());
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public Object[] visitPath(final NodePath path, final ConfigurationNode value) throws ConfigurateException {
|
||||
+ DedicatedServer server = ((DedicatedServer) MinecraftServer.getServer());
|
||||
+
|
||||
+ boolean val = value.getBoolean(server.settings.getProperties().logIPs);
|
||||
+ server.settings.update((config) -> {
|
||||
+ Properties newProps = new Properties(config.properties);
|
||||
+ newProps.setProperty("log-ips", String.valueOf(val));
|
||||
+ return config.reload(server.registryAccess(), newProps, server.options);
|
||||
+ });
|
||||
+
|
||||
+ value.raw(null);
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/FeatureSeedsGeneration.java b/src/main/java/io/papermc/paper/configuration/transformation/world/FeatureSeedsGeneration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1326aae8f95ab11f840abdee0c8c7a557705fd73
|
||||
|
@ -15753,7 +15753,7 @@ index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 4b3bb5fad1d80c9baea20ca224663b1ebc2b83e9..3a5abb89d3742a6f38799c183a098947686e16ab 100644
|
||||
index dcfc085d355410723dbeef369579e1875a7a997b..8f82d5e1e263035eb23d878ffdc70c445933a207 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -25,6 +25,45 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
@ -9,7 +9,7 @@ For servers with multiple IP's, ability to bind to a specific interface.
|
||||
public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index dc274aa4757f7426fb494528f6e62cc4ede7455c..97e9a3e567a53c21aff8c525259b9dd83f222ebf 100644
|
||||
index 20d02405b8e6476b11a8c8518c9a3949d3df11a4..bdf520c32847658fefaf2bde33bac16ea807002f 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -109,6 +109,8 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
|
@ -9,7 +9,7 @@ on harddrives.
|
||||
-DPaper.enable-sync-chunk-writes=true to enable
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index 97e9a3e567a53c21aff8c525259b9dd83f222ebf..0d0ed4cb50364828d0a028ee69654e23b3b8d913 100644
|
||||
index bdf520c32847658fefaf2bde33bac16ea807002f..c5598adb8cbcbcf7277c2fd4dd72c243d44d9700 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -145,7 +145,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
|
@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
|
||||
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 3a5abb89d3742a6f38799c183a098947686e16ab..3bc7230ca62ebe3426da293e436a962bb0134f85 100644
|
||||
index 8f82d5e1e263035eb23d878ffdc70c445933a207..97a9ce438afc9094dca4a44cb25b37d5f88dcf43 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -286,13 +286,26 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -285,13 +285,26 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public Misc misc;
|
||||
|
||||
public class Misc extends ConfigurationPart {
|
||||
|
@ -1,22 +1,9 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Sat, 23 Sep 2023 01:49:39 -0400
|
||||
Subject: [PATCH] Support Paper ip address config + add missing logs
|
||||
Subject: [PATCH] Add missing logs for log-ips config option
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index dbccbcb9b44e4efacdf53c2d161115cc20b36cff..18348d01003c8b3299ae3d5292fd9e50f9153cce 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -643,7 +643,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
||||
@Override
|
||||
public boolean logIPs() {
|
||||
- return this.getProperties().logIPs;
|
||||
+ return this.getProperties().logIPs && io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses; // Paper
|
||||
}
|
||||
|
||||
protected boolean convertOldUsers() {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
|
||||
index d4f5a98a0b1ca9f2a8baa6e0b27353df94d1f333..8f4a964a0863b1be834c1ea1e3d49092516f9258 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
|
Loading…
Reference in New Issue
Block a user