3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Fix channel name validation in 1.13 to 1.12.2 protocol (#2701)

Closes #2187
Dieser Commit ist enthalten in:
Gero 2021-10-03 12:12:49 +02:00 committet von GitHub
Ursprung e64a0fb62e
Commit a0f26f1ca3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -137,15 +137,17 @@ public class MappingData extends MappingDataBase {
return null; // Not valid
}
int separatorIndex = newId.indexOf(':');
// Vanilla parses ``:`` and ```` as ``minecraft:`` (also ensure there's enough space)
if ((separatorIndex == -1 || separatorIndex == 0) && newId.length() <= 10) {
// Vanilla parses an empty and a missing namespace as the minecraft namespace
if (separatorIndex == -1) {
newId = "minecraft:" + newId;
} else if (separatorIndex == 0) {
newId = "minecraft" + newId;
}
return newId;
}
public static boolean isValid1_13Channel(String channelId) {
return channelId.matches("([0-9a-z_.-]+):([0-9a-z_/.-]+)");
return channelId.matches("([0-9a-z_.-]+:)?[0-9a-z_/.-]+");
}
private void loadTags(Map<String, Integer[]> output, JsonObject newTags) {