Andrew2070 / Empires-Mod

The Empires Mod is designed to provide fun and reliable protection to modded Minecraft servers.
GNU Lesser General Public License v2.1
3 stars 2 forks source link

[BUG] Renaming Empires Does Not Work #6

Closed Andrew2070 closed 6 years ago

Andrew2070 commented 6 years ago

Stacktrace: [22:52:46] [Server thread/ERROR]: Couldn't process command: 'emp rename 1123' java.lang.NullPointerException at com.EmpireMod.Empires.Datasource.EmpiresDatasource.saveEmpire(EmpiresDatasource.java:531) ~[EmpiresDatasource.class:?] at com.EmpireMod.Empires.commands.Officer.CommandsOfficer.renameCommand(CommandsOfficer.java:825) ~[CommandsOfficer.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_73] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_73] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_73] at com.EmpireMod.Empires.API.permissions.CommandTreeNode.commandCall(CommandTreeNode.java:103) ~[CommandTreeNode.class:?] at com.EmpireMod.Empires.API.permissions.CommandTree.commandCall(CommandTree.java:39) ~ [22:52:46] [Client thread/INFO]: [CHAT] An unknown error occurred while attempting to perform this command

Code itself: https://gist.github.com/Andrew2070/9fa002bc2af8b3cc8e0b278cdbcb1dd3

Andrew2070 commented 6 years ago

Solved. it turned out i never used the maxPower value or loaded it so it was useless and was complaining to get rid of it. So i removed that, and got hit with another stack trace of the underlying issue regarding the renaming process. turned out, i had set the value of name to another key in the code that was supposed to rewrite it. So it was having a hard time trying to re-write a double with a string and then save that. which is a big no no.

Now everything works fine and dandy. Also decided to do some DB patching where possible corruption could occur.

2 birds killed with one debug stone.