oliverdunk / JukeboxAPI

Java API for Jukebox, my web based music player.
MIT License
19 stars 16 forks source link

Cannot remove a region with 2 or more players in it. #28

Closed AmusedNetwork closed 6 years ago

AmusedNetwork commented 6 years ago

If a user tries to remove a region with more than 2 players in it, it fails and a stack trace is displayed in the console, shown below.

[19:14:40 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'jukebox' in plugin MCJukebox v2.5.2
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-eb3d921-b9f1615]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-eb3d921-b9f1615]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:648) ~[spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1397) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1232) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
        at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot.jar:git-Spigot-eb3d921-b9f1615]
        at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextNode(Unknown Source) ~[?:?]
        at java.util.HashMap$EntryIterator.next(Unknown Source) ~[?:?]
        at java.util.HashMap$EntryIterator.next(Unknown Source) ~[?:?]
        at net.mcjukebox.plugin.bukkit.managers.RegionManager.removeRegion(RegionManager.java:65) ~[?:?]
        at net.mcjukebox.plugin.bukkit.commands.JukeboxCommand.onCommand(JukeboxCommand.java:66) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-eb3d921-b9f1615]
        ... 15 more

Error occurs at the following for loop in RegionManager

https://github.com/oliverdunk/JukeboxAPI/blob/master/src/main/java/net/mcjukebox/plugin/bukkit/managers/RegionManager.java#L65