From 2856889bbea3dba07a44d867a5bb750cb866421c Mon Sep 17 00:00:00 2001 From: extendedclip Date: Mon, 26 Mar 2018 17:32:18 -0400 Subject: [PATCH] Escape placeholder pattern. fixes #4 --- pom.xml | 2 +- src/main/java/me/clip/placeholderapi/PlaceholderAPI.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index f635359..f03afb5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ me.clip placeholderapi - 2.8.5 + 2.8.5-Dev-${BUILD_NUMBER} PlaceholderAPI An awesome placeholder provider! http://extendedclip.com diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java index fcd6433..5d5079f 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java @@ -200,7 +200,7 @@ public class PlaceholderAPI { if (hooks.containsKey(identifier)) { String value = hooks.get(identifier).onPlaceholderRequest(player, params); if (value != null) { - text = text.replaceAll(m.group(), Matcher.quoteReplacement(value)); + text = text.replaceAll(Pattern.quote(m.group()), Matcher.quoteReplacement(value)); } } } @@ -250,7 +250,7 @@ public class PlaceholderAPI { Relational rel = (Relational) hooks.get(identifier); String value = rel.onPlaceholderRequest(one, two, params); if (value != null) { - text = text.replaceAll(m.group(), Matcher.quoteReplacement(value)); + text = text.replaceAll(Pattern.quote(m.group()), Matcher.quoteReplacement(value)); } } }