diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/beta/HolographicDisplaysAPI.java b/api/src/main/java/me/filoghost/holographicdisplays/api/beta/HolographicDisplaysAPI.java index 5237dedd..2a8d42ff 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/beta/HolographicDisplaysAPI.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/beta/HolographicDisplaysAPI.java @@ -85,32 +85,32 @@ public interface HolographicDisplaysAPI { /** * @since 1 */ - void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier); + RegisteredPlaceholder registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier); /** * @since 1 */ - void registerGlobalPlaceholder(@NotNull String identifier, @NotNull GlobalPlaceholder placeholder); + RegisteredPlaceholder registerGlobalPlaceholder(@NotNull String identifier, @NotNull GlobalPlaceholder placeholder); /** * @since 1 */ - void registerGlobalPlaceholderFactory(@NotNull String identifier, @NotNull GlobalPlaceholderFactory placeholderFactory); + RegisteredPlaceholder registerGlobalPlaceholderFactory(@NotNull String identifier, @NotNull GlobalPlaceholderFactory placeholderFactory); /** * @since 1 */ - void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplacementSupplier replacementSupplier); + RegisteredPlaceholder registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplacementSupplier replacementSupplier); /** * @since 1 */ - void registerIndividualPlaceholder(@NotNull String identifier, @NotNull IndividualPlaceholder placeholder); + RegisteredPlaceholder registerIndividualPlaceholder(@NotNull String identifier, @NotNull IndividualPlaceholder placeholder); /** * @since 1 */ - void registerIndividualPlaceholderFactory(@NotNull String identifier, @NotNull IndividualPlaceholderFactory placeholderFactory); + RegisteredPlaceholder registerIndividualPlaceholderFactory(@NotNull String identifier, @NotNull IndividualPlaceholderFactory placeholderFactory); /** * @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 49e7d99d..4176b1b8 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 @@ -55,53 +55,53 @@ class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI { } @Override - public void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier) { + public RegisteredPlaceholder registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier) { checkIdentifier(identifier); Preconditions.checkArgument(refreshIntervalTicks >= 0, "refreshIntervalTicks should be positive"); Preconditions.notNull(replacementSupplier, "replacementSupplier"); - placeholderRegistry.registerGlobalPlaceholder(plugin, identifier, refreshIntervalTicks, replacementSupplier); + return placeholderRegistry.registerGlobalPlaceholder(plugin, identifier, refreshIntervalTicks, replacementSupplier); } @Override - public void registerGlobalPlaceholder(@NotNull String identifier, @NotNull GlobalPlaceholder placeholder) { + public RegisteredPlaceholder registerGlobalPlaceholder(@NotNull String identifier, @NotNull GlobalPlaceholder placeholder) { checkIdentifier(identifier); Preconditions.notNull(placeholder, "placeholder"); - placeholderRegistry.registerGlobalPlaceholder(plugin, identifier, placeholder); + return placeholderRegistry.registerGlobalPlaceholder(plugin, identifier, placeholder); } @Override - public void registerGlobalPlaceholderFactory(@NotNull String identifier, @NotNull GlobalPlaceholderFactory placeholderFactory) { + public RegisteredPlaceholder registerGlobalPlaceholderFactory(@NotNull String identifier, @NotNull GlobalPlaceholderFactory placeholderFactory) { checkIdentifier(identifier); Preconditions.notNull(placeholderFactory, "placeholderFactory"); - placeholderRegistry.registerGlobalPlaceholderFactory(plugin, identifier, placeholderFactory); + return placeholderRegistry.registerGlobalPlaceholderFactory(plugin, identifier, placeholderFactory); } @Override - public void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplacementSupplier replacementSupplier) { + public RegisteredPlaceholder registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplacementSupplier replacementSupplier) { checkIdentifier(identifier); Preconditions.checkArgument(refreshIntervalTicks >= 0, "refreshIntervalTicks should be positive"); Preconditions.notNull(replacementSupplier, "replacementSupplier"); - placeholderRegistry.registerIndividualPlaceholder(plugin, identifier, refreshIntervalTicks, replacementSupplier); + return placeholderRegistry.registerIndividualPlaceholder(plugin, identifier, refreshIntervalTicks, replacementSupplier); } @Override - public void registerIndividualPlaceholder(@NotNull String identifier, @NotNull IndividualPlaceholder placeholder) { + public RegisteredPlaceholder registerIndividualPlaceholder(@NotNull String identifier, @NotNull IndividualPlaceholder placeholder) { checkIdentifier(identifier); Preconditions.notNull(placeholder, "placeholder"); - placeholderRegistry.registerIndividualPlaceholder(plugin, identifier, placeholder); + return placeholderRegistry.registerIndividualPlaceholder(plugin, identifier, placeholder); } @Override - public void registerIndividualPlaceholderFactory(@NotNull String identifier, @NotNull IndividualPlaceholderFactory placeholderFactory) { + public RegisteredPlaceholder registerIndividualPlaceholderFactory(@NotNull String identifier, @NotNull IndividualPlaceholderFactory placeholderFactory) { checkIdentifier(identifier); Preconditions.notNull(placeholderFactory, "placeholderFactory"); - placeholderRegistry.registerIndividualPlaceholderFactory(plugin, identifier, placeholderFactory); + return placeholderRegistry.registerIndividualPlaceholderFactory(plugin, identifier, placeholderFactory); } private void checkIdentifier(String identifier) { 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 f06539d3..6489a171 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 @@ -44,32 +44,34 @@ public class PlaceholderRegistry { return version.get(); } - public void registerIndividualPlaceholder( + public PlaceholderExpansion registerIndividualPlaceholder( Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplacementSupplier replacementSupplier) { - registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, replacementSupplier)); + return registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, replacementSupplier)); } - public void registerIndividualPlaceholder(Plugin plugin, String identifier, IndividualPlaceholder placeholder) { - registerIndividualPlaceholderFactory(plugin, identifier, (String argument) -> placeholder); + public PlaceholderExpansion registerIndividualPlaceholder(Plugin plugin, String identifier, IndividualPlaceholder placeholder) { + return registerIndividualPlaceholderFactory(plugin, identifier, (String argument) -> placeholder); } - public void registerIndividualPlaceholderFactory(Plugin plugin, String identifier, IndividualPlaceholderFactory factory) { + public PlaceholderExpansion registerIndividualPlaceholderFactory(Plugin plugin, String identifier, IndividualPlaceholderFactory factory) { PlaceholderExpansion expansion = new IndividualPlaceholderExpansion(plugin, identifier, factory); registerExpansion(expansion); + return expansion; } - public void registerGlobalPlaceholder( + public PlaceholderExpansion registerGlobalPlaceholder( Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplacementSupplier replacementSupplier) { - registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, replacementSupplier)); + return registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, replacementSupplier)); } - public void registerGlobalPlaceholder(Plugin plugin, String identifier, GlobalPlaceholder placeholder) { - registerGlobalPlaceholderFactory(plugin, identifier, (String argument) -> placeholder); + public PlaceholderExpansion registerGlobalPlaceholder(Plugin plugin, String identifier, GlobalPlaceholder placeholder) { + return registerGlobalPlaceholderFactory(plugin, identifier, (String argument) -> placeholder); } - public void registerGlobalPlaceholderFactory(Plugin plugin, String identifier, GlobalPlaceholderFactory factory) { + public PlaceholderExpansion registerGlobalPlaceholderFactory(Plugin plugin, String identifier, GlobalPlaceholderFactory factory) { PlaceholderExpansion expansion = new GlobalPlaceholderExpansion(plugin, identifier, factory); registerExpansion(expansion); + return expansion; } private void registerExpansion(PlaceholderExpansion expansion) {