Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei1058 committed Nov 5, 2024
1 parent fd38d01 commit df003d7
Show file tree
Hide file tree
Showing 13 changed files with 200 additions and 2 deletions.
13 changes: 13 additions & 0 deletions bedwars-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,19 @@
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.andrei1058.bedwars.platform.master</groupId>
<artifactId>server_platform_master</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>

<!-- <dependency>-->
<!-- <groupId>dev.andrei1058.bedwars.platform.master</groupId>-->
<!-- <artifactId>server_platform_master</artifactId>-->
<!-- <version>24.8-SNAPSHOT</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
<module>versionsupport_v1_20_R4</module>
<module>versionsupport_v1_21_R1</module>
<module>versionsupport_nms_cmn1</module>
<module>server_platform</module>
<module>server_platform/server_platform_master</module>
<module>server_platform/server_platform_common</module>
<module>server_platform/server_platform_spigot</module>
</modules>

<distributionManagement>
Expand Down
23 changes: 23 additions & 0 deletions server_platform/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<version>24.8-SNAPSHOT</version>
</parent>

<groupId>dev.andrei1058.bedwars.platform</groupId>
<artifactId>server_platform</artifactId>
<packaging>pom</packaging>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
21 changes: 21 additions & 0 deletions server_platform/server_platform_common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.andrei1058.bedwars.platform</groupId>
<artifactId>server_platform</artifactId>
<version>24.8-SNAPSHOT</version>
</parent>

<groupId>dev.andrei1058.bedwars.platform.common</groupId>
<artifactId>server_platform_common</artifactId>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public interface ServerPlatform {
}
30 changes: 30 additions & 0 deletions server_platform/server_platform_master/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.andrei1058.bedwars.platform</groupId>
<artifactId>server_platform</artifactId>
<version>24.8-SNAPSHOT</version>
</parent>

<groupId>dev.andrei1058.bedwars.platform.master</groupId>
<artifactId>server_platform_master</artifactId>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dev.andrei1058.bedwars.platform.master;

public interface PlatformLoader {
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
26 changes: 26 additions & 0 deletions server_platform/server_platform_spigot/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.andrei1058.bedwars.platform</groupId>
<artifactId>server_platform</artifactId>
<version>24.8-SNAPSHOT</version>
</parent>

<groupId>dev.andrei1058.bedwars.platform.spigot</groupId>
<artifactId>server_platform_spigot</artifactId>
<packaging>pom</packaging>
<modules>
<module>server_platform_spigot_common</module>
<module>server_platform_sever_v1_8_R3</module>
</modules>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.andrei1058.bedwars.platform.spigot</groupId>
<artifactId>server_platform_spigot</artifactId>
<version>24.8-SNAPSHOT</version>
</parent>

<artifactId>server_platform_sever_v1_8_R3</artifactId>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.andrei1058.bedwars.platform.spigot</groupId>
<artifactId>server_platform_spigot</artifactId>
<version>24.8-SNAPSHOT</version>
</parent>

<artifactId>server_platform_spigot_common</artifactId>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>dev.andrei1058.bedwars.platform.common</groupId>
<artifactId>server_platform_common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public interface SpigotPlatformCommon {
}

0 comments on commit df003d7

Please sign in to comment.