mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-21 07:59:22 +00:00
fix scale
This commit is contained in:
@@ -70,7 +70,7 @@ public abstract class CustomNameplates implements NameplatesPlugin {
|
|||||||
protected MainTask mainTask;
|
protected MainTask mainTask;
|
||||||
protected SchedulerTask scheduledMainTask;
|
protected SchedulerTask scheduledMainTask;
|
||||||
protected ConcurrentHashMap<UUID, CNPlayer> onlinePlayerMap = new ConcurrentHashMap<>();
|
protected ConcurrentHashMap<UUID, CNPlayer> onlinePlayerMap = new ConcurrentHashMap<>();
|
||||||
protected Int2ObjectOpenHashMap<CNPlayer> entityIDFastLookup = new Int2ObjectOpenHashMap<>();
|
protected ConcurrentHashMap<Integer, CNPlayer> entityIDFastLookup = new ConcurrentHashMap<>();
|
||||||
protected AdvanceManager advanceManager;
|
protected AdvanceManager advanceManager;
|
||||||
protected BackgroundManager backgroundManager;
|
protected BackgroundManager backgroundManager;
|
||||||
protected EventManager eventManager;
|
protected EventManager eventManager;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package net.momirealms.customnameplates.bukkit;
|
|||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.momirealms.customnameplates.api.CNPlayer;
|
import net.momirealms.customnameplates.api.CNPlayer;
|
||||||
import net.momirealms.customnameplates.api.ConfigManager;
|
import net.momirealms.customnameplates.api.ConfigManager;
|
||||||
import net.momirealms.customnameplates.api.CustomNameplates;
|
import net.momirealms.customnameplates.api.CustomNameplates;
|
||||||
@@ -103,6 +105,9 @@ public class BukkitPlatform implements Platform {
|
|||||||
// some plugins would send null to clear the actionbar, what a bad solution
|
// some plugins would send null to clear the actionbar, what a bad solution
|
||||||
Object component = Optional.ofNullable(Reflections.field$ClientboundSetActionBarTextPacket$text.get(packet)).orElse(Reflections.instance$Component$empty);
|
Object component = Optional.ofNullable(Reflections.field$ClientboundSetActionBarTextPacket$text.get(packet)).orElse(Reflections.instance$Component$empty);
|
||||||
Object contents = Reflections.method$Component$getContents.invoke(component);
|
Object contents = Reflections.method$Component$getContents.invoke(component);
|
||||||
|
if (contents == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Reflections.clazz$ScoreContents.isAssignableFrom(contents.getClass())) {
|
if (Reflections.clazz$ScoreContents.isAssignableFrom(contents.getClass())) {
|
||||||
//String name = scoreContentNameFunction.apply(Reflections.field$ScoreContents$name.get(contents));
|
//String name = scoreContentNameFunction.apply(Reflections.field$ScoreContents$name.get(contents));
|
||||||
String objective = (String) Reflections.field$ScoreContents$objective.get(contents);
|
String objective = (String) Reflections.field$ScoreContents$objective.get(contents);
|
||||||
@@ -305,7 +310,7 @@ public class BukkitPlatform implements Platform {
|
|||||||
Object attributeHolder = Reflections.field$ClientboundUpdateAttributesPacket$AttributeSnapshot$attribute.get(attributeSnapshot);
|
Object attributeHolder = Reflections.field$ClientboundUpdateAttributesPacket$AttributeSnapshot$attribute.get(attributeSnapshot);
|
||||||
Object attribute = Reflections.method$Holder$value.invoke(attributeHolder);
|
Object attribute = Reflections.method$Holder$value.invoke(attributeHolder);
|
||||||
String id = (String) Reflections.field$Attribute$id.get(attribute);
|
String id = (String) Reflections.field$Attribute$id.get(attribute);
|
||||||
if (id.equals("attribute.name.generic.scale")) {
|
if (id.equals("attribute.name.generic.scale") || id.equals("attribute.name.scale")) {
|
||||||
double baseValue = (double) Reflections.field$ClientboundUpdateAttributesPacket$AttributeSnapshot$base.get(attributeSnapshot);
|
double baseValue = (double) Reflections.field$ClientboundUpdateAttributesPacket$AttributeSnapshot$base.get(attributeSnapshot);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Collection<Object> modifiers = (Collection<Object>) Reflections.field$ClientboundUpdateAttributesPacket$AttributeSnapshot$modifiers.get(attributeSnapshot);
|
Collection<Object> modifiers = (Collection<Object>) Reflections.field$ClientboundUpdateAttributesPacket$AttributeSnapshot$modifiers.get(attributeSnapshot);
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ public class Reflections {
|
|||||||
try {
|
try {
|
||||||
Field field = ReflectionUtils.getDeclaredField(
|
Field field = ReflectionUtils.getDeclaredField(
|
||||||
clazz$ClientboundBossEventPacket,
|
clazz$ClientboundBossEventPacket,
|
||||||
"f", "REMOVE_OPERATION");
|
VersionHelper.isVersionNewerThan1_20_5() ? "g" : "f", "REMOVE_OPERATION");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
instance$ClientboundBossEventPacket$REMOVE_OPERATION = requireNonNull(field.get(null));
|
instance$ClientboundBossEventPacket$REMOVE_OPERATION = requireNonNull(field.get(null));
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user