games647 / FastLogin

Checks if a minecraft player has a valid paid account. If so, they can skip offline authentication automatically. (premium auto login)
https://www.spigotmc.org/resources/fastlogin.14153
MIT License
502 stars 121 forks source link

[Bug/Limitation] Premium UUID when user is offline #285

Closed LoneDev6 closed 4 years ago

LoneDev6 commented 4 years ago

What behaviour is observed:

UUID is not replaced to premium when plugins call getUniqueId on offline player. So plugins will get a different UUID if they get UUID when user is offline.

What behaviour is expected:

A way to allow plugins that need to get UUID to get the same UUID when user is online and offline

Steps/models to reproduce:

Call this code when user is online and after user is logged out: System.out.println(Bukkit.getOfflinePlayer("LoneDev").getUniqueId().toString());

User must be premium and "premiumUuid" option of FastLogin must be set to true

Plugin list:

Authme and FastLogin

Environment description

1.14.4, Paper

Plugin version or build number (don't write latest):

git-Paper-209

Configuration:

https://hasteb.in/ogahaqan.yaml

LoneDev6 commented 4 years ago

Bump

games647 commented 4 years ago

If the player is logged in using an premium connection and premiumUUID is enabled, then the premium UUID will be returned on getUniqueId(). However if the server is in offline mode (onlinemode setting), the server will use the UUID based on the player name in offline mode except BungeeCord is also enabled, then it will first try search the user profile cache.

LoneDev6 commented 4 years ago

So it's a spigot bug? I mean, spigot MUST check on its cache (or implement UUID caching system). But Bungeecord has UUID caching system?

If it's like that you should add this to FAQ, it's really important to avoid confusion

games647 commented 4 years ago

Sorry if that was misleading. No it's not bug of Spigot. I think everything works as it should. For Spigot either onlinemode or offlinemode exists. Mixed onlinemode isn't really supported.

I mean, spigot MUST check on its cache (or implement UUID caching system).

It does if the server is either in onlinemode or uses BungeeCord. Otherwise file access is redundant, because offlinemode UUIDs are only dependent on the case sensitive username.

But Bungeecord has UUID caching system?

No, Spigot has. Sorry if that was misleading.

If it's like that you should add this to FAQ, it's really important to avoid confusion

I just found that out, but yes you are right.

LoneDev6 commented 4 years ago

Thanks a lot! I think we could try to hook/patch the original Spigot method getUniqueId to return premium UUID when premium user is not ingame (and FastLogin is loaded, obv). I don't really know if it's possible to edit bytecode at runtime or to detour a function while Spigot is running.

games647 commented 4 years ago

There are multiple reasons against it. Sorry to say that.

LoneDev6 commented 4 years ago

Thanks for the clarification! I edited my plugins to cache UUIDs in files, I hope also other plugins will do the same.