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

Adding and removing fractional amounts of money via moneyadm causes exceptions #172

Open
silen72 opened this issue Mar 23, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@silen72
Copy link

silen72 commented Mar 23, 2024

Describe the bug
Adding and removing fractional amounts of money via moneyadm produces exceptions:

[14:16:03 INFO]: silen72 issued server command: /moneyadm add silen72 0.5
[14:16:03 ERROR]: null
minecraftdev | org.bukkit.command.CommandException: Unhandled exception executing command 'moneyadm' in plugin Gringotts v2.12.5
minecraftdev | at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
minecraftdev | at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
minecraftdev | at org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchCommand(CraftServer.java:929) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at org.bukkit.craftbukkit.v1_19_R3.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.4.jar:?]
minecraftdev | at net.minecraft.commands.Commands.performCommand(Commands.java:322) ~[?:?]
minecraftdev | at net.minecraft.commands.Commands.performCommand(Commands.java:306) ~[?:?]
minecraftdev | at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2297) ~[?:?]
minecraftdev | at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2257) ~[?:?]
minecraftdev | at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
minecraftdev | at java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) ~[?:?]
minecraftdev | at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
minecraftdev | at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
minecraftdev | at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1342) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
minecraftdev | at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1319) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1312) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
minecraftdev | at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1290) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1178) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-550]
minecraftdev | at java.lang.Thread.run(Unknown Source) ~[?:?]
minecraftdev | Caused by: org.gestern.gringotts.GringottsException: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "itemStack" is null
minecraftdev | at org.gestern.gringotts.GringottsAccount.getTimeout(GringottsAccount.java:470) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.GringottsAccount.add(GringottsAccount.java:231) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.api.impl.GringottsEco$ValidAccount.add(GringottsEco.java:644) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.commands.MoneyAdminExecutor.onCommand(MoneyAdminExecutor.java:92) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
minecraftdev | ... 23 more
minecraftdev | Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "itemStack" is null
minecraftdev | at java.util.concurrent.CompletableFuture.reportGet(Unknown Source) ~[?:?]
minecraftdev | at java.util.concurrent.CompletableFuture.get(Unknown Source) ~[?:?]
minecraftdev | at org.gestern.gringotts.GringottsAccount.getTimeout(GringottsAccount.java:468) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.GringottsAccount.add(GringottsAccount.java:231) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.api.impl.GringottsEco$ValidAccount.add(GringottsEco.java:644) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.commands.MoneyAdminExecutor.onCommand(MoneyAdminExecutor.java:92) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
minecraftdev | ... 23 more
minecraftdev | Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "itemStack" is null
minecraftdev | at org.gestern.gringotts.GringottsAccount.addToShulkerBox(GringottsAccount.java:309) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.GringottsAccount.lambda$add$1(GringottsAccount.java:184) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.GringottsAccount.lambda$callSync$0(GringottsAccount.java:54) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.GringottsAccount.callSync(GringottsAccount.java:61) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.GringottsAccount.add(GringottsAccount.java:231) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.api.impl.GringottsEco$ValidAccount.add(GringottsEco.java:644) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.gestern.gringotts.commands.MoneyAdminExecutor.onCommand(MoneyAdminExecutor.java:92) ~[gringotts-2.12.5.jar:?]
minecraftdev | at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
minecraftdev | ... 23 more

To Reproduce
Steps to reproduce the behavior:

  1. Set up a new server with paper 1.19.4 (550)
  2. Add Vault v1.7.3-b131 to plugin folder
  3. Add Gringotts v2.12.5 to plugin folder
  4. Start the server (without tinkering with the config.yml files)
  5. Join the server as op
  6. Issue "/moneyadm add 0.5"
  7. See server log: Unhandled exception executing command 'moneyadm' in plugin Gringotts v2.12.5
  8. Check your account ("/money"): nothing has been added to your account
  9. Issue "/moneyadm add 5"
  10. See server log: no exception
  11. Issue "/moneyadm remove 0.5"
  12. See server log: Unhandled exception executing command 'moneyadm' in plugin Gringotts v2.12.5
  13. Check your account ("/money"): Although generating exceptions, one emerald has been deducted from your account

Expected behavior
It should be possible to add (and remove) fractional amounts of money via moneyadm.

Screenshots
not applicable

Desktop (please complete the following information):

  • Server Type: paper 1.19.4
  • Server Version: paper-1.19.4-550.jar
  • Gringotts Version: 2.12.5
  • Java 17 (OpenJDK 64-Bit Server VM 17.0.10+7)

Additional context
I have encountered this issue on my 1.20.4 server first. Because Gringotts states to support minecraft only up until 1.19 (https://www.spigotmc.org/resources/gringotts.42071/), I have set up a test server with 1.19.4 to verify the issue (see above).
Having no money, removing fractional amounts does nothing (no errors).

@silen72
Copy link
Author

silen72 commented Mar 23, 2024

This is probably related: wargamer/SignShop#160

@weaves7
Copy link

weaves7 commented Mar 23, 2024

This is probably related: wargamer/SignShop#160

See my Signshop reply here: wargamer/SignShop#160 (comment)

@weaves7
Copy link

weaves7 commented Mar 24, 2024

I did some digging and found that Gringotts throws the same exception that you pasted above when Signshop tries to execute the transaction. The difference being that Signshop catches that exception and terminates the transaction and then gives the overstock message.

It looks like this pull request might fix the issue since the underlying error is a NPE on and item stack. The problem is the currently released version on SpigotMC does not contain this PR and the author has not been on SpigotMC for weeks.

@silen72
Copy link
Author

silen72 commented Mar 24, 2024

@nikosgram: weaves7 has provided a plugin file that incorporates the above mentioned pull request and thereby fixes this issue. Would you please update Gringotts with that pull request as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants