Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +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:
Ursprung
e1085270b8
Commit
11bc083885
@ -42,6 +42,7 @@ import org.geysermc.connector.dump.BootstrapDumpInfo;
|
||||
import org.geysermc.connector.network.translators.world.WorldManager;
|
||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||
import org.geysermc.connector.utils.Constants;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
import org.geysermc.connector.utils.LanguageUtils;
|
||||
import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
|
||||
@ -126,7 +127,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
|
||||
|
||||
// Remove this in like a year
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<artifactId>connector</artifactId>
|
||||
|
||||
<properties>
|
||||
<adventure.version>4.8.0</adventure.version>
|
||||
<adventure.version>4.9.2</adventure.version>
|
||||
<fastutil.version>8.5.2</fastutil.version>
|
||||
<jackson.version>2.12.4</jackson.version>
|
||||
<netty.version>4.1.66.Final</netty.version>
|
||||
@ -147,15 +147,11 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.RednedEpic</groupId>
|
||||
<groupId>com.github.GeyserMC</groupId>
|
||||
<artifactId>MCProtocolLib</artifactId>
|
||||
<version>e17787a</version>
|
||||
<version>e7979c4</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.github.steveice10</groupId>
|
||||
<artifactId>packetlib</artifactId>
|
||||
@ -226,30 +222,12 @@
|
||||
<classifier>osx-x86_64</classifier>
|
||||
</dependency>
|
||||
<!-- 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>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-legacy</artifactId>
|
||||
<version>${adventure.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
|
||||
<version>${adventure.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Other -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -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.MinecraftProtocol;
|
||||
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.player.GameMode;
|
||||
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.util.BedrockData;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -831,16 +833,44 @@ public class GeyserSession implements CommandSender {
|
||||
public void disconnected(DisconnectedEvent event) {
|
||||
loggingIn = 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 {
|
||||
// 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"));
|
||||
}
|
||||
}
|
||||
} else if (cause instanceof ConnectException) {
|
||||
// Server is offline, probably
|
||||
disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.server_offline", getLocale());
|
||||
} else {
|
||||
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, event.getReason()));
|
||||
}
|
||||
if (event.getCause() != null) {
|
||||
event.getCause().printStackTrace();
|
||||
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
|
||||
|
@ -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.renderer.TranslatableComponentRenderer;
|
||||
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 org.geysermc.connector.GeyserConnector;
|
||||
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
|
||||
private static final TranslatableComponentRenderer<String> RENDERER = new MinecraftTranslationRegistry();
|
||||
|
||||
// Construct our own {@link GsonComponentSerializer} since we need to change a setting
|
||||
private static final GsonComponentSerializer GSON_SERIALIZER = GsonComponentSerializer.builder()
|
||||
// Specify that we may be expecting legacy hover events
|
||||
.legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get())
|
||||
.build();
|
||||
// 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 = DefaultComponentSerializer.get();
|
||||
|
||||
// Store team colors for player names
|
||||
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.STRIKETHROUGH, BASE + "m");
|
||||
TEAM_COLORS.put(TeamColor.ITALIC, BASE + "o");
|
||||
|
||||
// Tell MCProtocolLib to use our serializer
|
||||
DefaultComponentSerializer.set(GSON_SERIALIZER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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_PROJECT_NAME = "geyser";
|
||||
|
||||
public static final String FLOODGATE_DOWNLOAD_LOCATION = "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/";
|
||||
|
||||
static {
|
||||
URI wsUri = null;
|
||||
try {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1138a64627dec66fdb7f33c922ff6cd5636ec30a
|
||||
Subproject commit b3ef0d567d2e088a3b900741a464ad00524e9beb
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren