koca2000 / NoteBlockAPI

https://www.spigotmc.org/resources/noteblockapi.19287/
GNU Lesser General Public License v3.0
119 stars 40 forks source link

ArrayIndexOutOfBoundsException: Index -235 out of bounds for length 360 #71

Closed mibby closed 3 years ago

mibby commented 3 years ago

RE: https://github.com/Spliterash/MusicBox/issues/8

Forwarding upstream to here too, not sure if it's the API or the MusicBox plugin at fault.

[09:55:10] [Server thread/ERROR]: [NoteBlockAPI] Task #1555381 for NoteBlockAPI v1.6.1.1-SNAPSHOT generated an exception
[09:55:10] [Server thread/ERROR]: [NoteBlockAPI] Suspected Plugins: 
[09:55:10] [Server thread/ERROR]: [NoteBlockAPI]    MusicBox{enabled,ver=2.0.3,path=plugins/MusicBox-2.0.3-all.jar}
[09:55:10] [Server thread/ERROR]: [NoteBlockAPI]    NoteBlockAPI{enabled,ver=1.6.1.1-SNAPSHOT,path=plugins/NoteBlockAPI-1.6.1.1-SNAPSHOT.jar}
[09:55:10] [Server thread/ERROR]: [NoteBlockAPI] Exception details below: 
java.lang.ArrayIndexOutOfBoundsException: Index -235 out of bounds for length 360
    at com.xxmicloxx.NoteBlockAPI.utils.MathUtils.stereoPan(MathUtils.java:44) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.utils.CompatibilityUtils.playSoundUniversal(CompatibilityUtils.java:195) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.utils.CompatibilityUtils.playSound(CompatibilityUtils.java:186) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.model.playmode.MonoMode.play(MonoMode.java:55) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer.playTick(EntitySongPlayer.java:78) ~[?:?]
    at ru.spliterash.musicbox.customPlayers.objects.SpeakerPlayer.playTick(SpeakerPlayer.java:77) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer.lambda$null$7(SongPlayer.java:441) ~[?:?]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[1.16.5-patched.jar:git-Yatopia-ver/1.16.5-"1cf37d8"]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:469) ~[1.16.5-patched.jar:git-Yatopia-ver/1.16.5-"1cf37d8"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1386) ~[1.16.5-patched.jar:git-Yatopia-ver/1.16.5-"1cf37d8"]
    at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:398) ~[1.16.5-patched.jar:git-Yatopia-ver/1.16.5-"1cf37d8"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1295) ~[1.16.5-patched.jar:git-Yatopia-ver/1.16.5-"1cf37d8"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1016) ~[1.16.5-patched.jar:git-Yatopia-ver/1.16.5-"1cf37d8"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:176) ~[1.16.5-patched.jar:git-Yatopia-ver/1.16.5-"1cf37d8"]
    at java.lang.Thread.run(Thread.java:832) [?:?]
koca2000 commented 3 years ago

Hi @mibby! Thank you for bug report. It is really a bug on NoteBlockAPI's side. Would you please provide some more information? What were you doing when this occured? Is it possible that it was shortly after a teleportation of the player?

mibby commented 3 years ago

That's possible, yes. A player was playing music and teleporting around when I noticed the error in console. If it's not that, could it maybe be caused by a song having too many notes / playing outside octave range?

koca2000 commented 3 years ago

That's possible, yes. A player was playing music and teleporting around when I noticed the error in console. If it's not that, could it maybe be caused by a song having too many notes / playing outside octave range?

The teleportation seems to be the issue. The error was caused by some unusual yaw value. I'll try to investigate it and change the code to prevent it.