42 lines
1.7 KiB
Diff
42 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NekoCore <noreply@nekocore.dev>
|
|
Date: Sun, 29 Jun 2026 13:20:00 +0800
|
|
Subject: [PATCH] NekoCore: parseable Bukkit version fallback
|
|
|
|
Versioning.getBukkitVersion() returns "Unknown-Version" when the folia-api
|
|
pom.properties resource is absent from the runtime jar. Plugins that parse the
|
|
Bukkit version as a semantic version (e.g. SkinsRestorer) then crash with
|
|
NumberFormatException(parseInt("")). Fall back to a real, parseable version
|
|
string so the plugin ecosystem keeps working.
|
|
|
|
|
|
diff --git a/org/bukkit/craftbukkit/util/Versioning.java b/org/bukkit/craftbukkit/util/Versioning.java
|
|
--- a/org/bukkit/craftbukkit/util/Versioning.java
|
|
+++ b/org/bukkit/craftbukkit/util/Versioning.java
|
|
@@ -8,8 +8,12 @@ import java.util.logging.Logger;
|
|
import org.bukkit.Bukkit;
|
|
|
|
public final class Versioning {
|
|
+ // Neko Core - parseable fallback so version-parsing plugins (e.g. SkinsRestorer) don't crash
|
|
+ // with NumberFormatException(parseInt("")) when folia-api pom.properties is missing from the jar.
|
|
+ private static final String FALLBACK_VERSION = "1.21.8-R0.1-SNAPSHOT";
|
|
+
|
|
public static String getBukkitVersion() {
|
|
- String result = "Unknown-Version";
|
|
+ String result = null;
|
|
|
|
InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/dev.folia/folia-api/pom.properties"); // Folia
|
|
Properties properties = new Properties();
|
|
@@ -24,6 +28,11 @@ public final class Versioning {
|
|
}
|
|
}
|
|
|
|
+ // Neko Core - never return an unparseable version.
|
|
+ if (result == null || result.isBlank() || "Unknown-Version".equals(result)) {
|
|
+ result = FALLBACK_VERSION;
|
|
+ }
|
|
+
|
|
return result;
|
|
}
|
|
}
|