MobHunting

MobHunting

114k Downloads

Given money not added to balance

SlimeDog opened this issue ยท 14 comments

commented

Spigot 1.12.2 latest
MH 5.2.9
EssentialsX 2.0.1-b557
Vault 1.5.6-b49

drop-money-use-item-as-currency: false

Replication:

  1. /mh money give player 25 => bag-of-gold (25) is added to inventory, but money (25) is not added to balance
  2. Drop bag-of-gold => bag-of-gold (25) is removed from inventory and dropped on ground, and money (25) is subtracted from balance
  3. Pick up bag-of-gold => bag-of-gold is not added to inventory (as expected), and money (25) is added to balance (as expected)

Net balance is the same as it was prior to this sequence.

Steps (1) and (2) need to be balanced, so that the net effect of giving someone money is an addition to their balance (if they pick up the bag-of-gold at (3)).

If I kill a mob, then pick up the bag-of-gold, money is added to balance (as expected).

commented
  1. It looks like I dont handle a "unknown" playername the right way. Ill look at that.
  2. When you die the money should be dropped on the ground to be picked up like all other Items in your pockets (inventory). You will have to save some of your money in a protected chest or if you choose to use BagOfGold you can use the BankSigns or The new Banker I have made. I need to check what happens to the BagOfGold when the player dies. I cant remember I have tested that :-)
commented

"playerName" is a mask. The player was quite known: myself.

commented
  1. i found the bug. it is fixed in next release
  2. I have tested what happens, when you die and fixed an error, but we need more testing to see what happens when one player kills another player.

Please test MobHunting V5.3.0 and BagOfGOld 0.9.7 (if you use BagOfGold too)

commented

Please create a new ticket if you find more bugs. :-)

commented

No you are not right :-)

when drop-money -use-item-as-currency is false you should NEVER end up with having a BagOfGold in your inventory. You get the money directly on your balance.

  1. So /mh money give player 25 should be the same as giving the player 25 BagOfGold on his balance. But this not that important because your would probably use /eco give player 25 instead because you use Essentials.

  2. If you drop BagOfGold somewhere you could argue what to happen. You could argue that if you are a normal player the money should be subtracted. And if you are an admin you should be allow to do that with out loosing the money. When I originally made the command it was meant to be an admin command. SO that the admin could give player some money like using /eco give player 25

  3. If you pickup a BagOfGold the money should go directly into his account.

commented
  1. I have done a small change

In next release V5.3.0 /mh money give player 25 will act exactly as /eco give player 25 and is meant to be an admin command.

commented
  1. The drop works like I wanted it to. And is only meant to be and admin command.
commented
  1. Pick up also works like I meant it to. The money goes into the balance.
commented
  1. I have done a change on /mh money take player 25 so it works like /eco take player 25

  2. And add a two tests so you cant buy / sell BagOfGold - when drop-money-use-item-as-currency: false

commented

You can test on build 529 or never if you want to

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

commented

I always test for you. :)

The use case I was hoping for: As admin (or player with appropriate permissions, like op), I could give myself a bag-of-gold, then drop it in front of another player. They would get the money value only if they picked up the bag. That worked, with the above caveats, until now. With 5.3.0-b529, I cannot give myself a bag-of-gold; the value goes immediately to my balance. I would prefer a return to the pre-529 mechanics, if that is the best; I can live with the balance issues.

I would be happy if

/mh money give ...

works in the new way, but it seems to me that

/mh bag give ...

should give me a bag in inventory, regardless of the value of drop-money-use-item-as-currency. (I appreciate that "bag" is an alias for "money" currently.)

commented

I will consider changing to

drop-money-use-item-as-currency: true

now that the economy platform is more stable, but there are issues, such as losing your cash money if you die. Maybe that's a feature -- reflecting real life. :)

commented

On further experimentation

/mh bag drop player amount

does the needful, wrt the above comments. But it also generates

An internal error occurred while attempting to perform this command

in game, and in the log

[16:48:58 INFO]: rambeau issued server command: /mh bag drop playerName 25
[16:48:58 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'mh' in plugin MobHunting v5.3.0-SNAPSHOT-B529
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:648) ~[spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1397) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1232) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_141]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_141]
        at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.eyJ0aW1lc3RhbXAiOjE0ODU5MTIwNjk3OTgsInByb2ZpbGVJZCI6IjdkYTJhYjNhOTNjYTQ4ZWU4MzA0OGFmYzNiODBlNjhlIiwicHJvZmlsZU5hbWUiOiJHb2xkYXBmZWwiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzM5NmNlMTNmZjYxNTVmZGYzMjM1ZDhkMjIxNzRjNWRlNGJmNTUxMmYxYWRlZGExYWZhM2ZjMjgxODBmM2Y3In19fQ==
        at java.lang.Enum.valueOf(Enum.java:238) ~[?:1.8.0_141]
        at org.bukkit.ChatColor.valueOf(ChatColor.java:1) ~[spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        at one.lindegaard.MobHunting.commands.MoneyCommand.onCommand(MoneyCommand.java:253) ~[?:?]
        at one.lindegaard.MobHunting.commands.CommandDispatcher.onCommand(CommandDispatcher.java:98) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot-1.12.2.jar-2017-12-28-0757:git-Spigot-b66ad9e-b5a10a9]
        ... 15 more
commented

Please test MobHunting V5.3.0 and BagOfGOld 0.9.7 (if you use BagOfGold too)

Will test 5.3.0. I don't use BagOfGold, and don't feel competent to test its features.

Please create a new ticket ...

Of course. :)