IllegalArgumentException: bound must be positive
mibby opened this issue · 2 comments
Assuming error is caused by 694ee9f with missing probability: #
for items.
[04:53:29] [Server thread/WARN]: [ItemJoin] Task #500 for ItemJoin v4.8-SNAPSHOT generated an exception
java.lang.IllegalArgumentException: bound must be positive
at java.util.Random.nextInt(Random.java:388) ~[?:?]
at me.RockinChaos.itemjoin.utils.ProbabilityUtilities.getRandomElement(ProbabilityUtilities.java:51) ~[ItemJoin-4.8-SNAPSHOT.jar:?]
at me.RockinChaos.itemjoin.listeners.giveitems.SetItems.setProbabilityItems(SetItems.java:67) ~[ItemJoin-4.8-SNAPSHOT.jar:?]
at me.RockinChaos.itemjoin.listeners.giveitems.PlayerJoin.setJoinItems(PlayerJoin.java:72) ~[ItemJoin-4.8-SNAPSHOT.jar:?]
at me.RockinChaos.itemjoin.listeners.giveitems.PlayerJoin$2.run(PlayerJoin.java:63) ~[ItemJoin-4.8-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:63) ~[patched_1.12.2.jar:git-Paper-1424]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) [patched_1.12.2.jar:git-Paper-1424]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:833) [patched_1.12.2.jar:git-Paper-1424]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:427) [patched_1.12.2.jar:git-Paper-1424]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:767) [patched_1.12.2.jar:git-Paper-1424]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:665) [patched_1.12.2.jar:git-Paper-1424]
at java.lang.Thread.run(Thread.java:844) [?:?]
I'm not sure, they shouldn't throw errors if its missing (otherwise it would be throwing a NULL error), it just skips over them as if they aren't defined in the config. Somehow a number is being passed to the Probability counter that it does not like.
Can you post your items.yml pastebin link please?
Also thanks so much for testing the snapshot.
EDIT: Found out what the issue is, you were correct. The error specifically occurs when probability is fully removed from the items.yml, (when none of the items are using the probability option). It was passing an empty HashMap to the probability counter creating infinitely negative numbers. This has been fixed here; http://ci.craftationgaming.com/job/ItemJoin/116/