From 8a80c063b78d0e4660f2bfe6f159cd0a0dffa6fa Mon Sep 17 00:00:00 2001 From: filoghost Date: Sat, 25 Sep 2021 12:38:35 +0200 Subject: [PATCH] Do not make *PlaceholderReplacementSupplier extend *Placeholder --- .../api/placeholder/GlobalPlaceholder.java | 16 +++++++++++++++- .../GlobalPlaceholderReplacementSupplier.java | 7 +------ .../api/placeholder/IndividualPlaceholder.java | 11 ++++++++++- ...IndividualPlaceholderReplacementSupplier.java | 2 ++ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholder.java b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholder.java index b2b803df..725e52a2 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholder.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholder.java @@ -5,9 +5,23 @@ */ package me.filoghost.holographicdisplays.api.placeholder; +import org.jetbrains.annotations.Nullable; + /** * @since 1 */ -public interface GlobalPlaceholder extends GlobalPlaceholderReplacementSupplier, Placeholder { +public interface GlobalPlaceholder extends Placeholder { + + /** + * Callback for providing a placeholder replacement, given the argument of the placeholder (if present). + *

+ * For example, the argument of {test} is null, the argument of {test: hello world} is the string "hello world". + *

+ * Warning: this method should be performance efficient, as it may be invoked often. + * + * @return the placeholder replacement + * @since 1 + */ + @Nullable String getReplacement(@Nullable String argument); } diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacementSupplier.java b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacementSupplier.java index eac76ea8..1aa7cbaf 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacementSupplier.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacementSupplier.java @@ -16,13 +16,8 @@ import org.jetbrains.annotations.Nullable; public interface GlobalPlaceholderReplacementSupplier { /** - * Callback for providing a placeholder replacement, given the argument of the placeholder (if present). - *

- * For example, the argument of {test} is null, the argument of {test: hello world} is the string "hello world". - *

- * Warning: this method should be performance efficient, as it may be invoked often. + * @see GlobalPlaceholder#getReplacement(String) * - * @return the placeholder replacement * @since 1 */ @Nullable String getReplacement(@Nullable String argument); diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholder.java b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholder.java index e4ff511e..1ce6f15a 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholder.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholder.java @@ -5,9 +5,18 @@ */ package me.filoghost.holographicdisplays.api.placeholder; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + /** * @since 1 */ -public interface IndividualPlaceholder extends IndividualPlaceholderReplacementSupplier, Placeholder { +public interface IndividualPlaceholder extends Placeholder { + + /** + * @since 1 + */ + @Nullable String getReplacement(@NotNull Player player, @Nullable String argument); } diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacementSupplier.java b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacementSupplier.java index 0e684130..caf67c9c 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacementSupplier.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacementSupplier.java @@ -16,6 +16,8 @@ import org.jetbrains.annotations.Nullable; public interface IndividualPlaceholderReplacementSupplier { /** + * @see IndividualPlaceholder#getReplacement(Player, String) + * * @since 1 */ @Nullable String getReplacement(@NotNull Player player, @Nullable String argument);