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

This commit is contained in:
connorhartley 2020-08-17 00:20:39 +12:00
parent 37170a2180
commit a4920a2c74

View File

@ -9,7 +9,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
import java.util.regex.Pattern;
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
public static void toClient(JsonElement element, UserConnection user) {