Fix issue with manifest util in tests

This commit is contained in:
Jason Penilla 2021-11-27 00:30:51 -08:00 committed by MiniDigger | Martin
parent b395c374ac
commit 8d5f9137b4

View file

@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..2a49f4198b07b3ecdc320c330c58eab2
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0521781a48d326c0a4a01b920188e9ce00b51ef0..5a3dbcc9d67ba7f22c12e8854a36bb2076d2d81a 100644 index 0521781a48d326c0a4a01b920188e9ce00b51ef0..7bbeed0c0514d5da243e205a78f82116b464acd1 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -51,6 +51,7 @@ import org.bukkit.util.CachedServerIcon; @@ -51,6 +51,7 @@ import org.bukkit.util.CachedServerIcon;
@ -58,7 +58,7 @@ index 0521781a48d326c0a4a01b920188e9ce00b51ef0..5a3dbcc9d67ba7f22c12e8854a36bb20
/** /**
* Represents the Bukkit core, for version and Server singleton handling * Represents the Bukkit core, for version and Server singleton handling
@@ -100,7 +101,25 @@ public final class Bukkit { @@ -100,7 +101,30 @@ public final class Bukkit {
} }
Bukkit.server = server; Bukkit.server = server;
@ -73,7 +73,12 @@ index 0521781a48d326c0a4a01b920188e9ce00b51ef0..5a3dbcc9d67ba7f22c12e8854a36bb20
+ */ + */
+ @NotNull + @NotNull
+ public static String getVersionMessage() { + public static String getVersionMessage() {
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass()); + final java.util.jar.Manifest manifest;
+ if (java.lang.reflect.Proxy.isProxyClass(Bukkit.getServer().getClass())) { // TestServer
+ manifest = new java.util.jar.Manifest();
+ } else {
+ manifest = JarManifests.manifest(Bukkit.getServer().getClass());
+ }
+ final String gitBranch = manifest.getMainAttributes().getValue("Git-Branch"); + final String gitBranch = manifest.getMainAttributes().getValue("Git-Branch");
+ final String gitCommit = manifest.getMainAttributes().getValue("Git-Commit"); + final String gitCommit = manifest.getMainAttributes().getValue("Git-Commit");
+ String branchMsg = " on " + gitBranch; + String branchMsg = " on " + gitBranch;