diff --git a/api/src/main/java/net/momirealms/customnameplates/api/helper/VersionHelper.java b/api/src/main/java/net/momirealms/customnameplates/api/helper/VersionHelper.java index a9185c0..37b6cac 100644 --- a/api/src/main/java/net/momirealms/customnameplates/api/helper/VersionHelper.java +++ b/api/src/main/java/net/momirealms/customnameplates/api/helper/VersionHelper.java @@ -137,13 +137,22 @@ public class VersionHelper { } } + /** + * Checks if the server version is newer than 1.21.5 + * + * @return True if the version is newer than 1.21.5, otherwise false. + */ + public static boolean isVersionNewerThan1_21_5() { + return version >= 21.49f; + } + /** * Checks if the server version is newer than 1.21.4 * * @return True if the version is newer than 1.21.4, otherwise false. */ public static boolean isVersionNewerThan1_21_4() { - return version >= 21.39; + return version >= 21.39f; } /** @@ -152,7 +161,7 @@ public class VersionHelper { * @return True if the version is newer than 1.21.2, otherwise false. */ public static boolean isVersionNewerThan1_21_2() { - return version >= 21.19; + return version >= 21.19f; } /** @@ -161,7 +170,7 @@ public class VersionHelper { * @return True if the version is newer than 1.20.5, otherwise false. */ public static boolean isVersionNewerThan1_20_5() { - return version >= 20.49; + return version >= 20.49f; } /** @@ -170,7 +179,7 @@ public class VersionHelper { * @return True if the version is newer than 1.20.4, otherwise false. */ public static boolean isVersionNewerThan1_20_4() { - return version >= 20.39; + return version >= 20.39f; } /** @@ -179,7 +188,7 @@ public class VersionHelper { * @return True if the version is newer than 1.19.4, otherwise false. */ public static boolean isVersionNewerThan1_19_4() { - return version >= 19.39; + return version >= 19.39f; } /** @@ -188,7 +197,7 @@ public class VersionHelper { * @return True if the version is newer than 1.20.2, otherwise false. */ public static boolean isVersionNewerThan1_20_2() { - return version >= 20.19; + return version >= 20.19f; } /** @@ -197,7 +206,7 @@ public class VersionHelper { * @return True if the version is newer than 1.20, otherwise false. */ public static boolean isVersionNewerThan1_20() { - return version >= 20; + return version >= 20f; } /** diff --git a/backend/src/main/resources/ResourcePack/pack.mcmeta b/backend/src/main/resources/ResourcePack/pack.mcmeta index ae5d1af..f943f28 100644 --- a/backend/src/main/resources/ResourcePack/pack.mcmeta +++ b/backend/src/main/resources/ResourcePack/pack.mcmeta @@ -4,7 +4,7 @@ "description": "CustomNameplates", "supported_formats": { "min_inclusive": 13, - "max_inclusive": 51 + "max_inclusive": 99 } }, "overlays": { @@ -26,7 +26,7 @@ { "formats": { "min_inclusive": 46, - "max_inclusive": 51 + "max_inclusive": 99 }, "directory": "overlay_1_21_4" } diff --git a/backend/src/main/resources/ResourcePack/pack_1_20_5.mcmeta b/backend/src/main/resources/ResourcePack/pack_1_20_5.mcmeta index 84fd641..25c82dc 100644 --- a/backend/src/main/resources/ResourcePack/pack_1_20_5.mcmeta +++ b/backend/src/main/resources/ResourcePack/pack_1_20_5.mcmeta @@ -4,7 +4,7 @@ "description": "CustomNameplates", "supported_formats": { "min_inclusive": 32, - "max_inclusive": 51 + "max_inclusive": 99 } }, "overlays": { @@ -19,7 +19,7 @@ { "formats": { "min_inclusive": 46, - "max_inclusive": 51 + "max_inclusive": 99 }, "directory": "overlay_1_21_4" } diff --git a/backend/src/main/resources/ResourcePack/pack_1_21_2.mcmeta b/backend/src/main/resources/ResourcePack/pack_1_21_2.mcmeta index cf3ef2d..e97166f 100644 --- a/backend/src/main/resources/ResourcePack/pack_1_21_2.mcmeta +++ b/backend/src/main/resources/ResourcePack/pack_1_21_2.mcmeta @@ -4,7 +4,7 @@ "description": "CustomNameplates", "supported_formats": { "min_inclusive": 42, - "max_inclusive": 51 + "max_inclusive": 99 } }, "overlays": { @@ -12,7 +12,7 @@ { "formats": { "min_inclusive": 46, - "max_inclusive": 51 + "max_inclusive": 99 }, "directory": "overlay_1_21_4" } diff --git a/backend/src/main/resources/ResourcePack/pack_1_21_4.mcmeta b/backend/src/main/resources/ResourcePack/pack_1_21_4.mcmeta index a851556..ecaa1a3 100644 --- a/backend/src/main/resources/ResourcePack/pack_1_21_4.mcmeta +++ b/backend/src/main/resources/ResourcePack/pack_1_21_4.mcmeta @@ -4,7 +4,7 @@ "description": "CustomNameplates", "supported_formats": { "min_inclusive": 46, - "max_inclusive": 51 + "max_inclusive": 99 } } } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 5388e97..b2d6e46 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import java.io.ByteArrayOutputStream plugins { id("java") - id("com.gradleup.shadow") version "9.0.0-beta6" + id("com.gradleup.shadow") version "9.0.0-beta11" } val git : String = versionBanner() diff --git a/gradle.properties b/gradle.properties index 197b22e..b5e2583 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,17 +9,17 @@ lang=en,zh_cn # Dependency settings paper_version=1.20.4 -jetbrains_annotations_version=24.0.0 -slf4j_version=2.0.16 -log4j_version=2.24.1 +jetbrains_annotations_version=26.0.2 +slf4j_version=2.0.17 +log4j_version=2.24.3 gson_version=2.11.0 asm_version=9.8 asm_commons_version=9.8 jar_relocator_version=1.7 h2_driver_version=2.3.232 -sqlite_driver_version=3.48.0.0 +sqlite_driver_version=3.49.1.0 adventure_bundle_version=4.20.0 -adventure_platform_version=4.3.5-SNAPSHOT +adventure_platform_version=4.3.4 cloud_core_version=2.0.0 cloud_services_version=2.0.0 cloud_brigadier_version=2.0.0-beta.10 @@ -29,20 +29,20 @@ cloud_minecraft_extras_version=2.0.0-beta.10 boosted_yaml_version=1.3.7 byte_buddy_version=1.17.5 mojang_brigadier_version=1.0.18 -mongodb_driver_version=5.3.1 -mariadb_driver_version=3.5.1 +mongodb_driver_version=5.4.0 +mariadb_driver_version=3.5.3 mysql_driver_version=9.2.0 hikari_version=5.1.0 -commons_pool_version=2.12.0 +commons_pool_version=2.12.1 bstats_version=3.1.0 geantyref_version=1.3.16 -caffeine_version=3.1.8 +caffeine_version=3.2.0 jedis_version=5.2.0 exp4j_version=0.4.8 placeholder_api_version=2.11.6 vault_version=1.7 -guava_version=33.3.1-jre -commons_io_version=2.17.0 +guava_version=33.4.8-jre +commons_io_version=2.19.0 lwjgl_version=3.3.4 fastutil_version=8.5.15 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c608c99..f584c8c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/BukkitPlatform.java b/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/BukkitPlatform.java index 4c36c2f..61ef67a 100644 --- a/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/BukkitPlatform.java +++ b/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/BukkitPlatform.java @@ -431,7 +431,7 @@ public class BukkitPlatform implements Platform { Optional optionalParameters = (Optional) Reflections.field$ClientboundSetPlayerTeamPacket$parameters.get(packet); if (optionalParameters.isPresent()) { Object parameters = optionalParameters.get(); - Reflections.field$ClientboundSetPlayerTeamPacket$Parameters$nametagVisibility.set(parameters, "never"); + Reflections.field$ClientboundSetPlayerTeamPacket$Parameters$nametagVisibility.set(parameters, VersionHelper.isVersionNewerThan1_21_5() ? Reflections.instance$Team$Visibility$NEVER : "never"); } } // remove diff --git a/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/EntityDataValue.java b/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/EntityDataValue.java index 6781e59..8285e50 100644 --- a/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/EntityDataValue.java +++ b/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/EntityDataValue.java @@ -49,6 +49,7 @@ public class EntityDataValue { public static final Object Serializers$OPTIONAL_BLOCK_POS; public static final Object Serializers$DIRECTION; public static final Object Serializers$OPTIONAL_UUID; + public static final Object Serializers$OPTIONAL_LIVING_ENTITY_REFERENCE; public static final Object Serializers$OPTIONAL_GLOBAL_POS; public static final Object Serializers$COMPOUND_TAG; public static final Object Serializers$VILLAGER_DATA; @@ -83,7 +84,10 @@ public class EntityDataValue { Serializers$BLOCK_POS = initSerializersByName("BLOCK_POS"); Serializers$OPTIONAL_BLOCK_POS = initSerializersByName("OPTIONAL_BLOCK_POS"); Serializers$DIRECTION = initSerializersByName("DIRECTION"); - Serializers$OPTIONAL_UUID = initSerializersByName("OPTIONAL_UUID"); + if (!VersionHelper.isVersionNewerThan1_21_5()) Serializers$OPTIONAL_UUID = initSerializersByName("OPTIONAL_UUID"); + else Serializers$OPTIONAL_UUID = null; + if (VersionHelper.isVersionNewerThan1_21_5()) Serializers$OPTIONAL_LIVING_ENTITY_REFERENCE = initSerializersByName("OPTIONAL_LIVING_ENTITY_REFERENCE"); + else Serializers$OPTIONAL_LIVING_ENTITY_REFERENCE = null; Serializers$OPTIONAL_GLOBAL_POS = initSerializersByName("OPTIONAL_GLOBAL_POS"); Serializers$COMPOUND_TAG = initSerializersByName("COMPOUND_TAG"); Serializers$VILLAGER_DATA = initSerializersByName("VILLAGER_DATA"); diff --git a/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/Reflections.java b/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/Reflections.java index ca395c5..b8e2633 100644 --- a/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/Reflections.java +++ b/platforms/bukkit/src/main/java/net/momirealms/customnameplates/bukkit/util/Reflections.java @@ -1035,12 +1035,40 @@ public class Reflections { ) ); - public static final Field field$ClientboundSetPlayerTeamPacket$Parameters$nametagVisibility = requireNonNull( - ReflectionUtils.getInstanceDeclaredField( - clazz$ClientboundSetPlayerTeamPacket$Parameters, String.class, 0 + public static final Class clazz$Team$Visibility = requireNonNull( + ReflectionUtils.getClazz( + BukkitReflectionUtils.assembleMCClass("world.scores.ScoreboardTeam$EnumNameTagVisibility"), + BukkitReflectionUtils.assembleMCClass("world.scores.Team$Visibility") ) ); + public static final Field field$ClientboundSetPlayerTeamPacket$Parameters$nametagVisibility = requireNonNull( + VersionHelper.isVersionNewerThan1_21_5() ? + ReflectionUtils.getInstanceDeclaredField( + clazz$ClientboundSetPlayerTeamPacket$Parameters, clazz$Team$Visibility, 0 + ) + : ReflectionUtils.getInstanceDeclaredField( + clazz$ClientboundSetPlayerTeamPacket$Parameters, String.class, 0 + ) + ); + + public static final Method method$Team$Visibility$values = requireNonNull( + ReflectionUtils.getStaticMethod( + clazz$Team$Visibility, clazz$Team$Visibility.arrayType() + ) + ); + + public static final Object instance$Team$Visibility$NEVER; + + static { + try { + Object[] values = (Object[]) method$Team$Visibility$values.invoke(null); + instance$Team$Visibility$NEVER = values[1]; + } catch (ReflectiveOperationException e) { + throw new RuntimeException(e); + } + } + public static final Class clazz$ServerConnectionListener = requireNonNull( ReflectionUtils.getClazz( BukkitReflectionUtils.assembleMCClass("server.network.ServerConnectionListener"),