greatman / Craftconomy

A MultiWorld/MultiCurrency economy plugin for Craftbukkit * DEPRECATED. Go in http://github.com/greatman/Craftconomy3 *
http://dev.bukkit.org/server-mods/craftconomy/
4 stars 1 forks source link

Unhandled exception using command /money following sale or purchase #17

Open gjdawson opened 12 years ago

gjdawson commented 12 years ago

Whenever I receive currency reward from another plugin (for instance, selling an item to a dynamiceconomy shop) the currency database seems to become corrupt somehow and issuing the /money command results in the following:

2012-03-11 14:37:40 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'money' in plugin Craftconomy v2.3.1-b179 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166) at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:461) at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:818) at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:778) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:761) at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:33) at net.minecraft.server.NetworkManager.b(NetworkManager.java:229) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:112) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.lang.NumberFormatException: For input string: "51000000000005" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:461) at java.lang.Integer.parseInt(Integer.java:499) at me.greatman.Craftconomy.Craftconomy.format(Craftconomy.java:352) at me.greatman.Craftconomy.Craftconomy.format(Craftconomy.java:321) at me.greatman.Craftconomy.commands.money.OwnMoneyCommand.perform(OwnMoneyCommand.java:29) at me.greatman.Craftconomy.commands.BaseCommand.execute(BaseCommand.java:58) at me.greatman.Craftconomy.Craftconomy.handleMoneyCommand(Craftconomy.java:273) at me.greatman.Craftconomy.Craftconomy.onCommand(Craftconomy.java:238) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40) ... 12 more

Trades that take place through plugins (tested with dynamic economy, ecocreatures and others) and which hand out weirdly precise amounts of money seem to cause the issue.

I can force a similar error by giving myself an unrealistic amount of money, like 120.97999999999996. On the other hand. 120.12345 seems to work just fine.

On the face of it, it's all those plugins trying to pass an extremely precise fraction of money. I'd be tempted to suggest some form of rounding or truncating to deal with it.

greatman commented 12 years ago

What version are you trying? I beleive the latest dev-build I got that bug fixed.

greatman commented 12 years ago

Also, latest dev-build got a small bug on startup but it's nothing major (Just so you don't report the bug as shown in #15 :P

Malkierian commented 12 years ago

I get this right now, with version 2.3.5-b4, and it's whenever I use /money in any of its forms (/money, /money top, etc).

I am using the MySQL backend, if that matters.

greatman commented 12 years ago

Exactly the same error? Because I remember fixing that earlier last month.

Malkierian commented 12 years ago

OK, I suppose it's not EXACTLY the same error. I'll make a new issue.