mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +01:00
Use the correct JsonReader constructor in 1.8
Fixes aadnk#121
This commit is contained in:
parent
98413c917e
commit
e439c778a6
@ -17,6 +17,7 @@
|
|||||||
package com.comphenix.protocol.wrappers;
|
package com.comphenix.protocol.wrappers;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ public class ComponentParser {
|
|||||||
private static Object deserializeLegacy(Object gson, Class<?> component, StringReader str) {
|
private static Object deserializeLegacy(Object gson, Class<?> component, StringReader str) {
|
||||||
try {
|
try {
|
||||||
Class<?> readerClass = Class.forName("org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonReader");
|
Class<?> readerClass = Class.forName("org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonReader");
|
||||||
Object reader = readerClass.getConstructor(StringReader.class).newInstance(str);
|
Object reader = readerClass.getConstructor(Reader.class).newInstance(str);
|
||||||
Method setLenient = readerClass.getMethod("setLenienent", boolean.class);
|
Method setLenient = readerClass.getMethod("setLenienent", boolean.class);
|
||||||
setLenient.invoke(reader, true);
|
setLenient.invoke(reader, true);
|
||||||
Method getAdapter = gson.getClass().getMethod("getAdapter", Class.class);
|
Method getAdapter = gson.getClass().getMethod("getAdapter", Class.class);
|
||||||
@ -56,4 +57,4 @@ public class ComponentParser {
|
|||||||
throw new RuntimeException("Failed to read JSON", ex);
|
throw new RuntimeException("Failed to read JSON", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user