java.lang.NumberFormatException: For input string: "shares"
Hello, can you help with this?
I am running the latest version of Paper for 1.17.1.
Thanks in advance!
```[03:42:12 INFO]: [Stocks] [ACF] Enabled Asynchronous Tab Completion Support! [03:42:12 WARN]: java.lang.NumberFormatException: For input string: "shares" [03:42:12 WARN]: at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) [03:42:12 WARN]: at java.base/java.lang.Long.parseLong(Long.java:714) [03:42:12 WARN]: at java.base/java.lang.Long.parseLong(Long.java:839) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.core.storage.CachedYMLStorage.getStocks(CachedYMLStorage.java:393) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.core.storage.CachedYMLStorage.get(CachedYMLStorage.java:75) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.core.storage.CachedYMLStorage.update(CachedYMLStorage.java:272) [03:42:12 WARN]: at Stocks.jar//com.tchristofferson.stocks.Stocks.onEnable(Stocks.java:155) [03:42:12 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) [03:42:12 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) [03:42:12 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) [03:42:12 WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) [03:42:12 WARN]: at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) [03:42:12 WARN]: at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:733) [03:42:12 WARN]: at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:317) [03:42:12 WARN]: at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1220) [03:42:12 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) [03:42:12 WARN]: at java.base/java.lang.Thread.run(Thread.java:831) [03:42:12 INFO]: [Stocks] Disabling Stocks v1.9.3
```
Comments (12)
-
repo owner -
I found several instances of Cooldown: being equal to something other than 0. Typically, these numbers looked to be a rollover from the Last purchase?
For example:
a2eb565f-eac9-4398-bedc-a06dbb376d84:
name: OdenoftheEast
AAPL:
shares: 10.0
invested: 1230.3
cooldown: 1606935033552
last-purchase: 1606934133552
-
Unfortunately, changing all the values of Cooldown: with any number besides 0 to 0, seems to have still resulted in the same error.
-
repo owner I think I may have found the bug. I will look into it some more. I will try and update soon.
-
I really appreciate it!
-
repo owner Never mind, I just realized your player-saves.yml file isn’t the correct format. It should look like this:
version: '1.0' player-saves: b5a3e507-e849-4f1e-86d6-1b2b5b6f0d78: name: tchristofferson AAPL: cooldown: 0 '1638737126670': shares: 1.0 price: 0.0
Are there any other errors? Can you upload your log file? What version did you update from? There must have been an issue updating your player-saves.yml file for some reason.
-
My first post contains the only error as far as I can tell. I believe this issue first happened after I updated from Stocks 1.7.4 to 1.8, though I’m not 100% sure, as it’s been a couple months. I’ll use your version of the player-saves, try deleting the cooldowns.yml, and let you know how it goes. Posting my log file next. Thanks again for your help.
-
Mostly everything is working now, after I did everything you suggested and updated the plugin. Unfortunately, for anyone that had existing information in their player-saves, like if they had owned stocks, get an error when attempting to buy or view their portfolio:
”Your profile has not been loaded yet!”
Any recommendations?
-
repo owner Is it for everyone or only some? Can you send me a download of your server's files inside of the plugins/stocks folder so I can use your exact files?
-
I believe it is only people that have some kind of data, i.e. they’ve actually got something in their portfolio. New users, or users that haven’t used the plugin are able to buy and see their portfolio as you would expect.
Here’s a link to my stock folder- https://drive.google.com/file/d/17xXO6IoL_hJBIRx3ZRW0d7Ro2hTcX1rY/view?usp=sharing
let me know if that link is broke
-
repo owner For some reason, your player saves file has a bunch of .NaN values rather than the actual price. Make sure you use the latest version of stocks (v1.9.4) and use this for your player saves: https://drive.google.com/file/d/1Gy9v9Fzvm-iaV7_6m_mErB5bEQHYKsEv/view?usp=sharing
-
repo owner - changed status to closed
- Log in to comment
Send me your player-saves.yml file. Somewhere in there, a cooldown is an invalid number. Make sure the cooldown key is actually “cooldown“ and that there aren’t any typos.