Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

[1.10.2] general.json re-setting #335

Closed
Rasgnarok opened this issue Aug 27, 2016 · 16 comments
Closed

[1.10.2] general.json re-setting #335

Rasgnarok opened this issue Aug 27, 2016 · 16 comments
Assignees

Comments

@Rasgnarok
Copy link

Rasgnarok commented Aug 27, 2016

I am having a strange error where all my warps have suddenly have gone amiss. There are none left in the /main/nucleus config, and no general.json is appearing in /main/config/nucleus. I have tried copying the backup general.json file I had, and then reloading the nucleus config, but /warp list did not show the warps present in the file. At this point, after both steps, I checked and reloaded the directory to make sure the general.json was still present; and it was.

Only a minute later, I reloaded the directory again and the general.json was empty, all warps, and kits gone. Which makes me think this ties in with an issue I had with firstjoinkit (and other kits), which simply was not present sometimes, and then it is other times.

Overall, seems the configs are faulty, and empty out on random occasions.

Mods:
spongeforge-1.10.2-2073-5.0.0-BETA-1683.jar
Nucleus-0.7.2-S5-1.10-plugin.jar

@Rasgnarok Rasgnarok changed the title [1.10.2] Warps re-setting [1.10.2] general.json re-setting Aug 27, 2016
@dualspiral
Copy link
Member

I think there is a real issue here where I think my code is unable to load the general file when items in kits are no longer present. It's hard to reproduce, but I'll do my best to do so and see what's going on.

@dualspiral
Copy link
Member

OH! You're using 0.7.2. Try updating to 0.8.1, I think a change in Sponge may have caused this to break, which 0.8.1 patches.

@FiveEYZ
Copy link

FiveEYZ commented Aug 27, 2016

yes 0.8.1 fixes this

@Rasgnarok
Copy link
Author

Can't confirm, have opened another issue.
#338

@Rasgnarok
Copy link
Author

Sadly, I am still having the issue - I am now using 0.8.1 and sf 1687. The general.json is still the same, and if I try replacing it with the old one and then doing /nucleus reload, it doesn't work. A restart of the server regenerates an empty json. What was the sf version that fixed this for you, @FiveEYZ ?

As it is, I have no warps and no kits.

dualspiral added a commit that referenced this issue Sep 10, 2016
@dualspiral
Copy link
Member

Question - do you have any plugins that add extra data to items that you've put into kits?

dualspiral added a commit that referenced this issue Sep 10, 2016
@Rasgnarok
Copy link
Author

What would you mean? I did use NBT tags (for rule books) but that was done using plain vanilla methods. Other than that, I also had Pixelmon items. Though I doubt that is it.

@dualspiral
Copy link
Member

Actually, I wonder if it is the NBT tags - in which case, this might actually point to the Sponge translator not working properly and may need to be reported to Sponge. I'll investigate this.

I think I have a solution that would prevent the file being wiped. It wouldn't help with the items that would have custom NBT in them though (but rather than wiping the file, Nucleus would just ignore them for now), but that might be the key to this.

It's not a perfect solution though. I'm gonna keep on trying to solve this completely.

@Rasgnarok
Copy link
Author

Well at least with that, I could actually confirm if this is the issue. Looking back, it might be that - even when I was trying to put back the old general.json, as it had the written and signed books in it (which are stored as NBT tags). If it is the case, then let me know if you want me to report it to Sponge.

@dualspiral
Copy link
Member

Could I get a sample of the general.json that has the NBT in it, if it does ever get saved? Either that, or commands you run (can be garbage text) to create a book? I might be able to work out what needs to be done and at least work around it if it takes some time.

If you can confirm you get the failiure ONLY when adding NBT altered books, or something like that, then yeah, I think we've finally gotten to the bottom of this and we can start creating solutions.

If this is Sponge, the Configurate DataTranslator is not accepting NBT tags, at least in 1.10.x. I should be able to then create a simple test plugin to provide them with.

Sorry this has taken so long, but I've made changes to Nucleus that would mitigate this too, so everyone wins!

@dualspiral dualspiral self-assigned this Sep 10, 2016
@dualspiral
Copy link
Member

dualspiral commented Sep 12, 2016

OK, so I did some digging, and I think I've solved what's going on. Could you test with this build?

Nucleus-0.10.0-5.0-SNAPSHOT-all.zip

After putting NBT tags in like you suggested with 0.9, restarting the server, then trying to redeem the kit, I get the following error:

[21:48:59] [Server thread/INFO] [nucleus]: dualspiral ran the command: /kit booktest
[21:48:59] [Server thread/ERROR] [Sponge]:
java.lang.NullPointerException
        at io.github.nucleuspowered.nucleus.dataservices.GeneralService.getKit(GeneralService.java:77) ~[GeneralService.class:0.9.0-5.0-SNAPSHOT]
        at io.github.nucleuspowered.nucleus.modules.kit.handlers.KitHandler.getKit(KitHandler.java:29) ~[KitHandler.class:0.9.0-5.0-SNAPSHOT]
        at io.github.nucleuspowered.nucleus.argumentparsers.KitArgument.parseValue(KitArgument.java:46) ~[KitArgument.class:0.9.0-5.0-SNAPSHOT]
        at org.spongepowered.api.command.args.CommandElement.parse(CommandElement.java:83) ~[CommandElement.class:1.10.2-2073-5.0.0-BETA-1710]
        at org.spongepowered.api.command.args.GenericArguments$OnlyOneCommandElement.parse(GenericArguments.java:1416) ~[GenericArguments$OnlyOneCommandElement.class:1.10.2-2073-5.0.0-BETA-1710]
        at org.spongepowered.api.command.args.GenericArguments$SequenceCommandElement.parse(GenericArguments.java:275) ~[GenericArguments$SequenceCommandElement.class:1.10.2-2073-5.0.0-BETA-1710]
        at org.spongepowered.api.command.args.GenericArguments$FirstParsingCommandElement.parse(GenericArguments.java:457) ~[GenericArguments$FirstParsingCommandElement.class:1.10.2-2073-5.0.0-BETA-1710]
        at org.spongepowered.api.command.spec.CommandSpec.populateContext(CommandSpec.java:285) ~[CommandSpec.class:1.10.2-2073-5.0.0-BETA-1710]
        at org.spongepowered.api.command.spec.CommandSpec.process(CommandSpec.java:331) ~[CommandSpec.class:1.10.2-2073-5.0.0-BETA-1710]
        at org.spongepowered.api.command.dispatcher.SimpleDispatcher.process(SimpleDispatcher.java:333) ~[SimpleDispatcher.class:1.10.2-2073-5.0.0-BETA-1710]

and the message on the client

and I check my general.json file and it is indeed blank.

With this build, it works... which I was not actually expecting. I think that Sponge can handle translating the NBT, but only when the game has started because, well, it needs the game to have started in order to load the NBT! That's essentially what the patch I committed a few days ago does, it only does the translation when required, rather than during post init.

So, to me, it looks like I've fixed the error by accident. I'd just like the confirmation.

Is it something to report to Sponge? I don't know, this might be intended, but I suspect it might catch other developers out...

TL; DR: When loading an item from configuration that contains NBT, the ItemStackTranslator can't load it properly until after the game start sequence, loading it during post-init (or before) doesn't work so well...

@Rasgnarok
Copy link
Author

Huh, I had not seen your reply, apologies. At any rate, the books weren't set through commanda or anything - I just wrote and signed them, and simply set the kit with them in the inventory.

I have been using the kits without books and sp far, no resetting - so I think that was the issue? Regardless, I can certainly test it on my server tonight.

I'll keep you posted on how it goes.

@dualspiral
Copy link
Member

Thank you!

@dualspiral
Copy link
Member

For those using 1.8 - Nucleus-1.8-0.10.0-SNAPSHOT-all.zip

@dualspiral
Copy link
Member

dualspiral commented Sep 14, 2016

https://forums.spongepowered.org/t/0-9-0-nucleus-the-ultimate-essentials-plugin-mc-1-8-9-and-1-10-2/11792/537?u=dualspiral

Confirmation this build works. Closing.

@Rasgnarok
Copy link
Author

Yup - they do. Thanks again for your work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants