Merge pull request #2003 from connorhartley/chatitemrewriter-fix

Ensure normal keys that end with numbers don't get matched and replaced when replacing indexes
This commit is contained in:
Nassim 2020-08-16 21:11:12 +02:00 committed by GitHub
commit 83a49a686a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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) {