9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-28 19:29:17 +00:00

2.1.7.2.2

This commit is contained in:
Xiao-MoMi
2023-03-13 22:30:54 +08:00
parent 39f473d8cd
commit 3d0e37623c
13 changed files with 73 additions and 43 deletions

View File

@@ -0,0 +1,21 @@
package net.momirealms.customnameplates.helper;
import org.bukkit.Bukkit;
public class VersionHelper {
private boolean isNewerThan1_19_R2;
private String version;
public boolean isVersionNewerThan1_19_R2() {
if (version == null) {
version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
String[] split = version.split("_");
int main_ver = Integer.parseInt(split[1]);
if (main_ver >= 20) isNewerThan1_19_R2 = true;
else if (main_ver == 19) isNewerThan1_19_R2 = Integer.parseInt(split[2].substring(1)) >= 2;
else isNewerThan1_19_R2 = false;
}
return isNewerThan1_19_R2;
}
}