Skip to content

Conversation

@Smart123s
Copy link
Contributor

Summary of your change

So after implementing around half of the plans I've outlined in #608 (comment), I've realized that most of them are either false, or unnecessary.
From my test concluded today, I've realized that Floodgate now appends the prefixes to every player by the time they reach JoinManagement. The only exception to this, is when #493 occurs.
This PR makes JoinManagement use FloodgateApi.getCorrectUsername() instead of FloodgateApi.getUsername().

Related issue

Fixes #603
Fixes #616
Fixes #630
Fixes #632

@TuxCoding
Copy link
Owner

Correct me if I am wrong.

As far as I understand it ProtocolLib sees the original username while other platforms are infected by the prefix change and return the prefixed username on getUsername()? Does this solution support both linked cases?

@Smart123s Smart123s force-pushed the fix/floodgate/prefix-detect branch from 94be5d9 to 9978fe6 Compare October 23, 2021 13:56
@Smart123s
Copy link
Contributor Author

Does this solution support both linked cases?

It probably won't, because linked players don't have prefixes.
I have force pushed the branch with a fix, that's easy to delete (if #493 gets resolved).

@TuxCoding TuxCoding merged commit 40b4eae into TuxCoding:main Oct 23, 2021
@jondycz
Copy link

jondycz commented Oct 23, 2021

I don't use floodgate and I get the same error. Possible to implement a fix for users using Geyser without floodgate?

@jondycz
Copy link

jondycz commented Oct 23, 2021

I tried this:
GeyserSession isGeyserPlayer = GeyserConnector.getInstance().getPlayerByUuid(core.getResolver().findProfile(username).get().getId());

But unfortunately Geyser is always returning null no matter if i join from java or bedrock. But i guess that's a good start. I then use the boolean on the if(isPremium) condition, so that bedrock players are not being checked. But as i said earlier. For some reason geyser always returns null.

@Smart123s
Copy link
Contributor Author

@jondycz core.getResolver().findProfile(username) will send a request to Mojang API to get a Java player's UUID based on their names. Since you are having the encryption packet error, I assume that you have inserted that code into JoinManagement, or a to a class that extends it. At that part of the auth process, we don't have acces to UUIDs, so we have to rely on usernames only. If you want to get GeyserSessions by usernames, try something like this:

https://github.com/games647/FastLogin/blob/15c7411163b792bdbc296ce60c34daf9c1c19eb6/core/src/main/java/com/github/games647/fastlogin/core/hooks/GeyserService.java#L49-L57

Assuming from #616 (comment) (and the comments afterwards) you are using auth-type=offline in Geyser's config.

If I assume correctly (#616 (comment)) you are having the issue with players, who have used /premium. If I'm correct, than fixing this will require some additional code to make the behavior of FastLogin configurable in this scenario, because there might be people, who want premium players to be only able to log in, if they are authenticated through Mojang (no matter if they are using Geyser or not). Or at least that would be the way I'd mainline the changes. but if you just want to quickly implement it, then you can try something like I did in fix/floodgate/geyser-detect, an unused branch. Although please note, that that branch is untested.

For a generalized approach, I might create a new config entry called something like kickOfflineGeyserPlayersWithPremiumName. Any ideas on how to simplify it? 🤔

@jondycz
Copy link

jondycz commented Oct 23, 2021

@jondycz core.getResolver().findProfile(username) will send a request to Mojang API to get a Java player's UUID based on their names. Since you are having the encryption packet error, I assume that you have inserted that code into JoinManagement, or a to a class that extends it. At that part of the auth process, we don't have acces to UUIDs, so we have to rely on usernames only. If you want to get GeyserSessions by usernames, try something like this:

https://github.com/games647/FastLogin/blob/15c7411163b792bdbc296ce60c34daf9c1c19eb6/core/src/main/java/com/github/games647/fastlogin/core/hooks/GeyserService.java#L49-L57

Assuming from #616 (comment) (and the comments afterwards) you are using auth-type=offline in Geyser's config.

If I assume correctly (#616 (comment)) you are having the issue with players, who have used /premium. If I'm correct, than fixing this will require some additional code to make the behavior of FastLogin configurable in this scenario, because there might be people, who want premium players to be only able to log in, if they are authenticated through Mojang (no matter if they are using Geyser or not). Or at least that would be the way I'd mainline the changes. but if you just want to quickly implement it, then you can try something like I did in fix/floodgate/geyser-detect, an unused branch. Although please note, that that branch is untested.

For a generalized approach, I might create a new config entry called something like kickOfflineGeyserPlayersWithPremiumName. Any ideas on how to simplify it? 🤔

Yes you assumed correctly. Running server in offline mode and having issues with accounts who used /premium. So that requires some checks to be in place so that users joining from bedrock who used /premium are not being checked for Mojang authentication. I'm not really a java developer, but i can try taking a look.

Do you think you will be able to implement a configurable option for this in the near future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants