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>
|
<!-- <dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency> -->
|
</dependency> -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.webbukkit</groupId>
|
<groupId>com.github.webbukkit</groupId>
|
||||||
|
|
|
@ -7,6 +7,8 @@ import lombok.val;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.function.BiPredicate;
|
import java.util.function.BiPredicate;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
@ -84,7 +86,16 @@ public class VanillaUtils {
|
||||||
val chatcompcl = Class.forName(nms + ".IChatBaseComponent");
|
val chatcompcl = Class.forName(nms + ".IChatBaseComponent");
|
||||||
//val chatcomarrcl = Class.forName("[L" + chatcompcl.getName() + ";");
|
//val chatcomarrcl = Class.forName("[L" + chatcompcl.getName() + ";");
|
||||||
val chatcomparr = Array.newInstance(chatcompcl, 1);
|
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 ccucl = Class.forName(nms + ".ChatComponentUtils");
|
||||||
val iclcl = Class.forName(nms + ".ICommandListener");
|
val iclcl = Class.forName(nms + ".ICommandListener");
|
||||||
|
@ -101,7 +112,10 @@ public class VanillaUtils {
|
||||||
val deserialized = am.invoke(null, jsonStr);
|
val deserialized = am.invoke(null, jsonStr);
|
||||||
//val filtered = ffdm.invoke(null, hhandle, deserialized, hhandle);
|
//val filtered = ffdm.invoke(null, hhandle, deserialized, hhandle);
|
||||||
Array.set(chatcomparr, 0, deserialized);
|
Array.set(chatcomparr, 0, deserialized);
|
||||||
sendmsg.invoke(hhandle, chatcomparr);
|
if (sendmsg.getParameterCount() == 2)
|
||||||
|
sendmsg.invoke(hhandle, null, chatcomparr); //
|
||||||
|
else
|
||||||
|
sendmsg.invoke(hhandle, chatcomparr);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in a new issue