Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Fix regressions in handling invalid account cases
Dieser Commit ist enthalten in:
Ursprung
4503991d37
Commit
7d176cd669
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package org.geysermc.connector.network.session;
|
package org.geysermc.connector.network.session;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||||
import com.github.steveice10.mc.auth.exception.request.AuthPendingException;
|
import com.github.steveice10.mc.auth.exception.request.AuthPendingException;
|
||||||
import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException;
|
import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException;
|
||||||
import com.github.steveice10.mc.auth.exception.request.RequestException;
|
import com.github.steveice10.mc.auth.exception.request.RequestException;
|
||||||
@ -593,7 +594,14 @@ public class GeyserSession implements CommandSender {
|
|||||||
authenticationService.setPassword(password);
|
authenticationService.setPassword(password);
|
||||||
authenticationService.login();
|
authenticationService.login();
|
||||||
|
|
||||||
protocol = new MinecraftProtocol(authenticationService.getSelectedProfile(), authenticationService.getAccessToken());
|
GameProfile profile = authenticationService.getSelectedProfile();
|
||||||
|
if (profile == null) {
|
||||||
|
// Java account is offline
|
||||||
|
disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode()));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol = new MinecraftProtocol(profile, authenticationService.getAccessToken());
|
||||||
} else {
|
} else {
|
||||||
// always replace spaces when using Floodgate,
|
// always replace spaces when using Floodgate,
|
||||||
// as usernames with spaces cause issues with Bungeecord's login cycle.
|
// as usernames with spaces cause issues with Bungeecord's login cycle.
|
||||||
@ -618,7 +626,9 @@ public class GeyserSession implements CommandSender {
|
|||||||
disconnect(ex.toString());
|
disconnect(ex.toString());
|
||||||
}
|
}
|
||||||
if (this.closed) {
|
if (this.closed) {
|
||||||
connector.getLogger().error("", ex);
|
if (ex != null) {
|
||||||
|
connector.getLogger().error("", ex);
|
||||||
|
}
|
||||||
// Client disconnected during the authentication attempt
|
// Client disconnected during the authentication attempt
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -657,6 +667,7 @@ public class GeyserSession implements CommandSender {
|
|||||||
}).whenComplete((response, ex) -> {
|
}).whenComplete((response, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
disconnect(ex.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response);
|
LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response);
|
||||||
@ -673,7 +684,14 @@ public class GeyserSession implements CommandSender {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
msaAuthenticationService.login();
|
msaAuthenticationService.login();
|
||||||
protocol = new MinecraftProtocol(msaAuthenticationService.getSelectedProfile(), msaAuthenticationService.getAccessToken());
|
GameProfile profile = msaAuthenticationService.getSelectedProfile();
|
||||||
|
if (profile == null) {
|
||||||
|
// Java account is offline
|
||||||
|
disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol = new MinecraftProtocol(profile, msaAuthenticationService.getAccessToken());
|
||||||
|
|
||||||
connectDownstream();
|
connectDownstream();
|
||||||
} catch (RequestException e) {
|
} catch (RequestException e) {
|
||||||
@ -773,11 +791,6 @@ public class GeyserSession implements CommandSender {
|
|||||||
public void connected(ConnectedEvent event) {
|
public void connected(ConnectedEvent event) {
|
||||||
loggingIn = false;
|
loggingIn = false;
|
||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
if (protocol.getProfile() == null) {
|
|
||||||
// Java account is offline
|
|
||||||
disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (downstream.isInternallyConnecting()) {
|
if (downstream.isInternallyConnecting()) {
|
||||||
// Connected directly to the server
|
// Connected directly to the server
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren