This commit is contained in:
YuTian 2024-07-19 17:41:10 +08:00
parent f0c7d4c544
commit edd525cfcc
3 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import com.io.yutian.aulib.exception.SerializeException;
import com.io.yutian.aulib.serialize.serializers.ItemStackSerializer;
import com.io.yutian.aulib.serialize.serializers.UUIDSerializer;
import com.io.yutian.aulib.util.ReflectionUtil;
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.json.JSONArray;
import org.json.JSONObject;
@ -164,6 +165,9 @@ public class SerializeHelper {
}
return jsonObject;
} else {
if (clazz.toString().startsWith("net.minecraft")) {
return null;
}
return serialize(value);
}
}
@ -179,6 +183,7 @@ public class SerializeHelper {
WRAPPER_TO_PRIMITIVE.put(Long.class, long.class);
WRAPPER_TO_PRIMITIVE.put(Float.class, float.class);
WRAPPER_TO_PRIMITIVE.put(Double.class, double.class);
WRAPPER_TO_PRIMITIVE.put(CraftItemStack.class, ItemStack.class);
registerSerializer(UUID.class, new UUIDSerializer());
registerSerializer(ItemStack.class, new ItemStackSerializer());

View File

@ -17,7 +17,7 @@ public class ItemStackSerializer implements Serializer<ItemStack> {
jsonObject.put("Count", nmsItemStack.J());
NBTTagCompound nbtTagCompound = nmsItemStack.u();
jsonObject.put("Tag", nbtTagCompound.toString());
return null;
return jsonObject;
}
@Override

View File

@ -1,5 +1,5 @@
name: AuLib
main: com.io.yutian.aulib.AuLib
version: 1.6
version: 1.6.1
api-version: 1.18
author: SuperYuTian