From 1a800f7ae3825546c88ff77eb4cbbdbdc04b8390 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 17 Jan 2022 16:43:44 +1300 Subject: [PATCH] In the case we're doing a copy entity disguise, try avoid failing a copy. Doesn't fix the underlying issue I believe. --- .../disguise/disguisetypes/FlagWatcher.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 6271f51e..bb8c0aec 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -97,7 +97,7 @@ public class FlagWatcher { } PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacketConstructor(Server.ENTITY_TELEPORT, getDisguise().getEntity()) - .createPacket(getDisguise().getEntity()); + .createPacket(getDisguise().getEntity()); try { for (Player player : DisguiseUtilities.getPerverts(getDisguise())) { @@ -343,7 +343,7 @@ public class FlagWatcher { float health = ((Number) watch.getRawValue()).floatValue(); String name = DisguiseConfig.isScoreboardNames() && ((PlayerDisguise) getDisguise()).hasScoreboardName() ? - ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : ((PlayerDisguise) getDisguise()).getName(); + ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : ((PlayerDisguise) getDisguise()).getName(); ReflectionManager.setScore(player.getScoreboard(), name, (int) Math.ceil(health)); } @@ -383,7 +383,7 @@ public class FlagWatcher { } String name = DisguiseConfig.isScoreboardNames() && ((PlayerDisguise) getDisguise()).hasScoreboardName() ? - ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : ((PlayerDisguise) getDisguise()).getName(); + ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : ((PlayerDisguise) getDisguise()).getName(); ReflectionManager.setScore(player.getScoreboard(), name, (int) Math.ceil(health)); } @@ -580,7 +580,7 @@ public class FlagWatcher { if (NmsVersion.v1_13.isSupported()) { Optional optional = - Optional.of(WrappedChatComponent.fromJson(DisguiseUtilities.serialize(DisguiseUtilities.getAdventureChat(name)))); + Optional.of(WrappedChatComponent.fromJson(DisguiseUtilities.serialize(DisguiseUtilities.getAdventureChat(name)))); setData(MetaIndex.ENTITY_CUSTOM_NAME, optional); } else { @@ -1022,7 +1022,11 @@ public class FlagWatcher { @Deprecated public void setUnsafeData(MetaIndex id, Y value) { - setData(id, value); + if (!id.getDefault().getClass().isInstance(value)) { + setBackupValue(id, value); + } else { + setData(id, value); + } } protected void setData(MetaIndex id, Y value) {