Open bejoeled opened 2 years ago
Hello. I've looked into the linked website and it seems like this plugin could be used with an API (eighter BungeeCord plugin messaging, or direct Spigot library mapping). Theoretically, it could be possible, however, it's going to require quite a lot of resources to learn and properly test out, I'll have to contact a friend so we could test it out on a live server he owns, but first of all I'll have to contact the developers so I can fine tune exactly how this soft dependency is going to be implemented in my plugin (which conveniently enough may be at the Discord link as a starting point). I'll let you know with a further development of this. I've also received a similar feature request on Discord by another user, so I might end up looking into ways of implementing various APIs in my plugin.
I checked the code here and came up with an idea that should be able to support nLogin without problems.
I thought of using Server#getOfflinePlayer(String)
instead of the internal generator, since the UUID of nLogin is forwarded to the backend servers, so it will be stored in usercache.json.
And here it might be worth changing the AsyncPlayerPreLoginEvent event to PlayerLoginEvent, since the UUID will already be available through the getPlayer()
method
Those were my ideas, that was the most simplified way I thought of.
I was using PlayerLoginEvent
previously and didn't really work well, because it caused the player to join the server for a split moment before being kicked if the player wasn't on whitelist, and if you're using a plugin for player analytics, an auth plugin, etc, they clog your server with junk data. Even just vanilla server gets clogged with junk player data, because each player that joins will get assigned their inventory and ender chest. AsyncPlayerPreLoginEvent
makes sure that the player will never get to the server if the player is banned or not whitelisted and won't clog the server with junk data. I guess the only option now would be communicate with plugin API and get the correct UUID another way.
Not to mention that occasionally you could see a message that someone joined and immediately leaved, or depending on what plugins you used for authentication, only a leave message. With this simple fix, that issue no longer happens.
I was using
PlayerLoginEvent
previously and didn't really work well, because it caused the player to join the server for a split moment before being kicked if the player wasn't on whitelist
I think you can fix this by using PlayerLoginEvent#disallow() instead of Player#kickPlayer().
I recommend you check if the event has already been canceled before blocking - with [PlayerLoginEvent#getResult()](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerLoginEvent.html#getResult()), since, as you said, many other plugins can block login with PlayerLoginEvent.
Okay, I'll experiment a little bit with this thing and see how it will work. Although, I'll still need to use an API with this thing in order to ensure that servers using custom auth systems can work properly with my plugin.
You can see more details of the nLogin API here:
JavaDocs: https://jd.nickuc.com/nlogin/ Maven/Gradle: https://en.docs.nickuc.com/development/maven-gradle
Is your feature request related to a problem? Please describe. We have an authentication plugin in our server called nlogin (https://en.docs.nickuc.com/about) and it allows Premium Minecraft users to automatically login without typing in the password. They use a different UUID system in their configuration. However, after installing BetterWhitelist, it stopped letting premium Minecraft users to automatically login. Perhaps because BetterWhitelist uses offline UUID which nlogin does not use.
Describe the solution you'd like Is it possible to make BetterWhitelist work perfectly with nlogin?
Describe alternatives you've considered
Additional context Here's their discord server: https://discord.gg/JXzf9YrDJN