Open Mohron opened 6 years ago
@Mohron Thanks for catching this - evidently thinking the list would never be empty was a bad assumption. I'll let you know when I push out a new release
I may or may not have run into this myself... lol
I believe we already check for this here - are you sure you were using the latest version?
I checked, I'm using badgeup-sponge-client-v2.2.3, after all, there hasn't been an update for a long time and I'm pretty big on staying up to date. I can't even recall what server I was seeing this one but I've all but moved to 1.12 which has made the plugin unusable for me.
As you can see @RobertHerhold, the error clearly states version=2.2.3 which is the last working version for Sponge API 5/6.
[17:18:33] [Server thread/ERROR] [Sponge]: Could not pass SpawnEntityEvent$Impl to Plugin{id=badgeup, name=BadgeUp Sponge Client, version=2.2.3, description=Easily add Achievements and Awards to your Sponge server, url=https://www.badgeup.io/, authors=[Robert Herhold], source=/home/container/./plugins/badgeup-sponge-client-v2.2.3.jar}
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:657) ~[?:1.8.0_151]
at java.util.ArrayList.get(ArrayList.java:433) ~[?:1.8.0_151]
at io.badgeup.sponge.eventlistener.BadgeUpEventListener$7.provide(BadgeUpEventListener.java:140) ~[BadgeUpEventListener$7.class:?]
at io.badgeup.sponge.eventlistener.BadgeUpEventListener$7.provide(BadgeUpEventListener.java:136) ~[BadgeUpEventListener$7.class:?]
at io.badgeup.sponge.eventlistener.BadgeUpEventListener.processEvent(BadgeUpEventListener.java:161) ~[BadgeUpEventListener.class:?]
at io.badgeup.sponge.eventlistener.GeneralEventListener.event(GeneralEventListener.java:98) ~[GeneralEventListener.class:?]
at org.spongepowered.common.event.listener.EventListener_GeneralEventListener_event72.handle(Unknown Source) ~[?:?]
at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:313) ~[SpongeModEventManager.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:297) ~[SpongeModEventManager.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:338) ~[SpongeModEventManager.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:326) ~[SpongeModEventManager.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:143) ~[SpongeImpl.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.common.event.tracking.phase.packet.PacketFunction.lambda$static$33(PacketFunction.java:731) ~[PacketFunction.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.common.event.tracking.phase.packet.PacketPhase.unwind(PacketPhase.java:324) [PacketPhase.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.common.event.tracking.CauseTracker.completePhase(CauseTracker.java:226) [CauseTracker.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.common.event.tracking.CauseTracker.switchToPhase(CauseTracker.java:168) [CauseTracker.class:1.10.2-2477-5.2.0-BETA-2731]
at org.spongepowered.common.network.PacketUtil.onProcessPacket(PacketUtil.java:156) [PacketUtil.class:1.10.2-2477-5.2.0-BETA-2731]
at net.minecraft.network.PacketThreadUtil$1.redirect$onProcessPacket$zjj000(SourceFile:539) [fl$1.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [fl$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_151]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_151]
at net.minecraft.util.Util.func_181617_a(SourceFile:45) [h.class:?]
at org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:239) [SpongeImplHooks.class:1.10.2-2477-5.2.0-BETA-2731]
at net.minecraft.server.MinecraftServer.redirect$onRun$zhp000(MinecraftServer.java:3948) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:668) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:387) [ld.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
As stupid as it may be,
SpawnEntityEvent
can fire with the entity list empty. All that's needed is a check if the list is empty and exit the listener if it is.https://hastebin.com/uroholobay.scala