PluginBugs / Issues-ItemsAdder

Repository used to keep track of issues of my plugin ItemsAdder
https://itemsadder.devs.beer
54 stars 21 forks source link

Shopkeeper - Index out of Bound error #3527

Open L3v3lup opened 7 months ago

L3v3lup commented 7 months ago

Terms

Discord tag (optional)

l0v0lup

What happened?

This error occured after i adding items to a "Shopkeeper". I created an exchanger for items from 2022 and 2023 for 2024.

new egg nbt:

{CustomModelData:10003,display:{Lore:['{"italic":false,"color":"white","text":""}','{"italic":false,"color":"gray","text":"Info:"}','{"italic":false,"color":"green","text":"Teil des CP Osterevents."}','{"italic":false,"color":"green","text":"Kann am Spawn des Osterevents"}','{"italic":false,"color":"green","text":"eingetauscht werden."}','{"italic":true,"color":"dark_gray","text":"Benötigt das Server-Ressourcepack"}'],Name:'{"italic":false,"color":"gold","text":"Nele\'s Osterei"}'},itemsadder:{id:"egg4",namespace:"easter"}}

old egg nbt:

{CustomModelData:10003,display:{Lore:['{"text":""}','{"italic":false,"color":"gray","text":"Info:"}','{"italic":false,"color":"green","text":"Teil des CP Osterevents."}','{"italic":false,"color":"green","text":"Kann am Spawn des Osterevents"}','{"italic":false,"color":"green","text":"eingetauscht werden."}','{"italic":true,"color":"dark_gray","text":"Benötigt das Server-Ressourcepack"}'],Name:'{"italic":false,"color":"gold","text":"Nele\'s Osterei"}'},itemsadder:{id:"egg4",namespace:"easter"}}

Steps to reproduce the issue

  1. Add an item with the old- and one with a new nbt format to shopkeeper
  2. try to exchange it

Note: It does work - sometimes!

Server version

This server is running Purpur version git-Purpur-2062 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT)

ItemsAdder Version

ItemsAdder v3.6.3-beta-13

ProtocolLib Version

ProtocolLib v5.2.0-SNAPSHOT-679

LoneLibs Version

LoneLibs v1.0.45

FULL server log

latest.log

Error (optional)

[18:25:40 WARN]: [ItemsAdder] Task #804159 for ItemsAdder v3.6.3-beta-13 generated an exception
java.lang.IndexOutOfBoundsException: Index 9 out of bounds for length 8
        at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
        at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
        at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?]
        at java.util.Objects.checkIndex(Objects.java:361) ~[?:?]
        at java.util.ArrayList.remove(ArrayList.java:504) ~[?:?]
        at ia.m.oY.a(SourceFile:102) ~[ItemsAdder_3.6.3-beta-13.jar:?]
        at ia.m.oY.a(SourceFile:47) ~[ItemsAdder_3.6.3-beta-13.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1506) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:486) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1420) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1191) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322) ~[purpur-1.20.1.jar:git-Purpur-2062]
        at java.lang.Thread.run(Thread.java:857) ~[?:?]

Problematic items yml configuration file (optional)

No response

Other files, you can drag and drop them here to upload. (optional)

No response

Screenshots/Videos (you can drag and drop files or paste links)

No response

github-actions[bot] commented 7 months ago

Hello, your report will be looked into as soon as possible. Please do not bump this thread and don't post it on multiple platforms.

Thanks a lot for your patience.

LoneDev6 commented 6 months ago

Thanks for the report, anyway the new ItemsAdder version automatically allows trading recipes to accept items which were renamed or with different NBT. ItemsAdder checks if the item has the same id and namespace internally now. It can be disabled and enabled in config.yml

  fix_trades_guis_match_custom_items:
    itemsadder_trade_machines: true
    vanilla_villagers: false
    other_plugins: true ### <--- here

Also, is this issue happening a lot or rarely? Seems some edge case.

L3v3lup commented 6 months ago

Thank you for the quick fix. It happend quite frequently. I would say about 1 out of 2 or 3 trades.