mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 19:45:21 +01:00
Fix channel name validation in 1.13 to 1.12.2 protocol (#2701)
Closes #2187
This commit is contained in:
parent
e64a0fb62e
commit
a0f26f1ca3
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user