From 611f8bba366c6e60fc39542c113b99e6613b80f4 Mon Sep 17 00:00:00 2001 From: Vankka Date: Sat, 30 Nov 2024 14:41:38 +0200 Subject: [PATCH] Add platform version information to debug reports --- .../com/discordsrv/bukkit/DiscordSRVBukkitBootstrap.java | 7 +++++++ .../com/discordsrv/bungee/DiscordSRVBungeeBootstrap.java | 7 +++++++ .../common/abstraction/bootstrap/IBootstrap.java | 1 + .../com/discordsrv/common/feature/debug/DebugReport.java | 1 + .../test/java/com/discordsrv/common/MockDiscordSRV.java | 5 +++++ .../discordsrv/velocity/DiscordSRVVelocityBootstrap.java | 7 +++++++ 6 files changed, 28 insertions(+) diff --git a/bukkit/src/main/java/com/discordsrv/bukkit/DiscordSRVBukkitBootstrap.java b/bukkit/src/main/java/com/discordsrv/bukkit/DiscordSRVBukkitBootstrap.java index 41e7e8fc..d884d6ac 100644 --- a/bukkit/src/main/java/com/discordsrv/bukkit/DiscordSRVBukkitBootstrap.java +++ b/bukkit/src/main/java/com/discordsrv/bukkit/DiscordSRVBukkitBootstrap.java @@ -25,6 +25,7 @@ import com.discordsrv.common.core.logging.backend.impl.JavaLoggerImpl; import dev.vankka.dependencydownload.classpath.ClasspathAppender; import dev.vankka.dependencydownload.jarinjar.classloader.JarInJarClassLoader; import dev.vankka.mcdependencydownload.bukkit.bootstrap.BukkitBootstrap; +import org.bukkit.Server; import org.bukkit.plugin.java.JavaPlugin; import java.io.IOException; @@ -125,6 +126,12 @@ public class DiscordSRVBukkitBootstrap extends BukkitBootstrap implements IBoots return getPlugin().getDataFolder().toPath(); } + @Override + public String platformVersion() { + Server server = getPlugin().getServer(); + return server.getName() + " version " + server.getVersion() + " (implementation version " + server.getBukkitVersion() + ")"; + } + public List mainThreadTasksForDisable() { return mainThreadTasksForDisable; } diff --git a/bungee/src/main/java/com/discordsrv/bungee/DiscordSRVBungeeBootstrap.java b/bungee/src/main/java/com/discordsrv/bungee/DiscordSRVBungeeBootstrap.java index 666eb99b..df4af861 100644 --- a/bungee/src/main/java/com/discordsrv/bungee/DiscordSRVBungeeBootstrap.java +++ b/bungee/src/main/java/com/discordsrv/bungee/DiscordSRVBungeeBootstrap.java @@ -25,6 +25,7 @@ import com.discordsrv.common.core.logging.backend.impl.JavaLoggerImpl; import dev.vankka.dependencydownload.classpath.ClasspathAppender; import dev.vankka.dependencydownload.jarinjar.classloader.JarInJarClassLoader; import dev.vankka.mcdependencydownload.bungee.bootstrap.BungeeBootstrap; +import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.plugin.Plugin; import java.io.IOException; @@ -82,4 +83,10 @@ public class DiscordSRVBungeeBootstrap extends BungeeBootstrap implements IBoots public Path dataDirectory() { return getPlugin().getDataFolder().toPath(); } + + @Override + public String platformVersion() { + ProxyServer proxyServer = getPlugin().getProxy(); + return proxyServer.getName() + " version " + proxyServer.getVersion(); + } } diff --git a/common/src/main/java/com/discordsrv/common/abstraction/bootstrap/IBootstrap.java b/common/src/main/java/com/discordsrv/common/abstraction/bootstrap/IBootstrap.java index 290bd231..bb06ba39 100644 --- a/common/src/main/java/com/discordsrv/common/abstraction/bootstrap/IBootstrap.java +++ b/common/src/main/java/com/discordsrv/common/abstraction/bootstrap/IBootstrap.java @@ -33,5 +33,6 @@ public interface IBootstrap { ClassLoader classLoader(); LifecycleManager lifecycleManager(); Path dataDirectory(); + String platformVersion(); } diff --git a/common/src/main/java/com/discordsrv/common/feature/debug/DebugReport.java b/common/src/main/java/com/discordsrv/common/feature/debug/DebugReport.java index 43875385..6d41804e 100644 --- a/common/src/main/java/com/discordsrv/common/feature/debug/DebugReport.java +++ b/common/src/main/java/com/discordsrv/common/feature/debug/DebugReport.java @@ -148,6 +148,7 @@ public class DebugReport { private DebugFile environment() { Map values = new LinkedHashMap<>(); values.put("discordSRV", discordSRV.getClass().getName()); + values.put("platformVersion", discordSRV.bootstrap().platformVersion()); values.put("version", discordSRV.versionInfo().version()); values.put("gitRevision", discordSRV.versionInfo().gitRevision()); values.put("gitBranch", discordSRV.versionInfo().gitBranch()); diff --git a/common/src/test/java/com/discordsrv/common/MockDiscordSRV.java b/common/src/test/java/com/discordsrv/common/MockDiscordSRV.java index a0d4559e..9cc0ff48 100644 --- a/common/src/test/java/com/discordsrv/common/MockDiscordSRV.java +++ b/common/src/test/java/com/discordsrv/common/MockDiscordSRV.java @@ -100,6 +100,11 @@ public class MockDiscordSRV extends AbstractDiscordSRV