NBT-API

NBT-API

98.9k Downloads

able to change gson settings.

portlek opened this issue ยท 6 comments

commented

it'd be nice to change gson settings in the gson wrapper.

commented

Uhm, I'm not sure about keeping the current 2 gson methods in the code, since most people just misuse them. Since they just call the setString method, if you need any customization for Gson, best case just implement that yourself.
nbt.setObject("foo", new Object()); is equivalent to nbt.setString("foo", gson.toJson(new Object());
What kind of change of you have in mind?

commented

just a simple method for GsonWrapper class #setGson(Gson)

commented

Like I said, currently more considering removing the entire GsonWrapper instead of extending it. Do you try to add adapters to the gson instance?

commented

ok then, i'll use jackson for it i don't like how gson works tbh.

commented

Since the entire gson thing is a one line thing, either write a custom writer/loader around your class(planning for 3.0 to make that simpler) or throw your class into gson/jackson/whatever and set the string into the nbt. Just a small thing, I think having formatting with newlines enabled might not be the best idea, since that just adds extra bytes and noise.

commented

Ok did add the method, but also marked the entire class and the parts using it as Deprecated. Best-case really shouldn't be used.