1.23.1
This commit is contained in:
parent
79f916158d
commit
f0c46d3166
3 changed files with 26 additions and 7 deletions
6
pom.xml
6
pom.xml
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>pk.ajneb97</groupId>
|
<groupId>pk.ajneb97</groupId>
|
||||||
<artifactId>PlayerKits2</artifactId>
|
<artifactId>PlayerKits2</artifactId>
|
||||||
<version>1.22.2</version>
|
<version>1.23.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>21</maven.compiler.source>
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
|
@ -41,13 +41,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.papermc.paper</groupId>
|
<groupId>io.papermc.paper</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.21.11-R0.1-SNAPSHOT</version>
|
<version>26.1.2.build.69-stable</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>26.1-R0.1-SNAPSHOT</version>
|
<version>26.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,8 @@ public class PlayerKits2 extends JavaPlugin {
|
||||||
|
|
||||||
public void setVersion(){
|
public void setVersion(){
|
||||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
String bukkitVersion = Bukkit.getServer().getBukkitVersion().split("-")[0];
|
String minecraftVersion = ServerVersion.getMinecraftVersion();
|
||||||
switch(bukkitVersion){
|
switch(minecraftVersion){
|
||||||
case "1.20.5":
|
case "1.20.5":
|
||||||
case "1.20.6":
|
case "1.20.6":
|
||||||
serverVersion = ServerVersion.v1_20_R4;
|
serverVersion = ServerVersion.v1_20_R4;
|
||||||
|
|
@ -151,13 +151,18 @@ public class PlayerKits2 extends JavaPlugin {
|
||||||
serverVersion = ServerVersion.v1_21_R7;
|
serverVersion = ServerVersion.v1_21_R7;
|
||||||
break;
|
break;
|
||||||
case "26.1":
|
case "26.1":
|
||||||
|
case "26.1.1":
|
||||||
|
case "26.1.2":
|
||||||
serverVersion = ServerVersion.v26_1;
|
serverVersion = ServerVersion.v26_1;
|
||||||
break;
|
break;
|
||||||
|
case "26.2":
|
||||||
|
serverVersion = ServerVersion.v26_2;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
try{
|
try{
|
||||||
serverVersion = ServerVersion.valueOf(packageName.replace("org.bukkit.craftbukkit.", ""));
|
serverVersion = ServerVersion.valueOf(packageName.replace("org.bukkit.craftbukkit.", ""));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
serverVersion = ServerVersion.v26_1;
|
serverVersion = ServerVersion.v26_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
package pk.ajneb97.utils;
|
package pk.ajneb97.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public enum ServerVersion {
|
public enum ServerVersion {
|
||||||
v1_8_R1,
|
v1_8_R1,
|
||||||
v1_8_R2,
|
v1_8_R2,
|
||||||
|
|
@ -33,9 +37,19 @@ public enum ServerVersion {
|
||||||
v1_21_R5,
|
v1_21_R5,
|
||||||
v1_21_R6,
|
v1_21_R6,
|
||||||
v1_21_R7,
|
v1_21_R7,
|
||||||
v26_1;
|
v26_1,
|
||||||
|
v26_2;
|
||||||
|
|
||||||
public boolean serverVersionGreaterEqualThan(ServerVersion version1,ServerVersion version2){
|
public boolean serverVersionGreaterEqualThan(ServerVersion version1,ServerVersion version2){
|
||||||
return version1.ordinal() >= version2.ordinal();
|
return version1.ordinal() >= version2.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getMinecraftVersion() {
|
||||||
|
try {
|
||||||
|
Method method = Bukkit.class.getMethod("getMinecraftVersion");
|
||||||
|
return (String) method.invoke(null);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
return Bukkit.getServer().getBukkitVersion().split("-")[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue