From 66a51df12bfa082cf846d2c6909e8ff53c3ea3ce Mon Sep 17 00:00:00 2001 From: montlikadani Date: Thu, 25 Jun 2020 11:55:18 +0200 Subject: [PATCH] Fix issue when the actionbar not works on 1.16 versions --- .../com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java b/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java index 948fdb59..cce216a9 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java @@ -4,6 +4,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.UUID; import java.util.logging.Level; import org.bukkit.Bukkit; @@ -87,7 +88,10 @@ public class ActionBarTitleMessages { } Object serialized = nmsChatSerializer.getMethod("a", String.class).invoke(null, "{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', msg) + "\"}"); - if (Version.isCurrentHigher(Version.v1_11_R1)) + if (Version.isCurrentEqualOrHigher(Version.v1_16_R1)) { + packet = packetType.getConstructor(nmsIChatBaseComponent, sub, UUID.class) + .newInstance(serialized, consts[2], receivingPacket.getUniqueId()); + } else if (Version.isCurrentHigher(Version.v1_11_R1)) packet = packetType.getConstructor(nmsIChatBaseComponent, sub).newInstance(serialized, consts[2]); else if (Version.isCurrentHigher(Version.v1_7_R4)) { packet = packetType.getConstructor(nmsIChatBaseComponent, byte.class).newInstance(serialized, (byte) 2);