Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 14:30:17 +01:00
Display Java supported versions as list in dumps
Dieser Commit ist enthalten in:
Ursprung
1885a75d3c
Commit
9d09a7e418
@ -62,9 +62,16 @@ public class VersionCommand extends GeyserCommand {
|
|||||||
} else {
|
} else {
|
||||||
bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion();
|
bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion();
|
||||||
}
|
}
|
||||||
|
String javaVersions;
|
||||||
|
List<String> supportedJavaVersions = MinecraftProtocol.getJavaVersions();
|
||||||
|
if (supportedJavaVersions.size() > 1) {
|
||||||
|
javaVersions = supportedJavaVersions.get(0) + " - " + supportedJavaVersions.get(supportedJavaVersions.size() - 1);
|
||||||
|
} else {
|
||||||
|
javaVersions = supportedJavaVersions.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(),
|
sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(),
|
||||||
GeyserImpl.NAME, GeyserImpl.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions));
|
GeyserImpl.NAME, GeyserImpl.VERSION, javaVersions, bedrockVersions));
|
||||||
|
|
||||||
// Disable update checking in dev mode and for players in Geyser Standalone
|
// Disable update checking in dev mode and for players in Geyser Standalone
|
||||||
if (GeyserImpl.getInstance().productionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) {
|
if (GeyserImpl.getInstance().productionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) {
|
||||||
|
@ -207,14 +207,14 @@ public class DumpInfo {
|
|||||||
private final List<String> bedrockVersions;
|
private final List<String> bedrockVersions;
|
||||||
private final List<Integer> bedrockProtocols;
|
private final List<Integer> bedrockProtocols;
|
||||||
private final int defaultBedrockProtocol;
|
private final int defaultBedrockProtocol;
|
||||||
private final String javaVersion;
|
private final List<String> javaVersions;
|
||||||
private final int javaProtocol;
|
private final int javaProtocol;
|
||||||
|
|
||||||
MCInfo() {
|
MCInfo() {
|
||||||
this.bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList();
|
this.bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList();
|
||||||
this.bedrockProtocols = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList();
|
this.bedrockProtocols = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList();
|
||||||
this.defaultBedrockProtocol = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
this.defaultBedrockProtocol = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
||||||
this.javaVersion = MinecraftProtocol.getJavaVersion();
|
this.javaVersions = MinecraftProtocol.getJavaVersions();
|
||||||
this.javaProtocol = MinecraftProtocol.getJavaProtocolVersion();
|
this.javaProtocol = MinecraftProtocol.getJavaProtocolVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import com.nukkitx.protocol.bedrock.v471.Bedrock_v471;
|
|||||||
import com.nukkitx.protocol.bedrock.v475.Bedrock_v475;
|
import com.nukkitx.protocol.bedrock.v475.Bedrock_v475;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
@ -86,12 +87,12 @@ public final class MinecraftProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the supported Minecraft: Java Edition version name.
|
* Gets the supported Minecraft: Java Edition version names.
|
||||||
*
|
*
|
||||||
* @return the supported Minecraft: Java Edition version name
|
* @return the supported Minecraft: Java Edition version names
|
||||||
*/
|
*/
|
||||||
public static String getJavaVersion() {
|
public static List<String> getJavaVersions() {
|
||||||
return "1.18 - 1.18.1";
|
return Arrays.asList("1.18", "1.18.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,9 +105,9 @@ public final class MinecraftProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a string showing all supported versions for this Geyser instance
|
* @return a string showing all supported Bedrock versions for this Geyser instance
|
||||||
*/
|
*/
|
||||||
public static String getAllSupportedVersions() {
|
public static String getAllSupportedBedrockVersions() {
|
||||||
StringJoiner joiner = new StringJoiner(", ");
|
StringJoiner joiner = new StringJoiner(", ");
|
||||||
for (BedrockPacketCodec packetCodec : SUPPORTED_BEDROCK_CODECS) {
|
for (BedrockPacketCodec packetCodec : SUPPORTED_BEDROCK_CODECS) {
|
||||||
joiner.add(packetCodec.getMinecraftVersion());
|
joiner.add(packetCodec.getMinecraftVersion());
|
||||||
@ -115,6 +116,18 @@ public final class MinecraftProtocol {
|
|||||||
return joiner.toString();
|
return joiner.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a string showing all supported Java versions for this Geyser instance
|
||||||
|
*/
|
||||||
|
public static String getAllSupportedJavaVersions() {
|
||||||
|
StringJoiner joiner = new StringJoiner(", ");
|
||||||
|
for (String version : getJavaVersions()) {
|
||||||
|
joiner.add(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
return joiner.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private MinecraftProtocol() {
|
private MinecraftProtocol() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||||||
|
|
||||||
BedrockPacketCodec packetCodec = MinecraftProtocol.getBedrockCodec(loginPacket.getProtocolVersion());
|
BedrockPacketCodec packetCodec = MinecraftProtocol.getBedrockCodec(loginPacket.getProtocolVersion());
|
||||||
if (packetCodec == null) {
|
if (packetCodec == null) {
|
||||||
String supportedVersions = MinecraftProtocol.getAllSupportedVersions();
|
String supportedVersions = MinecraftProtocol.getAllSupportedBedrockVersions();
|
||||||
if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||||
// Too early to determine session locale
|
// Too early to determine session locale
|
||||||
session.getGeyser().getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
session.getGeyser().getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren