3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-09 17:50:23 +01:00

Ensure normal keys that end with numbers dont get matched and replaced

Dieser Commit ist enthalten in:
connorhartley 2020-08-17 00:20:39 +12:00
Ursprung 37170a2180
Commit a4920a2c74

Datei anzeigen

@ -9,7 +9,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class ChatItemRewriter { public class ChatItemRewriter {
private static final Pattern indexRemoval = Pattern.compile("\\d+:(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)"); private static final Pattern indexRemoval = Pattern.compile("(?<![\\w-.+])\\d+:(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)");
// Taken from https://stackoverflow.com/questions/6462578/alternative-to-regex-match-all-instances-not-inside-quotes // Taken from https://stackoverflow.com/questions/6462578/alternative-to-regex-match-all-instances-not-inside-quotes
public static void toClient(JsonElement element, UserConnection user) { public static void toClient(JsonElement element, UserConnection user) {