From e7e27885b3ff9f0d3a334a87d8e8b999112e8871 Mon Sep 17 00:00:00 2001 From: filoghost Date: Mon, 2 Aug 2021 22:38:53 +0200 Subject: [PATCH] Optimize Placeholder API detection --- .../plugin/bridge/placeholderapi/PlaceholderAPIHook.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/bridge/placeholderapi/PlaceholderAPIHook.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/bridge/placeholderapi/PlaceholderAPIHook.java index 871bebb6..000e5b19 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/bridge/placeholderapi/PlaceholderAPIHook.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/bridge/placeholderapi/PlaceholderAPIHook.java @@ -22,7 +22,13 @@ public class PlaceholderAPIHook { } public static boolean containsPlaceholders(String text) { - return PlaceholderAPI.containsPlaceholders(text); + int firstIndex = text.indexOf('%'); + if (firstIndex < 0) { + return false; + } + + int lastIndex = text.lastIndexOf('%'); + return lastIndex - firstIndex >= 2; // At least one character between the two indexes } public static String replacePlaceholders(Player player, String text) {