Casino Slots

72.8k Downloads

NullPointerException: null on sendRewards

mibby opened this issue · 6 comments

commented

CasinoSlots dev 66

Slots seem to break whenever someone wins. Doesn't reward them and the slot becomes unusable, as it says it is currently in use when attempting to spin again once it stops.

For the slot type, I configured the rewards with an economy amount, no action.

    reward_money: 30.0
    reward_actions: []
[03:07:17] [Server thread/WARN]: [CasinoSlots] Task #18687 for CasinoSlots v3.0.0-SNAPSHOT-b66 generated an exception
java.lang.NullPointerException: null
	at com.craftyn.casinoslots.classes.SlotType.sendRewards(SlotType.java:174) ~[?:?]
	at com.craftyn.casinoslots.slot.game.ResultsTask.run(ResultsTask.java:54) ~[?:?]
	at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:58) ~[patched_1.12.jar:git-Paper-1130]
	at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:356) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:832) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664) [patched_1.12.jar:git-Paper-1130]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
[03:07:18] [Server thread/WARN]: [CasinoSlots] Task #18719 for CasinoSlots v3.0.0-SNAPSHOT-b66 generated an exception
java.lang.NullPointerException: null
	at com.craftyn.casinoslots.classes.SlotType.sendRewards(SlotType.java:174) ~[?:?]
	at com.craftyn.casinoslots.slot.game.ResultsTask.run(ResultsTask.java:54) ~[?:?]
	at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:58) ~[patched_1.12.jar:git-Paper-1130]
	at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:356) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:832) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766) [patched_1.12.jar:git-Paper-1130]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664) [patched_1.12.jar:git-Paper-1130]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
commented

@graywolf336 A fix for this whenever you next get the chance would be greatly appreciated, as it makes CasinoSlots unusable on production when it breaks on reward winnings. :P

commented

@mibby Just letting you know, I haven't actually tested any of these changes and have just been picking at the code base so I'm not sure I would recommend using it in a production setting. Maybe using it on a test server to verify it doesn't break your server via possibly glitches/bugs 🤔

Closing via: 8a6b9f7

commented

@graywolf336 I like to live on the edge. :) Someone's gotta test. Think I found another issue though.

Casino dev 67
Is CasinoSlots not reading the slots.yml to register slot locations at start-up / initialization? I noticed after a server restart, all my slots stopped working yet they were still configured in the slots.yml file.

commented

It also seems that rewarding is still not fixed as of dev 67. No more errors outputted in console and you can re-roll the slot after 'winning', but you aren't actually rewarded anything and you don't receive a message for the 3-in-a-row type you've won. Just seems nothing happens when you win.

As well as noticed the 'last winner' sign does not update, but that could be a side-effect of rewards not parsing unless the sign mechanic hasn't been re-implemented yet.

commented

Yes please @mibby 🥇

commented

@graywolf336 Would you like me to create new tickets for these issues?