Support ChatComponent
This commit is contained in:
parent
49d716f285
commit
cbe1a09ded
@ -881,9 +881,24 @@ public class ReflectionManager {
|
|||||||
if (value instanceof Optional) {
|
if (value instanceof Optional) {
|
||||||
Optional opt = (Optional) value;
|
Optional opt = (Optional) value;
|
||||||
|
|
||||||
serializer = Registry.get((opt.isPresent() ?
|
if (opt.isPresent()) {
|
||||||
getNmsClass("IBlockData").isInstance(opt.get()) ? getNmsClass("IBlockData") : opt.get().getClass() :
|
Object val = opt.get();
|
||||||
UUID.class), true);
|
Class cl;
|
||||||
|
Class iBlockData = getNmsClass("IBlockData");
|
||||||
|
Class iChat = getNmsClass("IChatBaseComponent");
|
||||||
|
|
||||||
|
if (iBlockData.isInstance(val)) {
|
||||||
|
cl = iBlockData;
|
||||||
|
} else if (iChat.isInstance(val)) {
|
||||||
|
cl = iChat;
|
||||||
|
} else {
|
||||||
|
cl = val.getClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
serializer = Registry.get(cl, true);
|
||||||
|
} else {
|
||||||
|
serializer = Registry.get(UUID.class, true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
serializer = Registry.get(getNmsClass("ParticleParam").isInstance(value) ? getNmsClass("ParticleParam") :
|
serializer = Registry.get(getNmsClass("ParticleParam").isInstance(value) ? getNmsClass("ParticleParam") :
|
||||||
value.getClass());
|
value.getClass());
|
||||||
|
Loading…
Reference in New Issue
Block a user