mcMMO-Dev / mcMMO-Classic

mcMMO Classic.
https://www.spigotmc.org/resources/official-mcmmo-classic.2445/
Other
37 stars 44 forks source link

InventoryClickEvent ArrayIndexOutOfBoundsException #82

Closed ArtelGG closed 3 years ago

ArtelGG commented 3 years ago

This exception occurs when using the "swap item with offhand" keybind whilst in an inventory.

[22:30:39 ERROR]: Could not pass event InventoryClickEvent to mcMMO v1.6.4-SNAPSHOT
java.lang.ArrayIndexOutOfBoundsException: -1
        at java.util.Arrays$ArrayList.get(Unknown Source) ~[?:1.8.0_271]
        at net.minecraft.server.v1_16_R3.NonNullList.get(SourceFile:46) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.PlayerInventory.getItem(PlayerInventory.java:541) ~[patched_1.16.4.jar:git-Paper-282]
        at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory.getItem(CraftInventory.java:49) ~[patched_1.16.4.jar:git-Paper-282]
        at com.gmail.nossr50.listeners.InventoryListener.onInventoryClickEvent(InventoryListener.java:316) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor76.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.4.jar:git-Paper-282]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.4.jar:git-Paper-282]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.4.jar:git-Paper-282]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:2527) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.PacketPlayInWindowClick.a(SourceFile:32) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.PacketPlayInWindowClick.a(SourceFile:10) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1136) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1129) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1090) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1004) ~[patched_1.16.4.jar:git-Paper-282]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.4.jar:git-Paper-282]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_271]

EDIT 1: It appears to be upset with this line of code. I'm trying some solutions locally. event.getHotbarButton() is returning as -1.

EDIT 2: I forgot to mention that this issue only occurs in survival/adventure mode.

Remski01 commented 3 years ago

mcMMO v1.6.4-SNAPSHOT never seen such version, try the latest version(2 .1.157)

Edit: Ow yeah, was about to check that. Also just now that this is mcMMO-Classic.

Draycia commented 3 years ago

@Remski01 1.6.4-SNAPSHOT is the dev version of classic. 2.1.157 is the release version of overhaul.

t00thpick1 commented 3 years ago

Interesting.. We don't really do anything special with the inventory, I'll track this down this Saturday.

cursefroge commented 3 years ago

Do you have any GUIs?

ArtelGG commented 3 years ago

@BrawlyTheInventor

Do you have any GUIs?

In the particular instance where I initially discovered the issue, yes, the server did have GUIs present from various sources, most of which are just GUI alternatives to modifying configuration file options. However, this can be reproduced on a Paper 1.16.4 server with nothing but mcMMO present.

t00thpick1 commented 3 years ago

Should be fixed by latest commits