mrgeneralq / sleep-most

Control the amount of percentage of sleeping players required to make it day. 100K+ downloads on spigot!
https://www.spigotmc.org/resources/sleep-most-1-14-4-configurable-messages-and-percentage.60623/
30 stars 12 forks source link

Could not pass event SleepSkipEvent to sleep-most v5.2.0 #183

Open 64BitUniverse opened 8 months ago

64BitUniverse commented 8 months ago

Describe the bug This isn't impacting gameplay, but when going through logs it causes an issue. Whenever someone sleeps, the console puts out:

java.lang.NullPointerException: Cannot invoke "me.mrgeneralq.sleepmost.interfaces.IBossBarService.setVisible(org.bukkit.World, boolean)" because "this.bossBarService" is null
    at me.mrgeneralq.sleepmost.eventlisteners.SleepSkipEventListener.onSleepSkip(SleepSkipEventListener.java:105) ~[sleep-most-5.2.0.jar:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor9.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:81) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:git-Paper-318]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.20.2.jar:git-Paper-318]
    at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[paper-1.20.2.jar:git-Paper-318]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at me.mrgeneralq.sleepmost.services.SleepService.executeSleepReset(SleepService.java:291) ~[sleep-most-5.2.0.jar:?]
    at me.mrgeneralq.sleepmost.runnables.NightcycleAnimationTask.run(NightcycleAnimationTask.java:57) ~[sleep-most-5.2.0.jar:?]
    at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.2.jar:git-Paper-318]
    at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.2.jar:git-Paper-318]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1470) ~[paper-1.20.2.jar:git-Paper-318]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.20.2.jar:git-Paper-318]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1379) ~[paper-1.20.2.jar:git-Paper-318]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1156) ~[paper-1.20.2.jar:git-Paper-318]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.20.2.jar:git-Paper-318]
    at java.lang.Thread.run(Thread.java:1589) ~[?:?]

To Reproduce Steps to reproduce the behavior:

  1. Set time to night (or wait)
  2. Go to sleep like normal
  3. See error in console

Expected behavior No console errors

Server:

Additional context /sm info returns:

allow-kick false
allow-sleep-cmd true
calculation-method percentage
clock-animation true
dynamic-animation-speed false
exempt-below-y -1
exempt-creative false
exempt-flying false
exempt-spectator false
feed false
gsit-hook false
gsit-sleep true
heal false
insomnia-chance 0.0
insomnia-milk false
mob-no-target true
nightcycle-animation true
non-sleeping-clock-animation false
non-sleeping-sound false
non-sleeping-title false
percentage-required 0.5
phantom-reset-audience all
players-requiered 1
precent-phantom false
prevent-sleep false
skip-delay 0
skip-night-sound ui.toast.challenge_complete
skip-storm true
skip-storm-sound entity.wither.spawn
storm-sleep true
use-afk false
use-bossbar false
use-exempt false
use-sound-night-skipped false
use-sound-storm-skipped false
use-title-night-skipped false
use-title-storm-skipped false
mrgeneralq commented 8 months ago

Hello @64BitUniverse Thank you for reporting this issue. I see that you are not using the latest version of spigot. This is ofcourse not a problem as the plugin is supposed to support from 1.8 range.

The issue originates from the support check I built in the code. When bossbars (in the API) are not supported, I don't register the boss bar service. This is causing an issue as there are places in the code where I simply don't use it.

I will need to adjust my code a little bit so I don't have scenario's where the bossbar service is NULL.

Thank you for reporting this issue!

Kind regards

Quinten

mrgeneralq commented 7 months ago

Hello @64BitUniverse

This problem will now be solved in the next release. A more long term approach will be taken to improve the architecture. Thank you for reporting and have a nice day!

PS: this ticket will be closed as soon as the plugin is released.

Kind regards

Quinten