9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-29 03:49:21 +00:00

Fix Nova compatibility

This commit is contained in:
Dreeam
2024-07-04 19:55:01 +08:00
parent 504935f537
commit b80c8b15d6

View File

@@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Thu, 4 Jul 2024 19:47:01 +0800
Subject: [PATCH] Fix Nova compatibility
By setting server brand to Purpur to be compatible with Nova plugin
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 15c3d62262a589844dbaa8ac357402aa592cd351..5823a3fa71850b38cb00b869e597c2fabc8d4117 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -671,6 +671,12 @@ public final class CraftServer implements Server {
@Override
public String getVersion() {
+ // Leaf start - Fix Nova compatibility
+ if (org.dreeam.leaf.config.modules.misc.FixNovaCompatibility.enabled) {
+ return "git-Purpur-\"0000000\" (MC: " + this.console.getServerVersion() + ")";
+ }
+ // Leaf end - Fix Nova compatibility
+
return this.serverVersion + " (MC: " + this.console.getServerVersion() + ")";
}
diff --git a/src/main/java/org/dreeam/leaf/config/modules/misc/FixNovaCompatibility.java b/src/main/java/org/dreeam/leaf/config/modules/misc/FixNovaCompatibility.java
new file mode 100644
index 0000000000000000000000000000000000000000..fb13c33172b530c080a6028241bb6f5efd91cdaf
--- /dev/null
+++ b/src/main/java/org/dreeam/leaf/config/modules/misc/FixNovaCompatibility.java
@@ -0,0 +1,24 @@
+package org.dreeam.leaf.config.modules.misc;
+
+import org.dreeam.leaf.config.ConfigInfo;
+import org.dreeam.leaf.config.EnumConfigCategory;
+import org.dreeam.leaf.config.IConfigModule;
+
+public class FixNovaCompatibility implements IConfigModule {
+
+ @Override
+ public EnumConfigCategory getCategory() {
+ return EnumConfigCategory.MISC;
+ }
+
+ @Override
+ public String getBaseName() {
+ return "fix_nova_compatibility";
+ }
+
+ @ConfigInfo(baseName = "enabled", comments = """
+ Set the server brand to Purpur if enabled.
+ Don't enable this unless you have to use Nova
+ """)
+ public static boolean enabled = false;
+}