diff --git a/Core/src/main/java/com/craftaro/core/chat/MiniMessagePlaceholder.java b/Core/src/main/java/com/craftaro/core/chat/MiniMessagePlaceholder.java index e74ffba3..22fec763 100644 --- a/Core/src/main/java/com/craftaro/core/chat/MiniMessagePlaceholder.java +++ b/Core/src/main/java/com/craftaro/core/chat/MiniMessagePlaceholder.java @@ -1,11 +1,15 @@ package com.craftaro.core.chat; public class MiniMessagePlaceholder { + + public static String PLACEHOLDER_PREFIX = "%"; + public static String PLACEHOLDER_SUFFIX = "%"; + private final String placeholder; private final String value; public MiniMessagePlaceholder(String placeholder, String value) { - this.placeholder = "%" + placeholder + "%"; + this.placeholder = PLACEHOLDER_PREFIX + placeholder + PLACEHOLDER_SUFFIX; this.value = value; } @@ -16,4 +20,38 @@ public String getPlaceholder() { public String getValue() { return this.value; } + + public static void setPlaceholderPrefix(String prefix) { + if (prefix == null) { + throw new IllegalArgumentException("Prefix cannot be null"); + } + if (prefix.isEmpty()) { + throw new IllegalArgumentException("Prefix cannot be empty"); + } + if (prefix.equals(PLACEHOLDER_SUFFIX)) { + throw new IllegalArgumentException("Prefix cannot be the same as the suffix"); + } + PLACEHOLDER_PREFIX = prefix; + } + + public static void setPlaceholderSuffix(String suffix) { + if (suffix == null) { + throw new IllegalArgumentException("Suffix cannot be null"); + } + if (suffix.isEmpty()) { + throw new IllegalArgumentException("Suffix cannot be empty"); + } + if (suffix.equals(PLACEHOLDER_PREFIX)) { + throw new IllegalArgumentException("Suffix cannot be the same as the prefix"); + } + PLACEHOLDER_SUFFIX = suffix; + } + + public static String getPlaceholderPrefix() { + return PLACEHOLDER_PREFIX; + } + + public static String getPlaceholderSuffix() { + return PLACEHOLDER_SUFFIX; + } }