Fix issue with manifest util in tests

This commit is contained in:
Jason Penilla 2021-11-27 00:30:51 -08:00
parent 7b6179345f
commit 4cf1f0d22a

View file

@ -73,7 +73,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ 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 gitCommit = manifest.getMainAttributes().getValue("Git-Commit");
+ String branchMsg = " on " + gitBranch;