Gringotts

Gringotts

53.6k Downloads

Npe on money transfer

Shepelzz opened this issue · 1 comments

commented

Can not reproduce this by some specific steps.. but this guy tried to withdraw his money and got NPE. Money was withdrawed but not received by user.
Sometimes this happened when user tries to selkl smth to shop, but shops vault is empty. Gringotts throws NPE and shop plugin got stucked.

Also it would better to add mysql support for logging.

[17:53:37 INFO]: AdiXak issued server command: /balance
[17:54:04 INFO]: AdiXak issued server command: /money withdraw 500
[17:54:04 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'money' in plugin Gringotts v2.12.5
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:947) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at org.bukkit.craftbukkit.v1_20_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:265) ~[purpur-1.20.1.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:332) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:316) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2391) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$21(ServerGamePacketListenerImpl.java:2351) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1366) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1343) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1336) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1314) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1202) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[purpur-1.20.1.jar:git-Purpur-1996]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: org.gestern.gringotts.GringottsException: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "itemStack" is null
        at org.gestern.gringotts.GringottsAccount.getTimeout(GringottsAccount.java:470) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.GringottsAccount.remove(GringottsAccount.java:304) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.api.impl.GringottsEco$ValidPlayerAccount.withdraw(GringottsEco.java:785) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.commands.GringottsAbstractExecutor.withdraw(GringottsAbstractExecutor.java:158) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.commands.MoneyExecutor.onCommand(MoneyExecutor.java:59) ~[gringotts-2.12.5.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 23 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "itemStack" is null
        at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?]
        at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096) ~[?:?]
        at org.gestern.gringotts.GringottsAccount.getTimeout(GringottsAccount.java:468) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.GringottsAccount.remove(GringottsAccount.java:304) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.api.impl.GringottsEco$ValidPlayerAccount.withdraw(GringottsEco.java:785) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.commands.GringottsAbstractExecutor.withdraw(GringottsAbstractExecutor.java:158) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.commands.MoneyExecutor.onCommand(MoneyExecutor.java:59) ~[gringotts-2.12.5.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 23 more
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "itemStack" is null
        at org.gestern.gringotts.GringottsAccount.removeFromShulkerBox(GringottsAccount.java:332) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.GringottsAccount.lambda$remove$2(GringottsAccount.java:265) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.GringottsAccount.lambda$callSync$0(GringottsAccount.java:54) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.GringottsAccount.callSync(GringottsAccount.java:61) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.GringottsAccount.remove(GringottsAccount.java:304) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.api.impl.GringottsEco$ValidPlayerAccount.withdraw(GringottsEco.java:785) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.commands.GringottsAbstractExecutor.withdraw(GringottsAbstractExecutor.java:158) ~[gringotts-2.12.5.jar:?]
        at org.gestern.gringotts.commands.MoneyExecutor.onCommand(MoneyExecutor.java:59) ~[gringotts-2.12.5.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 23 more
commented

Here is how my config looks like:

# for details on configuration, see https://github.com/MinecraftWars/Gringotts/blob/master/doc/configuration.md

# supported languages: "custom" (default, english), "de" (german), "fr" (french), and "pt-BR" (brazilian portuguese).
language: custom

# regex that create a vault if matches with a sign
# subpattern 1 denotes the type of the vault.
vault_pattern: '[^\[]*\[(\w*) ?vault\]'

# If this is set to true, when the user receives an amount of money
# exceeding the inventory capacity, drop items that didn't fit.
drop-overflowing-item: false

# currency name and value config
currency:
  # currency name to use in messages
  name:
    singular: Монета
    plural: Монет
  
  # number of decimal digits supported by currency value (0 for whole numbers only)
  digits: 0
  
  # Display account balances with individual denomination names
  named-denominations: false
  
  # value of individual denominations. default: emerald: 1, emerald block: 9
  denominations:
  - material: copper_ingot
    value: 1
    unit-name: Медная монета
    unit-name-plural: Медные монеты
    displayname: '&6$ Медная монета $'
    lore:
      - '&7Номинал 1'
      - '&7-=-Банк Beehive-=-'
  - material: iron_ingot
    value: 10
    unit-name: Серебряная монета
    unit-name-plural: Серебряные монеты
    displayname: '&f$ Серебряная монета $'
    lore:
      - '&7Номинал 10'
      - '&7-=-Банк Beehive-=-'
  - material: gold_ingot
    value: 100
    unit-name: Золотая монета
    unit-name-plural: Золотые монеты
    displayname: '&e$ Золотая монета $'
#      damage: 10
#      custom_model_data: 1
    lore:
      - '&7Номинал 100'
      - '&7-=-Банк Beehive-=-'

# tax on /money pay transactions
transactiontax:
  flat: 0.0
  rate: 0.0

# balance to start an account with (purely virtual)
startingbalance:
  player: 0

# globally (dis)allow use of vault types
usevault:
  container: true
  enderchest: true
  # if true, denomination items located in shulker boxes, in the above enabled inventories, will be included to the denomination finding process
  include-shulker-boxes: true

# whether money/balance commands show vault and inventory balance separately
balance:
  show-vault: true
  show-inventory: true
  show-enderchest: true