9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-19 15:09:23 +00:00
This commit is contained in:
XiaoMoMi
2025-04-20 16:18:21 +08:00
parent 8f23416ed6
commit c25e222187
11 changed files with 73 additions and 32 deletions

View File

@@ -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 * Checks if the server version is newer than 1.21.4
* *
* @return True if the version is newer than 1.21.4, otherwise false. * @return True if the version is newer than 1.21.4, otherwise false.
*/ */
public static boolean isVersionNewerThan1_21_4() { 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. * @return True if the version is newer than 1.21.2, otherwise false.
*/ */
public static boolean isVersionNewerThan1_21_2() { 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. * @return True if the version is newer than 1.20.5, otherwise false.
*/ */
public static boolean isVersionNewerThan1_20_5() { 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. * @return True if the version is newer than 1.20.4, otherwise false.
*/ */
public static boolean isVersionNewerThan1_20_4() { 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. * @return True if the version is newer than 1.19.4, otherwise false.
*/ */
public static boolean isVersionNewerThan1_19_4() { 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. * @return True if the version is newer than 1.20.2, otherwise false.
*/ */
public static boolean isVersionNewerThan1_20_2() { 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. * @return True if the version is newer than 1.20, otherwise false.
*/ */
public static boolean isVersionNewerThan1_20() { public static boolean isVersionNewerThan1_20() {
return version >= 20; return version >= 20f;
} }
/** /**

View File

@@ -4,7 +4,7 @@
"description": "CustomNameplates", "description": "CustomNameplates",
"supported_formats": { "supported_formats": {
"min_inclusive": 13, "min_inclusive": 13,
"max_inclusive": 51 "max_inclusive": 99
} }
}, },
"overlays": { "overlays": {
@@ -26,7 +26,7 @@
{ {
"formats": { "formats": {
"min_inclusive": 46, "min_inclusive": 46,
"max_inclusive": 51 "max_inclusive": 99
}, },
"directory": "overlay_1_21_4" "directory": "overlay_1_21_4"
} }

View File

@@ -4,7 +4,7 @@
"description": "CustomNameplates", "description": "CustomNameplates",
"supported_formats": { "supported_formats": {
"min_inclusive": 32, "min_inclusive": 32,
"max_inclusive": 51 "max_inclusive": 99
} }
}, },
"overlays": { "overlays": {
@@ -19,7 +19,7 @@
{ {
"formats": { "formats": {
"min_inclusive": 46, "min_inclusive": 46,
"max_inclusive": 51 "max_inclusive": 99
}, },
"directory": "overlay_1_21_4" "directory": "overlay_1_21_4"
} }

View File

@@ -4,7 +4,7 @@
"description": "CustomNameplates", "description": "CustomNameplates",
"supported_formats": { "supported_formats": {
"min_inclusive": 42, "min_inclusive": 42,
"max_inclusive": 51 "max_inclusive": 99
} }
}, },
"overlays": { "overlays": {
@@ -12,7 +12,7 @@
{ {
"formats": { "formats": {
"min_inclusive": 46, "min_inclusive": 46,
"max_inclusive": 51 "max_inclusive": 99
}, },
"directory": "overlay_1_21_4" "directory": "overlay_1_21_4"
} }

View File

@@ -4,7 +4,7 @@
"description": "CustomNameplates", "description": "CustomNameplates",
"supported_formats": { "supported_formats": {
"min_inclusive": 46, "min_inclusive": 46,
"max_inclusive": 51 "max_inclusive": 99
} }
} }
} }

View File

@@ -3,7 +3,7 @@ import java.io.ByteArrayOutputStream
plugins { plugins {
id("java") id("java")
id("com.gradleup.shadow") version "9.0.0-beta6" id("com.gradleup.shadow") version "9.0.0-beta11"
} }
val git : String = versionBanner() val git : String = versionBanner()

View File

@@ -9,17 +9,17 @@ lang=en,zh_cn
# Dependency settings # Dependency settings
paper_version=1.20.4 paper_version=1.20.4
jetbrains_annotations_version=24.0.0 jetbrains_annotations_version=26.0.2
slf4j_version=2.0.16 slf4j_version=2.0.17
log4j_version=2.24.1 log4j_version=2.24.3
gson_version=2.11.0 gson_version=2.11.0
asm_version=9.8 asm_version=9.8
asm_commons_version=9.8 asm_commons_version=9.8
jar_relocator_version=1.7 jar_relocator_version=1.7
h2_driver_version=2.3.232 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_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_core_version=2.0.0
cloud_services_version=2.0.0 cloud_services_version=2.0.0
cloud_brigadier_version=2.0.0-beta.10 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 boosted_yaml_version=1.3.7
byte_buddy_version=1.17.5 byte_buddy_version=1.17.5
mojang_brigadier_version=1.0.18 mojang_brigadier_version=1.0.18
mongodb_driver_version=5.3.1 mongodb_driver_version=5.4.0
mariadb_driver_version=3.5.1 mariadb_driver_version=3.5.3
mysql_driver_version=9.2.0 mysql_driver_version=9.2.0
hikari_version=5.1.0 hikari_version=5.1.0
commons_pool_version=2.12.0 commons_pool_version=2.12.1
bstats_version=3.1.0 bstats_version=3.1.0
geantyref_version=1.3.16 geantyref_version=1.3.16
caffeine_version=3.1.8 caffeine_version=3.2.0
jedis_version=5.2.0 jedis_version=5.2.0
exp4j_version=0.4.8 exp4j_version=0.4.8
placeholder_api_version=2.11.6 placeholder_api_version=2.11.6
vault_version=1.7 vault_version=1.7
guava_version=33.3.1-jre guava_version=33.4.8-jre
commons_io_version=2.17.0 commons_io_version=2.19.0
lwjgl_version=3.3.4 lwjgl_version=3.3.4
fastutil_version=8.5.15 fastutil_version=8.5.15

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -431,7 +431,7 @@ public class BukkitPlatform implements Platform {
Optional<Object> optionalParameters = (Optional<Object>) Reflections.field$ClientboundSetPlayerTeamPacket$parameters.get(packet); Optional<Object> optionalParameters = (Optional<Object>) Reflections.field$ClientboundSetPlayerTeamPacket$parameters.get(packet);
if (optionalParameters.isPresent()) { if (optionalParameters.isPresent()) {
Object parameters = optionalParameters.get(); 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 // remove

View File

@@ -49,6 +49,7 @@ public class EntityDataValue {
public static final Object Serializers$OPTIONAL_BLOCK_POS; public static final Object Serializers$OPTIONAL_BLOCK_POS;
public static final Object Serializers$DIRECTION; public static final Object Serializers$DIRECTION;
public static final Object Serializers$OPTIONAL_UUID; 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$OPTIONAL_GLOBAL_POS;
public static final Object Serializers$COMPOUND_TAG; public static final Object Serializers$COMPOUND_TAG;
public static final Object Serializers$VILLAGER_DATA; public static final Object Serializers$VILLAGER_DATA;
@@ -83,7 +84,10 @@ public class EntityDataValue {
Serializers$BLOCK_POS = initSerializersByName("BLOCK_POS"); Serializers$BLOCK_POS = initSerializersByName("BLOCK_POS");
Serializers$OPTIONAL_BLOCK_POS = initSerializersByName("OPTIONAL_BLOCK_POS"); Serializers$OPTIONAL_BLOCK_POS = initSerializersByName("OPTIONAL_BLOCK_POS");
Serializers$DIRECTION = initSerializersByName("DIRECTION"); 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$OPTIONAL_GLOBAL_POS = initSerializersByName("OPTIONAL_GLOBAL_POS");
Serializers$COMPOUND_TAG = initSerializersByName("COMPOUND_TAG"); Serializers$COMPOUND_TAG = initSerializersByName("COMPOUND_TAG");
Serializers$VILLAGER_DATA = initSerializersByName("VILLAGER_DATA"); Serializers$VILLAGER_DATA = initSerializersByName("VILLAGER_DATA");

View File

@@ -1035,12 +1035,40 @@ public class Reflections {
) )
); );
public static final Field field$ClientboundSetPlayerTeamPacket$Parameters$nametagVisibility = requireNonNull( public static final Class<?> clazz$Team$Visibility = requireNonNull(
ReflectionUtils.getInstanceDeclaredField( ReflectionUtils.getClazz(
clazz$ClientboundSetPlayerTeamPacket$Parameters, String.class, 0 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( public static final Class<?> clazz$ServerConnectionListener = requireNonNull(
ReflectionUtils.getClazz( ReflectionUtils.getClazz(
BukkitReflectionUtils.assembleMCClass("server.network.ServerConnectionListener"), BukkitReflectionUtils.assembleMCClass("server.network.ServerConnectionListener"),