3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Update MCProtocolLib; add clearer errors for various connection issues

Errors that are a result of online mode and offline mode clashes are now clarified.
Users will now get a clearer message stating that the server is offline.

Resolves #2501
Dieser Commit ist enthalten in:
Camotoy 2021-10-07 11:00:43 -04:00
Ursprung e1085270b8
Commit 11bc083885
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
6 geänderte Dateien mit 47 neuen und 43 gelöschten Zeilen

Datei anzeigen

@ -42,6 +42,7 @@ import org.geysermc.connector.dump.BootstrapDumpInfo;
import org.geysermc.connector.network.translators.world.WorldManager; import org.geysermc.connector.network.translators.world.WorldManager;
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.connector.ping.IGeyserPingPassthrough;
import org.geysermc.connector.utils.Constants;
import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.connector.utils.LanguageUtils;
import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
@ -126,7 +127,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
// Remove this in like a year // Remove this in like a year
if (Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) { if (Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) {
geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/")); geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION));
this.getPluginLoader().disablePlugin(this); this.getPluginLoader().disablePlugin(this);
return; return;
} }

Datei anzeigen

@ -11,7 +11,7 @@
<artifactId>connector</artifactId> <artifactId>connector</artifactId>
<properties> <properties>
<adventure.version>4.8.0</adventure.version> <adventure.version>4.9.2</adventure.version>
<fastutil.version>8.5.2</fastutil.version> <fastutil.version>8.5.2</fastutil.version>
<jackson.version>2.12.4</jackson.version> <jackson.version>2.12.4</jackson.version>
<netty.version>4.1.66.Final</netty.version> <netty.version>4.1.66.Final</netty.version>
@ -147,15 +147,11 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.RednedEpic</groupId> <groupId>com.github.GeyserMC</groupId>
<artifactId>MCProtocolLib</artifactId> <artifactId>MCProtocolLib</artifactId>
<version>e17787a</version> <version>e7979c4</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
</exclusion>
<exclusion> <exclusion>
<groupId>com.github.steveice10</groupId> <groupId>com.github.steveice10</groupId>
<artifactId>packetlib</artifactId> <artifactId>packetlib</artifactId>
@ -226,30 +222,12 @@
<classifier>osx-x86_64</classifier> <classifier>osx-x86_64</classifier>
</dependency> </dependency>
<!-- Adventure text serialization --> <!-- Adventure text serialization -->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>${adventure.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
<version>${adventure.version}</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId> <artifactId>adventure-text-serializer-legacy</artifactId>
<version>${adventure.version}</version> <version>${adventure.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>${adventure.version}</version>
<scope>compile</scope>
</dependency>
<!-- Other --> <!-- Other -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

Datei anzeigen

@ -35,6 +35,7 @@ import com.github.steveice10.mc.auth.service.MsaAuthenticationService;
import com.github.steveice10.mc.protocol.MinecraftConstants; import com.github.steveice10.mc.protocol.MinecraftConstants;
import com.github.steveice10.mc.protocol.MinecraftProtocol; import com.github.steveice10.mc.protocol.MinecraftProtocol;
import com.github.steveice10.mc.protocol.data.SubProtocol; import com.github.steveice10.mc.protocol.data.SubProtocol;
import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe;
@ -100,6 +101,7 @@ import org.geysermc.cumulus.util.FormBuilder;
import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.crypto.FloodgateCipher;
import org.geysermc.floodgate.util.BedrockData; import org.geysermc.floodgate.util.BedrockData;
import java.net.ConnectException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -831,16 +833,44 @@ public class GeyserSession implements CommandSender {
public void disconnected(DisconnectedEvent event) { public void disconnected(DisconnectedEvent event) {
loggingIn = false; loggingIn = false;
loggedIn = false; loggedIn = false;
if (downstream != null && downstream.isInternallyConnecting()) {
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), event.getReason())); String disconnectMessage;
Throwable cause = event.getCause();
if (cause instanceof UnexpectedEncryptionException) {
if (remoteAuthType != AuthType.FLOODGATE) {
// Server expects online mode
disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", getLocale());
// Explain that they may be looking for Floodgate.
connector.getLogger().warning(LanguageUtils.getLocaleStringLog(
connector.getPlatformType() == PlatformType.STANDALONE ?
"geyser.network.remote.floodgate_explanation_standalone"
: "geyser.network.remote.floodgate_explanation_plugin",
Constants.FLOODGATE_DOWNLOAD_LOCATION
));
} else { } else {
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, event.getReason())); // Likely that Floodgate is not configured correctly.
disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.floodgate_login_error", getLocale());
if (connector.getPlatformType() == PlatformType.STANDALONE) {
connector.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.remote.floodgate_login_error_standalone"));
} }
if (event.getCause() != null) { }
event.getCause().printStackTrace(); } else if (cause instanceof ConnectException) {
// Server is offline, probably
disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.server_offline", getLocale());
} else {
disconnectMessage = MessageTranslator.convertMessageLenient(event.getReason());
} }
upstream.disconnect(MessageTranslator.convertMessageLenient(event.getReason())); if (downstream != null && downstream.isInternallyConnecting()) {
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage));
} else {
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage));
}
if (cause != null) {
cause.printStackTrace();
}
upstream.disconnect(disconnectMessage);
} }
@Override @Override

Datei anzeigen

@ -30,7 +30,6 @@ import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; import net.kyori.adventure.text.renderer.TranslatableComponentRenderer;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.gson.legacyimpl.NBTLegacyHoverEventSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -45,11 +44,8 @@ public class MessageTranslator {
// Custom instead of TranslatableComponentRenderer#usingTranslationSource so we don't need to worry about finding a Locale class // Custom instead of TranslatableComponentRenderer#usingTranslationSource so we don't need to worry about finding a Locale class
private static final TranslatableComponentRenderer<String> RENDERER = new MinecraftTranslationRegistry(); private static final TranslatableComponentRenderer<String> RENDERER = new MinecraftTranslationRegistry();
// Construct our own {@link GsonComponentSerializer} since we need to change a setting // Possible TODO: replace the legacy hover event serializer with an empty one since we have no use for hover events
private static final GsonComponentSerializer GSON_SERIALIZER = GsonComponentSerializer.builder() private static final GsonComponentSerializer GSON_SERIALIZER = DefaultComponentSerializer.get();
// Specify that we may be expecting legacy hover events
.legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get())
.build();
// Store team colors for player names // Store team colors for player names
private static final Map<TeamColor, String> TEAM_COLORS = new EnumMap<>(TeamColor.class); private static final Map<TeamColor, String> TEAM_COLORS = new EnumMap<>(TeamColor.class);
@ -90,9 +86,6 @@ public class MessageTranslator {
TEAM_COLORS.put(TeamColor.BOLD, BASE + "l"); TEAM_COLORS.put(TeamColor.BOLD, BASE + "l");
TEAM_COLORS.put(TeamColor.STRIKETHROUGH, BASE + "m"); TEAM_COLORS.put(TeamColor.STRIKETHROUGH, BASE + "m");
TEAM_COLORS.put(TeamColor.ITALIC, BASE + "o"); TEAM_COLORS.put(TeamColor.ITALIC, BASE + "o");
// Tell MCProtocolLib to use our serializer
DefaultComponentSerializer.set(GSON_SERIALIZER);
} }
/** /**

Datei anzeigen

@ -35,6 +35,8 @@ public final class Constants {
public static final String NEWS_OVERVIEW_URL = "https://api.geysermc.org/v1/news"; public static final String NEWS_OVERVIEW_URL = "https://api.geysermc.org/v1/news";
public static final String NEWS_PROJECT_NAME = "geyser"; public static final String NEWS_PROJECT_NAME = "geyser";
public static final String FLOODGATE_DOWNLOAD_LOCATION = "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/";
static { static {
URI wsUri = null; URI wsUri = null;
try { try {

@ -1 +1 @@
Subproject commit 1138a64627dec66fdb7f33c922ff6cd5636ec30a Subproject commit b3ef0d567d2e088a3b900741a464ad00524e9beb