Fix tellRaw for 1.16.4/1.16.5
This commit is contained in:
parent
9a10dcd1fc
commit
724858ac70
2 changed files with 17 additions and 4 deletions
3
pom.xml
3
pom.xml
|
@ -161,8 +161,7 @@
|
|||
<!-- <dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>com.github.webbukkit</groupId>
|
||||
|
|
|
@ -7,6 +7,8 @@ import lombok.val;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.UUID;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
|
@ -84,7 +86,16 @@ public class VanillaUtils {
|
|||
val chatcompcl = Class.forName(nms + ".IChatBaseComponent");
|
||||
//val chatcomarrcl = Class.forName("[L" + chatcompcl.getName() + ";");
|
||||
val chatcomparr = Array.newInstance(chatcompcl, 1);
|
||||
val sendmsg = handle.getClass().getMethod("sendMessage", chatcomparr.getClass());
|
||||
final Method sendmsg;
|
||||
{
|
||||
Method sendmsg1;
|
||||
try {
|
||||
sendmsg1 = handle.getClass().getMethod("sendMessage", UUID.class, chatcomparr.getClass());
|
||||
} catch (NoSuchMethodException e) {
|
||||
sendmsg1 = handle.getClass().getMethod("sendMessage", chatcomparr.getClass());
|
||||
}
|
||||
sendmsg = sendmsg1;
|
||||
}
|
||||
|
||||
/*val ccucl = Class.forName(nms + ".ChatComponentUtils");
|
||||
val iclcl = Class.forName(nms + ".ICommandListener");
|
||||
|
@ -101,6 +112,9 @@ public class VanillaUtils {
|
|||
val deserialized = am.invoke(null, jsonStr);
|
||||
//val filtered = ffdm.invoke(null, hhandle, deserialized, hhandle);
|
||||
Array.set(chatcomparr, 0, deserialized);
|
||||
if (sendmsg.getParameterCount() == 2)
|
||||
sendmsg.invoke(hhandle, null, chatcomparr); //
|
||||
else
|
||||
sendmsg.invoke(hhandle, chatcomparr);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in a new issue