Skip to content

Commit cadb4f6

Browse files
committed
handle new minecraft versioning system better
1 parent 7503296 commit cadb4f6

7 files changed

Lines changed: 11 additions & 11 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies {
3939
implementation("net.kyori:adventure-text-minimessage:4.26.1")
4040
implementation("net.kyori:adventure-platform-bukkit:4.4.1")
4141

42-
implementation("us.ajg0702:ajUtils:1.2.29")
42+
implementation("us.ajg0702:ajUtils:1.2.38")
4343
implementation("us.ajg0702.commands.platforms.bukkit:bukkit:1.0.0")
4444
implementation("us.ajg0702.commands.api:api:1.0.0")
4545

nms/nms-19/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies {
2121
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
2222
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
2323
compileOnly(project(":nms:nms-legacy"))
24-
compileOnly("us.ajg0702:ajUtils:1.2.29")
24+
compileOnly("us.ajg0702:ajUtils:1.2.38")
2525
compileOnly("net.skinsrestorer:skinsrestorer-api:14.1.10")
2626
}
2727

nms/nms-legacy/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ dependencies {
2020
compileOnly(group = "org.spigotmc", name = "spigot", version = "1.19-R0.1-SNAPSHOT")
2121
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
2222
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
23-
compileOnly("us.ajg0702:ajUtils:1.2.29")
23+
compileOnly("us.ajg0702:ajUtils:1.2.38")
2424
compileOnly("net.skinsrestorer:skinsrestorer-api:14.1.10")
2525
compileOnly("com.squareup.okhttp3:okhttp:4.11.0")
2626
}

nms/nms-legacy/src/main/java/us/ajg0702/leaderboards/nms/legacy/HeadUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public HeadUtils(Logger logger, DebugWrapper debug, CompatScheduler scheduler) {
5656

5757
debug.infoW("Detected minor minecraft version: " + minorVersion);
5858

59-
if(minorVersion >= 19) {
59+
if(VersionSupport.getMajorVersion() >= 26 || minorVersion >= 19) {
6060
try {
6161
versionedHeadUtils = (VersionedHeadUtils) Class.forName("us.ajg0702.leaderboards.nms.nms19.HeadUtils19")
6262
.getDeclaredConstructor(DebugWrapper.class, CompatScheduler.class, Logger.class)
@@ -76,10 +76,10 @@ public VersionedHeadUtils getVersionedHeadUtils() {
7676
public ItemStack getHeadItem(UUID uuid, String name) {
7777

7878
ItemStack skull = null;
79-
if(VersionSupport.getMinorVersion() <= 12) {
79+
if(VersionSupport.getMajorVersion() < 26 && VersionSupport.getMinorVersion() <= 12) {
8080
//noinspection deprecation
8181
skull = new ItemStack(Material.valueOf("SKULL_ITEM"), 1 , (short) 3);
82-
} else if(VersionSupport.getMinorVersion() > 12) {
82+
} else {
8383
skull = new ItemStack(Material.PLAYER_HEAD, 1);
8484
}
8585
String value;

src/main/java/us/ajg0702/leaderboards/displays/armorstands/ArmorStandManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private void setArmorstandHead(ArmorStand stand, String name, UUID uuid) {
6767
}
6868

6969
Runnable runnable = () -> {
70-
if(VersionSupport.getMinorVersion() >= 10) {
70+
if(VersionSupport.getMajorVersion() >= 26 || VersionSupport.getMinorVersion() >= 10) {
7171
stand.setSilent(true);
7272
}
7373
//noinspection deprecation
@@ -88,7 +88,7 @@ public void search(BoardSign sign, String name, UUID id) {
8888
Sign ss = sign.getSign();
8989
if(ss == null) return;
9090
BlockFace face;
91-
if(VersionSupport.getMinorVersion() > 12) {
91+
if(VersionSupport.minorVersionEqualGreaterThan(13)) {
9292
BlockData bd = ss.getBlockData();
9393
if(bd instanceof org.bukkit.block.data.type.Sign) {
9494
org.bukkit.block.data.type.Sign bs = (org.bukkit.block.data.type.Sign) bd;

src/main/java/us/ajg0702/leaderboards/displays/heads/HeadManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void search(BoardSign sign, String name, UUID id) {
3333
Sign ss = sign.getSign();
3434
if(ss == null) return;
3535
BlockFace face;
36-
if(VersionSupport.getMinorVersion() > 12) {
36+
if(VersionSupport.minorVersionEqualGreaterThan(13)) {
3737
BlockData bd = ss.getBlockData();
3838
if(bd instanceof org.bukkit.block.data.type.Sign) {
3939
org.bukkit.block.data.type.Sign bs = (org.bukkit.block.data.type.Sign) bd;
@@ -138,7 +138,7 @@ public void checkHead(Location loc, String name, UUID id) {
138138

139139
Debug.info("Updating head with "+id);
140140

141-
OfflinePlayer op = VersionSupport.getMinorVersion() > 9 ? Bukkit.getOfflinePlayer(id) : null;
141+
OfflinePlayer op = VersionSupport.getMajorVersion() >= 26 || VersionSupport.getMinorVersion() > 9 ? Bukkit.getOfflinePlayer(id) : null;
142142

143143
if(plugin.getHeadUtils().getVersionedHeadUtils() != null) {
144144
plugin.getScheduler().runTaskAsynchronously(

src/main/java/us/ajg0702/leaderboards/displays/signs/SignManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void reload() {
5252
cfgFile = new File(plugin.getDataFolder(), "displays.yml");
5353
cfg = YamlConfiguration.loadConfiguration(cfgFile);
5454
String headerText = "This file is for storing sign location, npcs, and other things in the plugin that might display data";
55-
if(VersionSupport.getMinorVersion() > 18) {
55+
if(VersionSupport.getMajorVersion() >= 26 || VersionSupport.getMinorVersion() > 18) {
5656
cfg.options().setHeader(Collections.singletonList(headerText));
5757
} else {
5858
//noinspection deprecation

0 commit comments

Comments
 (0)