From 79536630c2f35473e758e412c58431b74e77fb3a Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Sun, 7 Jul 2024 15:36:27 +0000 Subject: [PATCH] version checking --- settings.gradle | 6 +++--- .../me/lucko/spark/bukkit/BukkitPlatformInfo.java | 14 ++++++++------ .../me/lucko/spark/bukkit/BukkitSparkPlugin.java | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/settings.gradle b/settings.gradle index 70753910..bc594b1a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -30,9 +30,9 @@ include ( 'spark-velocity4', 'spark-sponge7', 'spark-sponge8', - 'spark-forge', - 'spark-neoforge', - 'spark-fabric', +// 'spark-forge', +// 'spark-neoforge', +// 'spark-fabric', 'spark-nukkit', 'spark-waterdog', //'spark-minestom', // disabled until minestom publish their maven artifacts to a proper repo diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitPlatformInfo.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitPlatformInfo.java index 1f2f4828..d24014f8 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitPlatformInfo.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitPlatformInfo.java @@ -47,12 +47,14 @@ public String getName() { @Override public String getVersion() { final String version = this.server.getVersion(); - String brand; - - if (version.contains("Spigot")) { - brand = null; - } else { - brand = this.server.getName(); + String brand = null; + + if (BukkitSparkPlugin.classExists("io.papermc.paper.ServerBuildInfo")) { + if (version.contains("Spigot")) { + brand = null; + } else { + brand = this.server.getName(); + } } return (brand == null ? "" : brand + " ") + this.server.getVersion(); } diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java index 87490ea2..ea94b9d6 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java @@ -223,7 +223,7 @@ public void registerApi(Spark api) { getServer().getServicesManager().register(Spark.class, api, this, ServicePriority.Normal); } - private static boolean classExists(String className) { + protected static boolean classExists(String className) { try { Class.forName(className); return true;