frengor / UltimateAdvancementAPI

A powerful API to create custom advancements for your Minecraft server.
https://modrinth.com/plugin/ultimateadvancementapi
GNU General Public License v3.0
117 stars 13 forks source link

Enchanting bug #75

Closed Yuch135 closed 8 months ago

Yuch135 commented 9 months ago

I'm using this API in one of my plugins and I've encountered an issue and I'm wondering if it could be fixed.

I'm using the plugin ExcellentEnchants which adds new enchantments to the vanilla ones and when a player enchants something the new enchantments should appear on the enchant hint and when the player enchants, but when I enable the API the enchants stop appearing on the table.

frengor commented 9 months ago

Hi! Can you please provide the steps to reproduce the issue and a video showing the bug? Also, are there any errors in the server console?

Yuch135 commented 9 months ago

Steps:

While starting the server with UltimateAdvancementAPI the following warning appears in console: image

Video: https://github.com/user-attachments/assets/f4d9f43f-d0f7-4421-8491-e21b82e13569

Thank you 😀

frengor commented 9 months ago

I can see in the video that you have plugman installed. Please try restarting the server completely instead of using plugins like plugman.

If that doesn't fix it, can you please provide the entire log of the server with and without UltimateAdvancementAPI installed? (preferribly using a pastebin)

Yuch135 commented 9 months ago

Tried it without plugman and still same issue.

There you go:

With UltimateAdvancementAPI: https://pastebin.com/VyLbeiL0 Without UltimateAdvancementAPI: https://pastebin.com/1qcvWhnA

frengor commented 8 months ago

The issue is caused by the library CommandAPI, which we use to implement commands for UltimateAdvancementAPI. Trying to load ExcellentEnchants with just CommandAPI results in the same warning in console and custom enchantments not working. Instead, when loading a version of UltimateAdvancementAPI without commands no warnings appear and everything works fine.

My guess at what is causing the issue is that CommandAPI reloads datapacks at the end of the server initialization (see their wiki), which causes minecraft to reset the loaded enchantments. If this is the case, one way to resolve the issue may be making ExcellentEnchants to re-register enchantments when this reload happens.