Spliterash/MusicBox

IllegalPluginAccessException: Plugin attempted to register task while disabled

Closed this issue · 3 comments

mibby commented

MusicBox throws out an error when you shut down / restart the server while it is playing a song.

[08:50:27] [Server thread/INFO]: [MusicBox] Disabling MusicBox v2.0.3
[08:50:27] [Server thread/ERROR]: Error occurred while disabling MusicBox v2.0.3 (Is it up to date?)
[08:50:27] [Server thread/ERROR]: Suspected Plugins: 
[08:50:27] [Server thread/ERROR]: 	MusicBox{disabled,ver=2.0.3,path=plugins/MusicBox-2.0.3-all.jar}
[08:50:27] [Server thread/ERROR]: Exception details below: 
org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled
	at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.validate(CraftScheduler.java:542) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:212) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:197) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.runTaskLater(CraftScheduler.java:161) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.runTask(CraftScheduler.java:130) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at com.xxmicloxx.NoteBlockAPI.NoteBlockAPI.doSync(NoteBlockAPI.java:214) ~[?:?]
	at com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer.destroy(SongPlayer.java:590) ~[?:?]
	at ru.spliterash.musicbox.customPlayers.objects.SpeakerPlayer.destroy(SpeakerPlayer.java:63) ~[?:?]
	at ru.spliterash.musicbox.customPlayers.models.MusicBoxSongPlayerModel.lambda$destroyAll$0(MusicBoxSongPlayerModel.java:36) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at java.util.Collections$SetFromMap.forEach(Collections.java:5669) ~[?:?]
	at ru.spliterash.musicbox.customPlayers.models.MusicBoxSongPlayerModel.destroyAll(MusicBoxSongPlayerModel.java:36) ~[?:?]
	at ru.spliterash.musicbox.MusicBox.destroyAllPlayers(MusicBox.java:95) ~[?:?]
	at ru.spliterash.musicbox.MusicBox.onDisable(MusicBox.java:108) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:265) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:419) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:516) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:502) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:495) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at org.bukkit.craftbukkit.v1_16_R3.CraftServer.disablePlugins(CraftServer.java:434) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at net.minecraft.server.v1_16_R3.MinecraftServer.stop(MinecraftServer.java:774) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at net.minecraft.server.v1_16_R3.DedicatedServer.stop(DedicatedServer.java:725) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:176) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"0029c0e"]
	at java.lang.Thread.run(Thread.java:832) [?:?]
[08:50:32] [Server thread/ERROR]: Nag author: 'Spliterash' of 'MusicBox' about the following: This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies.

NoteBlockAPI call sync task when my plugin disabled, so i can't do anything, because im need destroy all my player songplayer

mibby commented

Is there no safer way to do this? Should this be reported to NoteBlockAPI instead?

Fixed in
#1