From 98c1dd025ace0c36c037d72916ec46d47a201d3f Mon Sep 17 00:00:00 2001 From: Demeng7215 Date: Fri, 12 Apr 2024 15:10:55 -0400 Subject: [PATCH] Add Placeholders --- .../demeng/pluginbase/model/Placeholders.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pluginbase-core/src/main/java/dev/demeng/pluginbase/model/Placeholders.java diff --git a/pluginbase-core/src/main/java/dev/demeng/pluginbase/model/Placeholders.java b/pluginbase-core/src/main/java/dev/demeng/pluginbase/model/Placeholders.java new file mode 100644 index 00000000..ce1b167e --- /dev/null +++ b/pluginbase-core/src/main/java/dev/demeng/pluginbase/model/Placeholders.java @@ -0,0 +1,21 @@ +package dev.demeng.pluginbase.model; + +import dev.demeng.pluginbase.DynamicPlaceholders; +import java.util.function.UnaryOperator; +import lombok.Data; +import org.jetbrains.annotations.NotNull; + +/** + * A shorthand version of {@link DynamicPlaceholders}, allowing for string placeholders to be easily + * applied on strings, lists, and item stacks. + */ +@Data(staticConstructor = "of") +public class Placeholders implements DynamicPlaceholders { + + private final UnaryOperator placeholderReplacer; + + @Override + public @NotNull String setPlaceholders(@NotNull String str) { + return placeholderReplacer.apply(str); + } +}