Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bank API via Vault Crash #144

Open
DarkArc opened this issue Jun 11, 2019 · 1 comment
Open

Bank API via Vault Crash #144

DarkArc opened this issue Jun 11, 2019 · 1 comment

Comments

@DarkArc
Copy link
Contributor

DarkArc commented Jun 11, 2019

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:

https://github.com/packet-loss-gaming/Grindstone/blob/cbeac02e1f4bf756d521c7d8f4cdbe402361b003/src/main/java/gg/packetloss/grindstone/economic/lottery/LotteryComponent.java#L345

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.

@pavog
Copy link

pavog commented Oct 17, 2019

Hey @DarkArc,
I maintain a fork of CraftConomy3 where I already fixed many old issues.
You may want to test the lottery plugin with my fork and report the issue to my repository too? 😃

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

No branches or pull requests

2 participants