Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Update the outdated strings to be more concise
Dieser Commit ist enthalten in:
Ursprung
f16f91f469
Commit
e840828763
@ -63,7 +63,8 @@ public class VersionCommand extends GeyserCommand {
|
||||
bedrockVersions = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion();
|
||||
}
|
||||
|
||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions));
|
||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(),
|
||||
GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions));
|
||||
|
||||
// Disable update checking in dev mode and for players in Geyser Standalone
|
||||
if (GeyserConnector.getInstance().isProductionEnvironment() && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) {
|
||||
@ -72,14 +73,16 @@ public class VersionCommand extends GeyserCommand {
|
||||
Properties gitProp = new Properties();
|
||||
gitProp.load(FileUtils.getResource("git.properties"));
|
||||
|
||||
String buildXML = WebUtils.getBody("https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/" + URLEncoder.encode(gitProp.getProperty("git.branch"), StandardCharsets.UTF_8.toString()) + "/lastSuccessfulBuild/api/xml?xpath=//buildNumber");
|
||||
String buildXML = WebUtils.getBody("https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/" +
|
||||
URLEncoder.encode(gitProp.getProperty("git.branch"), StandardCharsets.UTF_8.toString()) + "/lastSuccessfulBuild/api/xml?xpath=//buildNumber");
|
||||
if (buildXML.startsWith("<buildNumber>")) {
|
||||
int latestBuildNum = Integer.parseInt(buildXML.replaceAll("<(\\\\)?(/)?buildNumber>", "").trim());
|
||||
int buildNum = Integer.parseInt(gitProp.getProperty("git.build.number"));
|
||||
if (latestBuildNum == buildNum) {
|
||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.no_updates", sender.getLocale()));
|
||||
} else {
|
||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.outdated", sender.getLocale(), (latestBuildNum - buildNum), "https://ci.geysermc.org/"));
|
||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.outdated",
|
||||
sender.getLocale(), (latestBuildNum - buildNum), "https://ci.geysermc.org/"));
|
||||
}
|
||||
} else {
|
||||
throw new AssertionError("buildNumber missing");
|
||||
|
@ -32,6 +32,7 @@ import org.geysermc.connector.GeyserConnector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* Contains information about the supported Bedrock protocols in Geyser.
|
||||
@ -49,7 +50,9 @@ public class BedrockProtocol {
|
||||
|
||||
static {
|
||||
if (!GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) {
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v440.V440_CODEC);
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v440.V440_CODEC.toBuilder()
|
||||
.minecraftVersion("1.17.0/1.17.1/1.17.2")
|
||||
.build());
|
||||
}
|
||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
||||
}
|
||||
@ -67,4 +70,16 @@ public class BedrockProtocol {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a string showing all supported versions for this Geyser instance
|
||||
*/
|
||||
public static String getAllSupportedVersions() {
|
||||
StringJoiner joiner = new StringJoiner(", ");
|
||||
for (BedrockPacketCodec packetCodec : SUPPORTED_BEDROCK_CODECS) {
|
||||
joiner.add(packetCodec.getMinecraftVersion());
|
||||
}
|
||||
|
||||
return joiner.toString();
|
||||
}
|
||||
}
|
||||
|
@ -56,14 +56,15 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||
public boolean handle(LoginPacket loginPacket) {
|
||||
BedrockPacketCodec packetCodec = BedrockProtocol.getBedrockCodec(loginPacket.getProtocolVersion());
|
||||
if (packetCodec == null) {
|
||||
String supportedVersions = BedrockProtocol.getAllSupportedVersions();
|
||||
if (loginPacket.getProtocolVersion() > BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
// Too early to determine session locale
|
||||
session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()));
|
||||
session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()));
|
||||
session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
||||
session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
||||
return true;
|
||||
} else if (loginPacket.getProtocolVersion() < BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()));
|
||||
session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()));
|
||||
session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
||||
session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren