diff --git a/bedwars-plugin/pom.xml b/bedwars-plugin/pom.xml
index 7f3c4857c..3464efc2c 100644
--- a/bedwars-plugin/pom.xml
+++ b/bedwars-plugin/pom.xml
@@ -352,6 +352,19 @@
1.18-R0.1-SNAPSHOT
provided
+
+ dev.andrei1058.bedwars.platform.master
+ server_platform_master
+ ${project.version}
+ compile
+
+
+
+
+
+
+
+
diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java
index 1bbfb9b1d..5ec104616 100644
--- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java
+++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java
@@ -81,6 +81,7 @@
import com.andrei1058.bedwars.support.vipfeatures.VipListeners;
import com.andrei1058.vipfeatures.api.IVipFeatures;
import com.andrei1058.vipfeatures.api.MiniGameAlreadyRegistered;
+import dev.andrei1058.bedwars.platform.master.ServerPlatformManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -676,7 +677,8 @@ public static void debug(String message) {
}
public static String getForCurrentVersion(String v18, String v12, String v13) {
- switch (getServerVersion()) {
+// switch (getServerVersion()) {
+ switch (ServerPlatformManager.getServerVersion()) {
case "v1_8_R3":
return v18;
case "v1_12_R1":
@@ -744,13 +746,13 @@ public static void setLobbyWorld(String lobbyWorld) {
*
* @since v0.6.5beta
*/
+ @Deprecated(forRemoval = true)
public static String getServerVersion() {
if (null == version) {
version = Bukkit.getServer().getClass().getName().split("\\.")[3];
if (version.equals("CraftServer")) {
// todo it is probably PAPER, find out how to get nms version
}
-
}
return version;
}
diff --git a/pom.xml b/pom.xml
index d15b86687..a644823b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -117,6 +117,10 @@
versionsupport_v1_20_R4
versionsupport_v1_21_R1
versionsupport_nms_cmn1
+ server_platform
+ server_platform/server_platform_master
+ server_platform/server_platform_common
+ server_platform/server_platform_spigot
diff --git a/server_platform/pom.xml b/server_platform/pom.xml
new file mode 100644
index 000000000..fba8186f3
--- /dev/null
+++ b/server_platform/pom.xml
@@ -0,0 +1,23 @@
+
+
+ 4.0.0
+
+
+ com.andrei1058.bedwars
+ BedWars1058
+ 24.8-SNAPSHOT
+
+
+ dev.andrei1058.bedwars.platform
+ server_platform
+ pom
+
+
+ 22
+ 22
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/server_platform/server_platform_common/pom.xml b/server_platform/server_platform_common/pom.xml
new file mode 100644
index 000000000..eba8492dc
--- /dev/null
+++ b/server_platform/server_platform_common/pom.xml
@@ -0,0 +1,21 @@
+
+
+ 4.0.0
+
+ dev.andrei1058.bedwars.platform
+ server_platform
+ 24.8-SNAPSHOT
+
+
+ dev.andrei1058.bedwars.platform.common
+ server_platform_common
+
+
+ 22
+ 22
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/server_platform/server_platform_common/src/main/java/ServerPlatform.java b/server_platform/server_platform_common/src/main/java/ServerPlatform.java
new file mode 100644
index 000000000..741886a19
--- /dev/null
+++ b/server_platform/server_platform_common/src/main/java/ServerPlatform.java
@@ -0,0 +1,2 @@
+public interface ServerPlatform {
+}
diff --git a/server_platform/server_platform_master/pom.xml b/server_platform/server_platform_master/pom.xml
new file mode 100644
index 000000000..9607a31c9
--- /dev/null
+++ b/server_platform/server_platform_master/pom.xml
@@ -0,0 +1,30 @@
+
+
+ 4.0.0
+
+ dev.andrei1058.bedwars.platform
+ server_platform
+ 24.8-SNAPSHOT
+
+
+ dev.andrei1058.bedwars.platform.master
+ server_platform_master
+
+
+ 22
+ 22
+ UTF-8
+
+
+
+
+ org.spigotmc
+ spigot
+ 1.8.8-R0.1-SNAPSHOT
+ provided
+
+
+
+
\ No newline at end of file
diff --git a/server_platform/server_platform_master/src/main/java/dev/andrei1058/bedwars/platform/master/PlatformLoader.java b/server_platform/server_platform_master/src/main/java/dev/andrei1058/bedwars/platform/master/PlatformLoader.java
new file mode 100644
index 000000000..eb1444db0
--- /dev/null
+++ b/server_platform/server_platform_master/src/main/java/dev/andrei1058/bedwars/platform/master/PlatformLoader.java
@@ -0,0 +1,4 @@
+package dev.andrei1058.bedwars.platform.master;
+
+public interface PlatformLoader {
+}
diff --git a/server_platform/server_platform_master/src/main/java/dev/andrei1058/bedwars/platform/master/ServerPlatformManager.java b/server_platform/server_platform_master/src/main/java/dev/andrei1058/bedwars/platform/master/ServerPlatformManager.java
new file mode 100644
index 000000000..112021a34
--- /dev/null
+++ b/server_platform/server_platform_master/src/main/java/dev/andrei1058/bedwars/platform/master/ServerPlatformManager.java
@@ -0,0 +1,23 @@
+package dev.andrei1058.bedwars.platform.master;
+
+import org.bukkit.Bukkit;
+
+// Loads the server platform logic based on server jar at runtime
+public class ServerPlatformManager {
+
+ private static String version;
+
+ public static String getServerVersion() {
+ if (null == version) {
+ version = Bukkit.getServer().getClass().getName().split("\\.")[3];
+ if (version.equals("CraftServer")) {
+ // it is probably PAPER
+ String bukkitVersion = Bukkit.getServer().getBukkitVersion();
+ if (bukkitVersion.startsWith("1.21")) {
+ // todo test me
+ }
+ }
+ }
+ return version;
+ }
+}
diff --git a/server_platform/server_platform_spigot/pom.xml b/server_platform/server_platform_spigot/pom.xml
new file mode 100644
index 000000000..431812f1b
--- /dev/null
+++ b/server_platform/server_platform_spigot/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+ dev.andrei1058.bedwars.platform
+ server_platform
+ 24.8-SNAPSHOT
+
+
+ dev.andrei1058.bedwars.platform.spigot
+ server_platform_spigot
+ pom
+
+ server_platform_spigot_common
+ server_platform_sever_v1_8_R3
+
+
+
+ 22
+ 22
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/server_platform/server_platform_spigot/server_platform_sever_v1_8_R3/pom.xml b/server_platform/server_platform_spigot/server_platform_sever_v1_8_R3/pom.xml
new file mode 100644
index 000000000..c5b1311f2
--- /dev/null
+++ b/server_platform/server_platform_spigot/server_platform_sever_v1_8_R3/pom.xml
@@ -0,0 +1,20 @@
+
+
+ 4.0.0
+
+ dev.andrei1058.bedwars.platform.spigot
+ server_platform_spigot
+ 24.8-SNAPSHOT
+
+
+ server_platform_sever_v1_8_R3
+
+
+ 22
+ 22
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/server_platform/server_platform_spigot/server_platform_spigot_common/pom.xml b/server_platform/server_platform_spigot/server_platform_spigot_common/pom.xml
new file mode 100644
index 000000000..6262ab8cf
--- /dev/null
+++ b/server_platform/server_platform_spigot/server_platform_spigot_common/pom.xml
@@ -0,0 +1,28 @@
+
+
+ 4.0.0
+
+ dev.andrei1058.bedwars.platform.spigot
+ server_platform_spigot
+ 24.8-SNAPSHOT
+
+
+ server_platform_spigot_common
+
+
+ 22
+ 22
+ UTF-8
+
+
+
+
+ dev.andrei1058.bedwars.platform.common
+ server_platform_common
+ ${project.version}
+
+
+
+
\ No newline at end of file
diff --git a/server_platform/server_platform_spigot/server_platform_spigot_common/src/main/java/SpigotPlatformCommon.java b/server_platform/server_platform_spigot/server_platform_spigot_common/src/main/java/SpigotPlatformCommon.java
new file mode 100644
index 000000000..e76e3fc98
--- /dev/null
+++ b/server_platform/server_platform_spigot/server_platform_spigot_common/src/main/java/SpigotPlatformCommon.java
@@ -0,0 +1,2 @@
+public interface SpigotPlatformCommon {
+}