Rocologo / BagOfGold

Economy plugin for Minecraft Servers
13 stars 6 forks source link

Bag of gold items have no value in certain situations #35

Closed braceyourself07 closed 6 years ago

braceyourself07 commented 6 years ago

This is going to be a more ambiguous post that I will try to add to as I get more information. So far the evidence I have is only circumstantial and I trust the players bringing this to my attention are not trying to complain in order to get free money (as this also happened to one of my admins).

Basically the situation is a player will give money to another player by dropping gold or placing gold on the ground and the other player will pick it up or break the gold item. The receiving player will see the gold in their inventory, but when they go to deposit it, there is no change to their balance (e.g. the bag may have said '1000' but it had an effective value of zero. On other occasions, the gold just disappears from the player's inventory.

One player lost 12k gold. He took the gold out of a chest, dropped it out of his inventory onto the floor in front of him, then picked it up and it said "You found 12,000" and then it wasn't in his inventory or the chest.

Another player had 3.5k gold in their inventory and they did not die, spend, or drop the gold but that it just vanished about an hour later.

The situation that happened to my admin was that she was playing survival and traded an item with a player. The player gave her gold in exchange by dropping it from their inventory and she picked it up. When she went to the bank, she checked her balance, deposited, then checked the balance again and the balance did not change.

Each time we've tried to re-create these scenarios, the gold tracked perfectly fine. So I don't know how to reproduce this. My theory would be that somehow some gold is not being written into the database or it's not being tracked properly when it leaves a player's inventory. It could be an artifact from a prior bug and now we're just seeing the manifestations of it. I've instructed my staff to continue writing down each situation in as much detail as possible and so far these 4-5 situations are the only things that have happened and we can't reproduce the bug. I have turned debug mode on and will let the server run this way for the next few days to anticipate any future issues and will write more as I learn more about it.

Thanks!

Rocologo commented 6 years ago

Hi, the thing is that actually play very little, so I need your and your admins help to find the bug. I have no clue on what triggers that the items looses the hidden lores.

BagOfGold has Lores, which is used to store the bag value in. If the lores disapear the value is 0 no matter if the display name says something else.

Rocologo commented 6 years ago

The Lores can be seen if you disable integration to ProtocolLib.

braceyourself07 commented 6 years ago

Oh I see. How would I disable integration to ProtocolLib? I didn't find any references to ProtocolLib in Bagofgold's config.yml. Or do you mean removing the ProtocolLib plugin?

Rocologo commented 6 years ago

You actually disable ProtocolLib in MobHuntings config.yml, but I have a better solution for you.

If you use build 706

https://fractal.lindegaard.one:8181/job/MobHunting/

The players will get a warning if the touch a broken reward:

image

Rocologo commented 6 years ago

This way you may discover when this problem happens... hopefully

Rocologo commented 6 years ago

Also you should use Build 152, where i have made some small improvements https://fractal.lindegaard.one:8181/job/BagOfGold/

braceyourself07 commented 6 years ago

Dang that's smart! I'll get these loaded on the server tonight. Thanks so much! So far no one has reported any other gold discrepancies.

braceyourself07 commented 6 years ago

Ok I think I found it!

https://hastebin.com/ezasukujaq.md

Looks like it's the cancellation of a negative number and a positive number when a player drops and picks up the item. Also, when he picked it up he did not receive a FAKE reward message, so it looks like the item lore was intact but the math may not be correct. Hopefully this gives you something to zero in.

Rocologo commented 6 years ago

I need the debug information for this player just before [06:36:50], so I can see what happens when he dropped the money, and picked them up again.

This Event "RewardListener: InventoryCloseEvent adjusting balance to Amount of BagOfGold in Inventory:" is fired EVERY time the closes his Inventory, and the I check that the amount of BagOfGOld is equal to his balance, if not I adjust the balance. (In Survival)

In creative I adjust the amount of BagOfGold to the balance, when the player closes his inventory.

braceyourself07 commented 6 years ago

Is this sufficient? It's the only immediate thing before the event that pertains to Casey (I removed lines that directly involved other players).

https://hastebin.com/icigijusoy.md

braceyourself07 commented 6 years ago

Here it is in context with the original hastebin https://hastebin.com/sumokimafe.md

Rocologo commented 6 years ago

almost perfect debug information, but I need you to enable /mh debug as well, so I am able to see that Casey picks up the item.

I cant see any errors in current debug information

Im still not able to reproduce the bug.

Rocologo commented 6 years ago

also I have added a limit of gold per bag today (default 10000). If you want to test this, you should try

Please use build 711 or newer https://fractal.lindegaard.one:8181/job/MobHunting/

And build 156 or newer https://fractal.lindegaard.one:8181/job/BagOfGold/

braceyourself07 commented 6 years ago

Ok I have enabled debug in MH. Will report back if it happens again.

Rocologo commented 6 years ago

I am pretty sure that there is a bug some where :-(

braceyourself07 commented 6 years ago

https://hastebin.com/ahebanuqaf.md

Here is a log excerpt for player "Vancient" who had 8k after another player bought his items in ChestShop. Vancient then split the 8k to 4k and 4k. He accidentally dropped one of the 4k bags and when he picked it up, it did not count it and he lost 4k. Let me know if this log helps at all. It includes debug from both BagsofGold and MobHunting.

Rocologo commented 6 years ago

The HasteBin is empty ??? :-)

braceyourself07 commented 6 years ago

It was not empty last night. I will recollect the log and repost in raw.

braceyourself07 commented 6 years ago
[16:13:14] [Server thread/INFO]: [BagOfGold][Debug] Added 4480 to Vancient's item in slot 13, new value is 5069 (addBagOfGoldPlayer_EconomyManager)
[16:13:14] [Server thread/INFO]: [BagOfGold][Debug] Deposit 4480 to Vancient's account, new balance is 5069
[16:13:14] [Server thread/INFO]: [ChestShop] WelcomeToFinland bought 64 Diamond for 4480.00 from Vancient at [world] 1024, 71, 540
[16:13:18] [Server thread/INFO]: [BagOfGold][Debug] Added 3010 to Vancient's item in slot 13, new value is 8079 (addBagOfGoldPlayer_EconomyManager)
[16:13:18] [Server thread/INFO]: [BagOfGold][Debug] Deposit 3010 to Vancient's account, new balance is 8079
[16:13:18] [Server thread/INFO]: [ChestShop] WelcomeToFinland bought 43 Diamond for 3010.00 from Vancient at [world] 1024, 71, 540
[16:13:30] [Server thread/INFO]: [BagOfGold][Debug] RewardListener: InventoryCloseEvent adjusting balance to Amount of BagOfGold in Inventory: PlayerBalance: {player: Name:Vancient, WorldGrp:default, GameMode:SURVIVAL, Balance: 8079.0(+0.0), BankBalance: 655065.0(+0.0)}
[16:13:35] [Server thread/INFO]: [MobHunting][Debug] Vancient halfed a reward in two (4039.5,4039.5)
[16:13:36] [Server thread/INFO]: [BagOfGold][Debug] RewardListener: InventoryCloseEvent adjusting balance to Amount of BagOfGold in Inventory: PlayerBalance: {player: Name:Vancient, WorldGrp:default, GameMode:SURVIVAL, Balance: 8079.0(+0.0), BankBalance: 655065.0(+0.0)}
[16:13:36] [Server thread/INFO]: [BagOfGold][Debug] Adding -4039 to Vancient's balance 8079
[16:13:36] [Server thread/INFO]: [MobHunting][Debug] Vancient dropped 4039.5 money. (# of rewards left=796)
[16:13:36] [Server thread/INFO]: [BagOfGold][Debug] Removing 4039.5 from Vancient's balance 4040
[16:13:39] [Server thread/INFO]: [BagOfGold][Debug] Added 4040 to Vancient's item in slot 13, new value is 8079.5 (addBagOfGoldPlayer_EconomyManager)
[16:13:39] [Server thread/INFO]: [BagOfGold][Debug] Deposit 4039.5 to Vancient's account, new balance is 4041
[16:13:39] [Server thread/INFO]: [BagOfGold][Debug] Added -4039 to Vancient's item in slot 13, new value is 4040.5 (addBagOfGoldPlayer_EconomyManager)
[16:13:39] [Server thread/INFO]: [MobHunting][Debug] Vancient picked up a Gold with a value:4039.5 (# of rewards left=795)(PickupRewards)
[16:13:42] [Server thread/INFO]: [BagOfGold][Debug] RewardListener: InventoryCloseEvent adjusting balance to Amount of BagOfGold in Inventory: PlayerBalance: {player: Name:Vancient, WorldGrp:default, GameMode:SURVIVAL, Balance: 4041.0(+0.0), BankBalance: 655065.0(+0.0)}
[16:13:44] [Server thread/INFO]: [BagOfGold][Debug] RewardListener: InventoryCloseEvent adjusting balance to Amount of BagOfGold in Inventory: PlayerBalance: {player: Name:Vancient, WorldGrp:default, GameMode:SURVIVAL, Balance: 4041.0(+0.0), BankBalance: 655065.0(+0.0)}
[16:13:49] [Server thread/INFO]: [BagOfGold][Debug] RewardListener: InventoryCloseEvent adjusting balance to Amount of BagOfGold in Inventory: PlayerBalance: {player: Name:Vancient, WorldGrp:default, GameMode:SURVIVAL, Balance: 4041.0(+0.0), BankBalance: 655065.0(+0.0)}
[16:13:50] [Server thread/INFO]: Vancient issued server command: /bag money balance
[16:13:52] [Async Chat Thread - #77/INFO]: [survival] Vancient: Wtf
[16:13:55] [Server thread/INFO]: [BagOfGold][Debug] RewardListener: InventoryCloseEvent adjusting balance to Amount of BagOfGold in Inventory: PlayerBalance: {player: Name:Vancient, WorldGrp:default, GameMode:SURVIVAL, Balance: 4041.0(+0.0), BankBalance: 655065.0(+0.0)}
[16:13:57] [Async Chat Thread - #77/INFO]: [survival] Vancient: I just lost 4k
Rocologo commented 6 years ago

I agree this line looks wrong

[16:13:36] [Server thread/INFO]: [BagOfGold][Debug] Adding -4039 to Vancient's balance 8079

Do you know exactly how he dropped the 4039 bagofgold?. Did he just pull the bag out of the inventory with the mouse?

I will try to do some testing where split som bags and the do "strange stuff" to see if I can replicate the problem.

braceyourself07 commented 6 years ago

I don't know exactly how, but since he said accidentally, I assume he right clicked on the bag of gold to split it and then left clicked outside of the inventory GUI to drop it. But this is not the only instance of the gold disappearing.

Rocologo commented 6 years ago

May be he did split the bags but closed the inventory before placing the second half bag into the inventory...

Im still at work so I cant test yet.

Rocologo commented 6 years ago

I am able reproduce the problem now! No I need to find a solution. The problem is as I guessed. I the player closes the inventory before placing second half (after a spilt) the error happens...

braceyourself07 commented 6 years ago

Could this also be related to the other issues of players picking up invalid/disappearing money not related to a split?

Rocologo commented 6 years ago

Yes, because it not only when the player split, I think it happens when the player pickup a bag and then closes the inventory placing it.

Rocologo commented 6 years ago

I think it is fixed in this build

https://fractal.lindegaard.one:8181/job/BagOfGold/163/

You also got some new ADMIN commands /bag bank give ... /bag bank take ... /bag bank balance ...

And you can set the numbers for the BagOfGoldBanker in config.yml

braceyourself07 commented 6 years ago

This particular situation seemed to be fixed :+1:

I will let you know if any other scenarios cause the money to disappear. Usually it takes a few days for players to do their thing and encounter a scenario that causes the glitch.

Rocologo commented 6 years ago

Yes I know, Its really nice that you take your time help reproducing the bugs. Its a big help to me! I had not found this bug without your help.

Rocologo commented 6 years ago

I will make a 2.0.9 release now because I this the is a serious bug to be fixed.

I close this ticket now. :-)