Describe the bug
All attempts to buy an item that's for sale break, but it breaks in different ways depending on whether you purchase by ID or by creating a buy offer.
ID:
Offer gets removed
Buyer loses the correct amount of money
Buyer does not get the item
Seller does not get any money
This deletes the item and the money
Buy offer:
Sell offer remains
Buyer does not lose money
Buyer gets the item
Seller gets the money
This duplicates the item and the money
To Reproduce
Steps to reproduce the behavior:
Buy an item using a buy offer or the ID
Logs/Screenshots/Videos
ID:
[01:36:22] [Server thread/WARN] [minecraft/CommandHandler]: Couldn't process command: ge buy 0
java.lang.NullPointerException: null
at the_fireplace.grandexchange.db.JsonDatabase.removeOfferStatusComplete(JsonDatabase.java:144) ~[JsonDatabase.class:?]
at the_fireplace.grandexchange.market.OfferStatusMessager.sendCompleteStatusUpdate(OfferStatusMessager.java:66) ~[OfferStatusMessager.class:?]
at the_fireplace.grandexchange.market.OfferStatusMessager.updateStatusComplete(OfferStatusMessager.java:43) ~[OfferStatusMessager.class:?]
at the_fireplace.grandexchange.market.OfferStatusMessager.updateStatusComplete(OfferStatusMessager.java:35) ~[OfferStatusMessager.class:?]
at the_fireplace.grandexchange.commands.CommandBuy.func_184881_a(CommandBuy.java:101) ~[CommandBuy.class:?]
at the_fireplace.grandexchange.commands.CommandGe.func_184881_a(CommandGe.java:54) ~[CommandGe.class:?]
at net.minecraft.command.CommandHandler.func_175786_a(CommandHandler.java:119) [bj.class:?]
at net.minecraft.command.CommandHandler.func_71556_a(CommandHandler.java:91) [bj.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:960) [pa.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:939) [pa.class:?]
at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:37) [la.class:?]
at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:9) [la.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_181]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_181]
at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
Buy offer:
[01:41:07] [Server thread/WARN] [minecraft/CommandHandler]: Couldn't process command: ge buy wool 0 3 100
java.lang.NullPointerException: null
at the_fireplace.grandexchange.db.JsonDatabase.removeOfferStatusComplete(JsonDatabase.java:144) ~[JsonDatabase.class:?]
at the_fireplace.grandexchange.market.OfferStatusMessager.sendCompleteStatusUpdate(OfferStatusMessager.java:66) ~[OfferStatusMessager.class:?]
at the_fireplace.grandexchange.market.OfferStatusMessager.updateStatusComplete(OfferStatusMessager.java:43) ~[OfferStatusMessager.class:?]
at the_fireplace.grandexchange.market.ExchangeManager.tryFulfillBuyOffer(ExchangeManager.java:240) ~[ExchangeManager.class:?]
at the_fireplace.grandexchange.market.ExchangeManager.tryFulfillOffer(ExchangeManager.java:173) ~[ExchangeManager.class:?]
at the_fireplace.grandexchange.market.ExchangeManager.makeOffer(ExchangeManager.java:44) ~[ExchangeManager.class:?]
at the_fireplace.grandexchange.market.ExchangeManager.makeOffer(ExchangeManager.java:57) ~[ExchangeManager.class:?]
at the_fireplace.grandexchange.commands.CommandBuy.func_184881_a(CommandBuy.java:76) ~[CommandBuy.class:?]
at the_fireplace.grandexchange.commands.CommandGe.func_184881_a(CommandGe.java:54) ~[CommandGe.class:?]
at net.minecraft.command.CommandHandler.func_175786_a(CommandHandler.java:119) [bj.class:?]
at net.minecraft.command.CommandHandler.func_71556_a(CommandHandler.java:91) [bj.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:960) [pa.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:939) [pa.class:?]
at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:37) [la.class:?]
at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:9) [la.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_181]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_181]
at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
Versions (please complete the following information, do NOT say "latest"):
Describe the bug All attempts to buy an item that's for sale break, but it breaks in different ways depending on whether you purchase by ID or by creating a buy offer.
ID:
This deletes the item and the money
Buy offer:
This duplicates the item and the money
To Reproduce Steps to reproduce the behavior: Buy an item using a buy offer or the ID
Logs/Screenshots/Videos
ID:
[01:36:22] [Server thread/WARN] [minecraft/CommandHandler]: Couldn't process command: ge buy 0 java.lang.NullPointerException: null at the_fireplace.grandexchange.db.JsonDatabase.removeOfferStatusComplete(JsonDatabase.java:144) ~[JsonDatabase.class:?] at the_fireplace.grandexchange.market.OfferStatusMessager.sendCompleteStatusUpdate(OfferStatusMessager.java:66) ~[OfferStatusMessager.class:?] at the_fireplace.grandexchange.market.OfferStatusMessager.updateStatusComplete(OfferStatusMessager.java:43) ~[OfferStatusMessager.class:?] at the_fireplace.grandexchange.market.OfferStatusMessager.updateStatusComplete(OfferStatusMessager.java:35) ~[OfferStatusMessager.class:?] at the_fireplace.grandexchange.commands.CommandBuy.func_184881_a(CommandBuy.java:101) ~[CommandBuy.class:?] at the_fireplace.grandexchange.commands.CommandGe.func_184881_a(CommandGe.java:54) ~[CommandGe.class:?] at net.minecraft.command.CommandHandler.func_175786_a(CommandHandler.java:119) [bj.class:?] at net.minecraft.command.CommandHandler.func_71556_a(CommandHandler.java:91) [bj.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:960) [pa.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:939) [pa.class:?] at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:37) [la.class:?] at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:9) [la.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_181] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_181] at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
Buy offer:
[01:41:07] [Server thread/WARN] [minecraft/CommandHandler]: Couldn't process command: ge buy wool 0 3 100 java.lang.NullPointerException: null at the_fireplace.grandexchange.db.JsonDatabase.removeOfferStatusComplete(JsonDatabase.java:144) ~[JsonDatabase.class:?] at the_fireplace.grandexchange.market.OfferStatusMessager.sendCompleteStatusUpdate(OfferStatusMessager.java:66) ~[OfferStatusMessager.class:?] at the_fireplace.grandexchange.market.OfferStatusMessager.updateStatusComplete(OfferStatusMessager.java:43) ~[OfferStatusMessager.class:?] at the_fireplace.grandexchange.market.ExchangeManager.tryFulfillBuyOffer(ExchangeManager.java:240) ~[ExchangeManager.class:?] at the_fireplace.grandexchange.market.ExchangeManager.tryFulfillOffer(ExchangeManager.java:173) ~[ExchangeManager.class:?] at the_fireplace.grandexchange.market.ExchangeManager.makeOffer(ExchangeManager.java:44) ~[ExchangeManager.class:?] at the_fireplace.grandexchange.market.ExchangeManager.makeOffer(ExchangeManager.java:57) ~[ExchangeManager.class:?] at the_fireplace.grandexchange.commands.CommandBuy.func_184881_a(CommandBuy.java:76) ~[CommandBuy.class:?] at the_fireplace.grandexchange.commands.CommandGe.func_184881_a(CommandGe.java:54) ~[CommandGe.class:?] at net.minecraft.command.CommandHandler.func_175786_a(CommandHandler.java:119) [bj.class:?] at net.minecraft.command.CommandHandler.func_71556_a(CommandHandler.java:91) [bj.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:960) [pa.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:939) [pa.class:?] at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:37) [la.class:?] at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:9) [la.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_181] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_181] at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
Versions (please complete the following information, do NOT say "latest"):