RockinChaos / ItemJoin

Get custom items on join.
https://www.craftationgaming.com/
GNU Lesser General Public License v3.0
141 stars 36 forks source link

Initialization error on enable #591

Closed SlimeDog closed 6 months ago

SlimeDog commented 6 months ago

Server Version

git-Paper-49 (MC: 1.20.6)

Resource Version

6.0.6-SNAPSHOT-b981

Dump Information

https://ci.craftationgaming.com/dump?id=uzekawexux

Describe The Bug

On enable (server start-up)

[16:07:58] [Server thread/WARN]: [ItemJoin] Task #27 for ItemJoin v6.0.6-SNAPSHOT-b981 generated an exception
java.lang.ExceptionInInitializerError: null
        at ItemJoin-6.0.6-b981.jar/me.RockinChaos.itemjoin.item.ItemDesigner.setNBTData(ItemDesigner.java:448) ~[ItemJoin-6.0.6-b981.jar:?]
        at ItemJoin-6.0.6-b981.jar/me.RockinChaos.itemjoin.item.ItemDesigner.registerItems(ItemDesigner.java:92) ~[ItemJoin-6.0.6-b981.jar:?]
        at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.6.jar:git-Paper-49]
        at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:482) ~[paper-1.20.6.jar:git-Paper-49]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1151) ~[paper-1.20.6.jar:git-Paper-49]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:326) ~[paper-1.20.6.jar:git-Paper-49]
        at java.base/java.lang.Thread.run(Thread.java:1570) ~[?:?]
Caused by: java.lang.NumberFormatException: For input string: ""
        at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) ~[?:?]
        at java.base/java.lang.Integer.parseInt(Integer.java:565) ~[?:?]
        at java.base/java.lang.Integer.parseInt(Integer.java:685) ~[?:?]
        at ItemJoin-6.0.6-b981.jar/me.RockinChaos.itemjoin.core.utils.ReflectionUtils.<clinit>(ReflectionUtils.java:44) ~[ItemJoin-6.0.6-b981.jar:?]
        ... 7 more

Expected Behavior

Clean start-up

Steps To Reproduce

Additional Info

No response

Checklist

SlimeDog commented 6 months ago

In addition, even though 13 items are defined in items.yml and appear to be recognized on plugin enable

[17:37:50] [Server thread/INFO]: [ItemJoin] Enabling ItemJoin v6.0.6-SNAPSHOT-b981
[17:38:27] [Craft Scheduler Thread - 4 - ItemJoin/INFO]: [ItemJoin] Hooked into { Multiverse-Core, Multiverse-Inventories, WorldGuard, PlaceholderAPI, ProtocolLib, Citizens, Vault }
[17:38:27] [Craft Scheduler Thread - 4 - ItemJoin/INFO]: [ItemJoin] 13 Custom item(s) loaded!

ij list doesn't display them

> ij list
[17:43:56 INFO]: ]------------------[ ItemJoin ]-----------------[
[17:43:56 INFO]: world:
[17:43:56 INFO]:    No items are defined for this world.
[17:43:56 INFO]: world_nether:
[17:43:56 INFO]:    No items are defined for this world.
[17:43:56 INFO]: world_the_end:
[17:43:56 INFO]:    No items are defined for this world.
[17:43:56 INFO]: world_yellowdog:
[17:43:56 INFO]:    No items are defined for this world.
[17:43:56 INFO]: world_blackdog_nether:
[17:43:56 INFO]:    No items are defined for this world.
[17:43:56 INFO]: world_blackdog_the_end:
[17:43:56 INFO]:    No items are defined for this world.
[17:43:56 INFO]: world_whitedog:
[17:43:56 INFO]:    No items are defined for this world.
[17:43:56 INFO]: Type /ItemJoin List 2 for the next page.
[17:43:56 INFO]: ]----------------[ List Menu 1/2 ]---------------[
> ij list 2
[17:44:04 INFO]: ]------------------[ ItemJoin ]-----------------[
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_westeros:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_whitedog_nether:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_void:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_skyblock_nether:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_skyblock:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_luckyblock:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_lobby:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: world_yellowdog_nether:
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]:    No items are defined for this world.
[17:44:04 INFO]: ]----------------[ List Menu 2/2 ]---------------[
RockinChaos commented 6 months ago

Seems NBTTagCompound has changed to be different in paper than spigot. Give me a bit to figure out what is different and create yet-another-reflection-because-screw-consistency-I-guess.

Yeah.. probably should build a more robust way of outputting items that are loaded. Idk why but I designed it to just count the nodes that were read properly rather than ones that were actually mapped and set successfully (aka actually loaded).

SlimeDog commented 6 months ago

This may be helpful...

Per this from Paper developers

Once again, please also see the following forum post to make sure your plugins don't break: <https://forums.papermc.io/threads/important-dev-psa-future-removal-of-cb-package-relocation.1106/>

note that with the test Paper server paper-paperclip-1.20.4-R0.1-SNAPSHOT-mojmap.jar

Caused by: java.util.concurrent.CompletionException: java.lang.RuntimeException: Failed to remap plugin jar 'plugins/FancyHolograms-2.0.6.66.jar'
Caused by: java.lang.RuntimeException: Failed to remap plugin jar 'plugins/FancyHolograms-2.0.6.66.jar'

Recommended fixes are described in the cited post: https://forums.papermc.io/threads/important-dev-psa-future-removal-of-cb-package-relocation.1106/

RockinChaos commented 6 months ago

https://forums.papermc.io/threads/important-dev-psa-future-removal-of-cb-package-relocation.1106/

Right on the money! Thanks for the link as I would have never come across that based on the error I was given. I was about to go on a tirade explaining how I changed the versioning system (not because of paper) which just happens to conform to what that post describes. But it turns out I accidentally forgot about a static version check for MC 1.17 checking for the MC Remap that happened back then for the reflections which happens to be pasted in the reflection class.... So it was causing the ReflectionUtils class to not load because of the aforementioned issue in Paper's forum post.

But wow that error it throws is useless in identifying where the actual error is. Made me think it was an issue with the Reflection itself. I completely forgot about the static version check I added since it was so long ago.

Now the bigger issue that comes after fixing the version checking is that as the post says 1.20.5 (paper only) removes the obfuscation at runtime... that was an absolute pain to resolve considering Spigot still uses obfuscation so I had to map both..

Finally, I fixed the custom items loaded message. It now displays the total (actually loaded items) out of the number of items listed in the items.yml. So Loaded vs Nodes so you can see how many you have versus how many you should have.

Anyway, everything seems to be resolved now! I don't particularly test using paper so you may find something else I missed. From my brief testing, all errors were resolved and everything works on the default items.

Link; https://ci.craftationgaming.com/downloads Remember to remove your old ItemJoin.jar file

Let me know!~

SlimeDog commented 6 months ago

Now the bigger issue that comes after fixing the version checking is that as the post says 1.20.5 (paper only) removes the obfuscation at runtime... that was an absolute pain to resolve considering Spigot still uses obfuscation so I had to map both.

You and everyone else. I'll test it later today. Thanks.

SlimeDog commented 6 months ago

Looks good on Paper 1.20.6-49. Thanks.