frengor / UltimateAdvancementAPI

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

API not work with offline mode server #31

Closed Xen0Xys closed 2 years ago

Xen0Xys commented 2 years ago

I foud out that the UltimateAdvancementAPI is not working when the server is on offline mode

You can see in the first picture that the advancement is granted, but in the advancement tab there is no advancements (the root advancement is normally grant automaticly but there is nothing on the chat about it):

Screenshot_1 Screenshot_2 Screenshot_3

Thanks for your help!

frengor commented 2 years ago

You have to listen to the PlayerLoadingCompletedEvent instead of PlayerJoinEvent, so your code will be:

@EventHandler
public void onPlayerLoading(PlayerLoadingCompletedEvent e) {
    advancementManager.getBaseAdvancement("temp").grant(e.getPlayer());
}

Also, whether the server is in online or offline mode should not matter at all.

Xen0Xys commented 2 years ago

So your change didn't change anything for me, but I found out something: When the world is created online and I connect myself, I got the advancements without any problems After that, if I put the server on offline mode, and connect myself with the same username, something is causing troubles with the advancement grant.

So at this point my problem is solved, thanks for your help!

frengor commented 2 years ago

It feels like there's some kind of server bug. Are there any errors in the console? What server software are you using?

Xen0Xys commented 2 years ago

No errors, I used paper-1.19.2-177 for my tests