Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing compatibility with older versions. #81

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions pathetic-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
<artifactId>pathetic-api</artifactId>
<version>2.4.5</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
Expand All @@ -28,4 +23,4 @@
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
</project>
5 changes: 0 additions & 5 deletions pathetic-mapping/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
<artifactId>pathetic-mapping</artifactId>
<version>2.4.5</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
Expand Down
5 changes: 0 additions & 5 deletions pathetic-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
<artifactId>pathetic-model</artifactId>
<version>2.4.5</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<build>
<resources>
<resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,35 @@
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

@UtilityClass
public class BukkitVersionUtil {

private static final double CURRENT_MAJOR;
private static final double CURRENT_MINOR;

static {
String[] versionParts = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
CURRENT_MAJOR = Double.parseDouble(versionParts[1]);
CURRENT_MINOR = versionParts.length >= 3 ? Double.parseDouble(versionParts[2]) : 0;
Pattern pattern = Pattern.compile(".*\\(.*MC.\\s*([a-zA-z0-9\\-.]+)\\s*\\)");
Matcher matcher = pattern.matcher(Bukkit.getVersion());

if (!matcher.matches() || matcher.group(1) == null) {
throw new IllegalStateException("Cannot parse version String '" + Bukkit.getVersion() + "'");
}

String[] elements = matcher.group(1).split("\\.");
if (elements.length < 1) {
throw new IllegalStateException("Invalid server version '" + matcher.group(1) + "'");
}

int[] values = new int[3];
for (int i = 0; i < Math.min(values.length, elements.length); i++) {
values[i] = Integer.parseInt(elements[i].trim());
}

CURRENT_MAJOR = values[1];
CURRENT_MINOR = values[2];
}

public static Version getVersion() {
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/paper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>paper</artifactId>

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

<repositories>
<repository>
<id>papermc</id>
Expand Down
7 changes: 1 addition & 6 deletions pathetic-nms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
<groupId>org.patheloper</groupId>
<version>2.4.5</version>
</parent>

<modelVersion>4.0.0</modelVersion>

<artifactId>pathetic-nms</artifactId>
<version>2.4.5</version>

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

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_12</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_15/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_15</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_16/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_16</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_17/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_17</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_18/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_18</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_18_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_18_R2</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_19_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_19_R2</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_19_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_19_R3</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_20_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_20_R1</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_20_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_20_R2</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_20_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_20_R3</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_20_R4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_20_R4</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_21/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_21</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
6 changes: 0 additions & 6 deletions pathetic-nms/v1_8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

<artifactId>v1_8</artifactId>

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

<repositories>
<repository>
<id>codemc-repo</id>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
Expand Down
Loading