Bank API via Vault Crash
DarkArc opened this issue ยท 1 comments
I've restored a MC 1.8.9 server and migrated to 1.12.2. I have a rather simple API call to get the balance of a bank account. This line was causing a NPE in vault for me:
I figured out there was an error where in the currency table bankCurrency was set to 0/false, which caused problems for vault. There doesn't seem to be any ways to properly set a currency to a bank currency, at least on the surface, so I'm reporting it here, rather than to vault.
EDIT: For posterity, this is the exception:
[17:01:21 WARN]: [CommandBook] Task #3851 for CommandBook v2.5-SNAPSHOT generated an exception
java.lang.NullPointerException: null
at net.milkbowl.vault.economy.plugins.Economy_Craftconomy3.bankBalance(Economy_Craftconomy3.java:237) ~[?:?]
at gg.packetloss.grindstone.economic.lottery.LotteryComponent.getWinnerCash(LotteryComponent.java:345) ~[?:?]
at gg.packetloss.grindstone.economic.lottery.LotteryComponent.completeLottery(LotteryComponent.java:315) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:361) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
If someone finds this in the future and needs a quick fix, given an SQL table like the following:
MariaDB [minecraft]> select * from econ_currency;
+-------+--------+-------+-------------+------+--------+--------------+
| name | plural | minor | minorplural | sign | status | bankCurrency |
+-------+--------+-------+-------------+------+--------+--------------+
| Skrin | Skrin | Skrin | Skrin | $ | 1 | 1 |
+-------+--------+-------+-------------+------+--------+--------------+
1 row in set (0.00 sec)
UPDATE `econ_currency` SET `bankCurrency` = 1 WHERE `name` = "Skrin";
Followed by a server reboot should take care of your issue.