File tree Expand file tree Collapse file tree
src/main/java/top/mrxiaom/pluginbase/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ repositories {
2+ maven(" https://repo.papermc.io/repository/maven-public/" )
3+ }
14
25dependencies {
3- applyLibraries(" spigot-api" , " compileOnly" )
46 applyLibraries(" adventure" , " compileOnly" )
57 implementation(project(" :modules:library" ))
8+
9+ compileOnly(" com.destroystokyo.paper:paper-api:1.15.2-R0.1-SNAPSHOT" )
10+ compileOnly(" org.spigotmc:spigot:26.1" )
611}
712
813setupPublishing(
Original file line number Diff line number Diff line change 1+ package top .mrxiaom .pluginbase .utils ;
2+
3+ public class Versioning {
4+ private static String minecraftVersion ;
5+
6+ public static String getMinecraftVersion () {
7+ if (minecraftVersion != null ) {
8+ return minecraftVersion ;
9+ }
10+ try {
11+ // 26.1+ mojmap NMS
12+ return minecraftVersion = net .minecraft .SharedConstants .getCurrentVersion ().name ();
13+ } catch (LinkageError ignored ) {
14+ }
15+ try {
16+ // Paper
17+ return minecraftVersion = org .bukkit .Bukkit .getServer ().getMinecraftVersion ();
18+ } catch (LinkageError ignored ) {
19+ }
20+ // Spigot / Legacy Paper
21+ return minecraftVersion = org .bukkit .Bukkit .getServer ().getBukkitVersion ().split ("-" )[0 ];
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments