From 749d1ff5a068b26cc457e79c063d1de005e13376 Mon Sep 17 00:00:00 2001 From: filoghost Date: Sun, 19 Dec 2021 12:07:53 +0100 Subject: [PATCH] Cleanup PlaceholderAPIHook --- .../placeholderapi/PlaceholderAPIHook.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) 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 f3f8b122..421c162c 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 @@ -6,11 +6,9 @@ package me.filoghost.holographicdisplays.plugin.bridge.placeholderapi; import me.clip.placeholderapi.PlaceholderAPI; -import me.filoghost.fcommons.Strings; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class PlaceholderAPIHook { @@ -24,21 +22,11 @@ public class PlaceholderAPIHook { enabled = true; } - public static boolean containsPlaceholderPattern(@Nullable String text) { - if (Strings.isEmpty(text)) { - return false; - } - - 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 @NotNull String replacePlaceholders(@NotNull Player player, @NotNull String text) { + if (!enabled) { + return text; + } + return PlaceholderAPI.setPlaceholders(player, text); }