From 769d3dacb2bb621391b6a46c82c6a3ba1484171c Mon Sep 17 00:00:00 2001 From: filoghost Date: Sun, 19 Sep 2021 21:08:26 +0200 Subject: [PATCH] Rename PlaceholderReplacer to PlaceholderReplacementSupplier --- .../api/HolographicDisplaysAPI.java | 4 ++-- .../api/placeholder/GlobalPlaceholder.java | 2 +- ...=> GlobalPlaceholderReplacementSupplier.java} | 2 +- .../api/placeholder/IndividualPlaceholder.java | 2 +- ...ndividualPlaceholderReplacementSupplier.java} | 2 +- .../current/DefaultHolographicDisplaysAPI.java | 8 ++++---- .../plugin/api/v2/V2HologramsAPIProvider.java | 2 +- .../placeholder/DefaultPlaceholders.java | 16 ++++++++-------- .../registry/PlaceholderRegistry.java | 16 ++++++++-------- .../registry/SimpleGlobalPlaceholder.java | 10 +++++----- .../registry/SimpleIndividualPlaceholder.java | 10 +++++----- 11 files changed, 37 insertions(+), 37 deletions(-) rename api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/{GlobalPlaceholderReplacer.java => GlobalPlaceholderReplacementSupplier.java} (93%) rename api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/{IndividualPlaceholderReplacer.java => IndividualPlaceholderReplacementSupplier.java} (88%) diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/HolographicDisplaysAPI.java b/api/src/main/java/me/filoghost/holographicdisplays/api/HolographicDisplaysAPI.java index 16099d75..44b2ef1f 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/HolographicDisplaysAPI.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/HolographicDisplaysAPI.java @@ -7,7 +7,7 @@ package me.filoghost.holographicdisplays.api; import me.filoghost.holographicdisplays.api.hologram.Hologram; import me.filoghost.holographicdisplays.api.internal.HolographicDisplaysAPIProvider; -import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacer; +import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.placeholder.RegisteredPlaceholder; import org.bukkit.Location; import org.bukkit.plugin.Plugin; @@ -80,7 +80,7 @@ public interface HolographicDisplaysAPI { /** * @since 1 */ - void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacer replacer); + void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier); /** * @since 1 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 2241cc53..b2b803df 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 @@ -8,6 +8,6 @@ package me.filoghost.holographicdisplays.api.placeholder; /** * @since 1 */ -public interface GlobalPlaceholder extends GlobalPlaceholderReplacer, Placeholder { +public interface GlobalPlaceholder extends GlobalPlaceholderReplacementSupplier, Placeholder { } diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacer.java b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacementSupplier.java similarity index 93% rename from api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacer.java rename to api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacementSupplier.java index 2df4f702..eac76ea8 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacer.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/GlobalPlaceholderReplacementSupplier.java @@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable; * @since 1 */ @FunctionalInterface -public interface GlobalPlaceholderReplacer { +public interface GlobalPlaceholderReplacementSupplier { /** * Callback for providing a placeholder replacement, given the argument of the placeholder (if present). 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 e86971ef..e4ff511e 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 @@ -8,6 +8,6 @@ package me.filoghost.holographicdisplays.api.placeholder; /** * @since 1 */ -public interface IndividualPlaceholder extends IndividualPlaceholderReplacer, Placeholder { +public interface IndividualPlaceholder extends IndividualPlaceholderReplacementSupplier, Placeholder { } diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacer.java b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacementSupplier.java similarity index 88% rename from api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacer.java rename to api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacementSupplier.java index 55aedee3..0e684130 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacer.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/placeholder/IndividualPlaceholderReplacementSupplier.java @@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable; * @since 1 */ @FunctionalInterface -public interface IndividualPlaceholderReplacer { +public interface IndividualPlaceholderReplacementSupplier { /** * @since 1 diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/DefaultHolographicDisplaysAPI.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/DefaultHolographicDisplaysAPI.java index 3ad22578..4a5b8d87 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/DefaultHolographicDisplaysAPI.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/DefaultHolographicDisplaysAPI.java @@ -9,7 +9,7 @@ import me.filoghost.fcommons.Preconditions; import me.filoghost.holographicdisplays.api.HolographicDisplaysAPI; import me.filoghost.holographicdisplays.api.hologram.Hologram; import me.filoghost.holographicdisplays.api.Position; -import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacer; +import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.placeholder.RegisteredPlaceholder; import me.filoghost.holographicdisplays.plugin.hologram.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderRegistry; @@ -50,15 +50,15 @@ class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI { } @Override - public void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacer replacer) { + public void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier) { Preconditions.notEmpty(identifier, "identifier"); for (char c : identifier.toCharArray()) { Preconditions.checkArgument(isValidIdentifierCharacter(c), "identifier contains invalid character '" + c + "'"); } Preconditions.checkArgument(refreshIntervalTicks >= 0, "refreshIntervalTicks should be positive"); - Preconditions.notNull(replacer, "replacer"); + Preconditions.notNull(replacementSupplier, "replacementSupplier"); - placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, identifier, refreshIntervalTicks, replacer); + placeholderRegistry.registerGlobalPlaceholder(plugin, identifier, refreshIntervalTicks, replacementSupplier); } private boolean isValidIdentifierCharacter(char c) { diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/v2/V2HologramsAPIProvider.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/v2/V2HologramsAPIProvider.java index 08560733..816d0bdd 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/v2/V2HologramsAPIProvider.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/v2/V2HologramsAPIProvider.java @@ -68,7 +68,7 @@ public class V2HologramsAPIProvider extends HologramsAPIProvider { boolean alreadyRegistered = placeholderRegistry.isRegisteredIdentifier(plugin, textPlaceholder); if (!alreadyRegistered) { - placeholderRegistry.registerGlobalPlaceholderReplacer( + placeholderRegistry.registerGlobalPlaceholder( plugin, textPlaceholder, refreshIntervalTicks, diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/placeholder/DefaultPlaceholders.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/placeholder/DefaultPlaceholders.java index db68e8b6..69c1c0c0 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/placeholder/DefaultPlaceholders.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/internal/placeholder/DefaultPlaceholders.java @@ -30,7 +30,7 @@ public class DefaultPlaceholders { BungeeServerTracker bungeeServerTracker) { placeholderRegistry.unregisterAll(plugin); - placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, "empty", Integer.MAX_VALUE, (argument) -> { + placeholderRegistry.registerGlobalPlaceholder(plugin, "empty", Integer.MAX_VALUE, (argument) -> { return ""; }); @@ -43,7 +43,7 @@ public class DefaultPlaceholders { ChatColor.LIGHT_PURPLE ))); - placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, "time", 10, (argument) -> { + placeholderRegistry.registerGlobalPlaceholder(plugin, "time", 10, (argument) -> { return Settings.timeFormat.format(Instant.now()); }); @@ -53,7 +53,7 @@ public class DefaultPlaceholders { placeholderRegistry.registerGlobalPlaceholderFactory(plugin, "online", new OnlinePlayersPlaceholderFactory(bungeeServerTracker)); - placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, "max_players", 20, (serverName) -> { + placeholderRegistry.registerGlobalPlaceholder(plugin, "max_players", 20, (serverName) -> { if (serverName == null) { // No argument specified, return max players of this server return String.valueOf(Bukkit.getMaxPlayers()); @@ -66,7 +66,7 @@ public class DefaultPlaceholders { return String.valueOf(bungeeServerTracker.getCurrentServerInfo(serverName).getMaxPlayers()); }); - placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, "status", 20, (serverName) -> { + placeholderRegistry.registerGlobalPlaceholder(plugin, "status", 20, (serverName) -> { if (serverName == null) { return NO_SERVER_SPECIFIED_ERROR; } @@ -83,7 +83,7 @@ public class DefaultPlaceholders { } }); - placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, "motd", 20, (serverName) -> { + placeholderRegistry.registerGlobalPlaceholder(plugin, "motd", 20, (serverName) -> { if (serverName == null) { return NO_SERVER_SPECIFIED_ERROR; } @@ -95,7 +95,7 @@ public class DefaultPlaceholders { return bungeeServerTracker.getCurrentServerInfo(serverName).getMotdLine1(); }); - placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, "motd2", 20, (serverName) -> { + placeholderRegistry.registerGlobalPlaceholder(plugin, "motd2", 20, (serverName) -> { if (serverName == null) { return NO_SERVER_SPECIFIED_ERROR; } @@ -107,11 +107,11 @@ public class DefaultPlaceholders { return bungeeServerTracker.getCurrentServerInfo(serverName).getMotdLine2(); }); - placeholderRegistry.registerIndividualPlaceholderReplacer(plugin, "player", Integer.MAX_VALUE, (player, argument) -> { + placeholderRegistry.registerIndividualPlaceholder(plugin, "player", Integer.MAX_VALUE, (player, argument) -> { return player.getName(); }); - placeholderRegistry.registerIndividualPlaceholderReplacer(plugin, "displayName", 20, (player, argument) -> { + placeholderRegistry.registerIndividualPlaceholder(plugin, "displayName", 20, (player, argument) -> { return player.getDisplayName(); }); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java index 2d0d5505..559a57f3 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/PlaceholderRegistry.java @@ -10,10 +10,10 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Table; import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder; import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderFactory; -import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacer; +import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.placeholder.IndividualPlaceholder; import me.filoghost.holographicdisplays.api.placeholder.IndividualPlaceholderFactory; -import me.filoghost.holographicdisplays.api.placeholder.IndividualPlaceholderReplacer; +import me.filoghost.holographicdisplays.api.placeholder.IndividualPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.placeholder.RegisteredPlaceholder; import me.filoghost.holographicdisplays.plugin.placeholder.parsing.PlaceholderIdentifier; import me.filoghost.holographicdisplays.plugin.placeholder.parsing.PlaceholderOccurrence; @@ -39,9 +39,9 @@ public class PlaceholderRegistry { return version.get(); } - public void registerIndividualPlaceholderReplacer( - Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplacer placeholderReplacer) { - registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, placeholderReplacer)); + public void registerIndividualPlaceholder( + Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplacementSupplier replacementSupplier) { + registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, replacementSupplier)); } public void registerIndividualPlaceholder(Plugin plugin, String identifier, IndividualPlaceholder placeholder) { @@ -53,9 +53,9 @@ public class PlaceholderRegistry { registerExpansion(expansion); } - public void registerGlobalPlaceholderReplacer( - Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplacer placeholderReplacer) { - registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, placeholderReplacer)); + public void registerGlobalPlaceholder( + Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplacementSupplier replacementSupplier) { + registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, replacementSupplier)); } public void registerGlobalPlaceholder(Plugin plugin, String identifier, GlobalPlaceholder placeholder) { diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleGlobalPlaceholder.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleGlobalPlaceholder.java index 6e5a84cc..c476ba05 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleGlobalPlaceholder.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleGlobalPlaceholder.java @@ -6,16 +6,16 @@ package me.filoghost.holographicdisplays.plugin.placeholder.registry; import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder; -import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacer; +import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacementSupplier; class SimpleGlobalPlaceholder implements GlobalPlaceholder { private final int refreshIntervalTicks; - private final GlobalPlaceholderReplacer placeholderReplacer; + private final GlobalPlaceholderReplacementSupplier replacementSupplier; - SimpleGlobalPlaceholder(int refreshIntervalTicks, GlobalPlaceholderReplacer placeholderReplacer) { + SimpleGlobalPlaceholder(int refreshIntervalTicks, GlobalPlaceholderReplacementSupplier replacementSupplier) { this.refreshIntervalTicks = refreshIntervalTicks; - this.placeholderReplacer = placeholderReplacer; + this.replacementSupplier = replacementSupplier; } @Override @@ -25,7 +25,7 @@ class SimpleGlobalPlaceholder implements GlobalPlaceholder { @Override public String getReplacement(String argument) { - return placeholderReplacer.getReplacement(argument); + return replacementSupplier.getReplacement(argument); } } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleIndividualPlaceholder.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleIndividualPlaceholder.java index 1664a625..77c93e79 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleIndividualPlaceholder.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/placeholder/registry/SimpleIndividualPlaceholder.java @@ -6,7 +6,7 @@ package me.filoghost.holographicdisplays.plugin.placeholder.registry; import me.filoghost.holographicdisplays.api.placeholder.IndividualPlaceholder; -import me.filoghost.holographicdisplays.api.placeholder.IndividualPlaceholderReplacer; +import me.filoghost.holographicdisplays.api.placeholder.IndividualPlaceholderReplacementSupplier; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -14,11 +14,11 @@ import org.jetbrains.annotations.Nullable; class SimpleIndividualPlaceholder implements IndividualPlaceholder { private final int refreshIntervalTicks; - private final IndividualPlaceholderReplacer placeholderReplacer; + private final IndividualPlaceholderReplacementSupplier replacementSupplier; - SimpleIndividualPlaceholder(int refreshIntervalTicks, IndividualPlaceholderReplacer placeholderReplacer) { + SimpleIndividualPlaceholder(int refreshIntervalTicks, IndividualPlaceholderReplacementSupplier replacementSupplier) { this.refreshIntervalTicks = refreshIntervalTicks; - this.placeholderReplacer = placeholderReplacer; + this.replacementSupplier = replacementSupplier; } @Override @@ -28,7 +28,7 @@ class SimpleIndividualPlaceholder implements IndividualPlaceholder { @Override public String getReplacement(@NotNull Player player, @Nullable String argument) { - return placeholderReplacer.getReplacement(player, argument); + return replacementSupplier.getReplacement(player, argument); } }