From e641795ea80613ee05a492c3b68af8f42eb29b08 Mon Sep 17 00:00:00 2001 From: masmc05 Date: Sat, 2 Mar 2024 20:26:30 +0200 Subject: [PATCH] Merge upstream and rename class to ServerInfo --- ...> 0464-Add-paper-version-util-class.patch} | 20 +++++++------- ...> 1048-Add-paper-version-util-class.patch} | 27 +++++++++---------- 2 files changed, 22 insertions(+), 25 deletions(-) rename patches/api/{0463-Add-paper-version-util-class.patch => 0464-Add-paper-version-util-class.patch} (87%) rename patches/server/{1046-Add-paper-version-util-class.patch => 1048-Add-paper-version-util-class.patch} (87%) diff --git a/patches/api/0463-Add-paper-version-util-class.patch b/patches/api/0464-Add-paper-version-util-class.patch similarity index 87% rename from patches/api/0463-Add-paper-version-util-class.patch rename to patches/api/0464-Add-paper-version-util-class.patch index 6002781af0..7d4ca8aa53 100644 --- a/patches/api/0463-Add-paper-version-util-class.patch +++ b/patches/api/0464-Add-paper-version-util-class.patch @@ -4,11 +4,11 @@ Date: Fri, 16 Feb 2024 14:13:30 +0200 Subject: [PATCH] Add paper version util class -diff --git a/src/main/java/io/papermc/paper/util/PaperServerInfo.java b/src/main/java/io/papermc/paper/util/PaperServerInfo.java +diff --git a/src/main/java/io/papermc/paper/util/ServerInfo.java b/src/main/java/io/papermc/paper/util/ServerInfo.java new file mode 100644 -index 0000000000000000000000000000000000000000..36d71c598529c77ee0c1012cabfa0ebd4a1692db +index 0000000000000000000000000000000000000000..cf39052c7d9f152313762e928fb49c5e3cd22dbc --- /dev/null -+++ b/src/main/java/io/papermc/paper/util/PaperServerInfo.java ++++ b/src/main/java/io/papermc/paper/util/ServerInfo.java @@ -0,0 +1,98 @@ +package io.papermc.paper.util; + @@ -21,11 +21,11 @@ index 0000000000000000000000000000000000000000..36d71c598529c77ee0c1012cabfa0ebd + * A utility class to get information about the server + * Works even before Bukkit is initialized (e.g. on bootstrap) + */ -+public class PaperServerInfo { -+ private PaperServerInfo() { ++public class ServerInfo { ++ private ServerInfo() { + throw new UnsupportedOperationException("This class cannot be instantiated"); + } -+ private static final PaperServerInfoProvider provider = Services.service(PaperServerInfoProvider.class).orElseThrow(); ++ private static final ServerInfoProvider provider = Services.service(ServerInfoProvider.class).orElseThrow(); + + /** + * Get the version of the server @@ -108,11 +108,11 @@ index 0000000000000000000000000000000000000000..36d71c598529c77ee0c1012cabfa0ebd + return provider.isImplementing(api); + } +} -diff --git a/src/main/java/io/papermc/paper/util/PaperServerInfoProvider.java b/src/main/java/io/papermc/paper/util/PaperServerInfoProvider.java +diff --git a/src/main/java/io/papermc/paper/util/ServerInfoProvider.java b/src/main/java/io/papermc/paper/util/ServerInfoProvider.java new file mode 100644 -index 0000000000000000000000000000000000000000..79ce6cfafc9d05b696c7bab1d84c8a5455acf162 +index 0000000000000000000000000000000000000000..cee83c849668c79d0aca1e4e2b38698b67f5e948 --- /dev/null -+++ b/src/main/java/io/papermc/paper/util/PaperServerInfoProvider.java ++++ b/src/main/java/io/papermc/paper/util/ServerInfoProvider.java @@ -0,0 +1,72 @@ +package io.papermc.paper.util; + @@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..79ce6cfafc9d05b696c7bab1d84c8a54 +/** + * A utility class to get information about the server + */ -+public interface PaperServerInfoProvider { ++public interface ServerInfoProvider { + /** + * Get the version of the server + * @return the version of the server (e.g. "1.20.4", "1.20.2 Pre-release 2", "23w31a") diff --git a/patches/server/1046-Add-paper-version-util-class.patch b/patches/server/1048-Add-paper-version-util-class.patch similarity index 87% rename from patches/server/1046-Add-paper-version-util-class.patch rename to patches/server/1048-Add-paper-version-util-class.patch index c679870553..34da484ddd 100644 --- a/patches/server/1046-Add-paper-version-util-class.patch +++ b/patches/server/1048-Add-paper-version-util-class.patch @@ -4,21 +4,19 @@ Date: Fri, 16 Feb 2024 14:13:29 +0200 Subject: [PATCH] Add paper version util class -diff --git a/src/main/java/io/papermc/paper/util/misc/PaperServerInfoProviderImpl.java b/src/main/java/io/papermc/paper/util/misc/PaperServerInfoProviderImpl.java +diff --git a/src/main/java/io/papermc/paper/util/misc/ServerInfoProviderImpl.java b/src/main/java/io/papermc/paper/util/misc/ServerInfoProviderImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..d85ba01b83c2f29b1b56775d0f51f6b1d182252c +index 0000000000000000000000000000000000000000..1364afc507763a25b5a65086beaad5dd7a18c7b7 --- /dev/null -+++ b/src/main/java/io/papermc/paper/util/misc/PaperServerInfoProviderImpl.java -@@ -0,0 +1,195 @@ ++++ b/src/main/java/io/papermc/paper/util/misc/ServerInfoProviderImpl.java +@@ -0,0 +1,192 @@ +package io.papermc.paper.util.misc; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; -+import com.google.gson.Gson; +import com.google.gson.JsonParser; -+import com.google.gson.stream.JsonReader; +import com.mojang.logging.LogUtils; -+import io.papermc.paper.util.PaperServerInfoProvider; ++import io.papermc.paper.util.ServerInfoProvider; +import net.kyori.adventure.key.Key; +import net.kyori.adventure.key.KeyPattern; +import net.minecraft.SharedConstants; @@ -42,12 +40,12 @@ index 0000000000000000000000000000000000000000..d85ba01b83c2f29b1b56775d0f51f6b1 +import java.util.Set; +import java.util.stream.Stream; + -+public class PaperServerInfoProviderImpl implements PaperServerInfoProvider { ++public class ServerInfoProviderImpl implements ServerInfoProvider { + private final String bukkitVersion = Versioning.getBukkitVersion(); + private final Set implementedAPIs; + private final String serverName; + private final VersionInfo version; -+ public PaperServerInfoProviderImpl() { ++ public ServerInfoProviderImpl() { + ServerImplementationInfo info = new ServerImplementationInfo(); + this.serverName = info.latestName; + this.implementedAPIs = info.implementedAPIs; @@ -175,8 +173,7 @@ index 0000000000000000000000000000000000000000..d85ba01b83c2f29b1b56775d0f51f6b1 + versionList.add(version.getAsJsonObject().get("id").getAsString()); + } + } catch (IOException | InterruptedException e) { -+ LOGGER.error("Failed to fetch version manifest", e); -+ LOGGER.error("Plugins depending on version check may not work correctly"); ++ LOGGER.error("Failed to fetch version manifest, plugins depending on version check may not work correctly", e); + } + this.versionList = ImmutableList.copyOf(versionList); + } @@ -205,10 +202,10 @@ index 0000000000000000000000000000000000000000..d85ba01b83c2f29b1b56775d0f51f6b1 + } + } +} -diff --git a/src/main/resources/META-INF/services/io.papermc.paper.util.PaperServerInfoProvider b/src/main/resources/META-INF/services/io.papermc.paper.util.PaperServerInfoProvider +diff --git a/src/main/resources/META-INF/services/io.papermc.paper.util.ServerInfoProvider b/src/main/resources/META-INF/services/io.papermc.paper.util.ServerInfoProvider new file mode 100644 -index 0000000000000000000000000000000000000000..b48ad39218b8d399d60c98c3e4d66d5149717241 +index 0000000000000000000000000000000000000000..fa7c03ecb88d4c5922af54ebfb32460ec39d70d2 --- /dev/null -+++ b/src/main/resources/META-INF/services/io.papermc.paper.util.PaperServerInfoProvider ++++ b/src/main/resources/META-INF/services/io.papermc.paper.util.ServerInfoProvider @@ -0,0 +1 @@ -+io.papermc.paper.util.misc.PaperServerInfoProviderImpl ++io.papermc.paper.util.misc.ServerInfoProviderImpl