API renaming

This commit is contained in:
filoghost 2022-04-24 12:41:37 +02:00
parent 0cd4ac8f3e
commit da25d050ab
7 changed files with 32 additions and 32 deletions

View File

@ -9,10 +9,10 @@ import me.filoghost.holographicdisplays.api.beta.hologram.Hologram;
import me.filoghost.holographicdisplays.api.beta.internal.HolographicDisplaysAPIProvider; import me.filoghost.holographicdisplays.api.beta.internal.HolographicDisplaysAPIProvider;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderFactory; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderFactory;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplaceFunction;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderFactory; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderFactory;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplaceFunction;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -84,7 +84,7 @@ public interface HolographicDisplaysAPI {
/** /**
* @since 1 * @since 1
*/ */
void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier); void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplaceFunction replaceFunction);
/** /**
* @since 1 * @since 1
@ -99,7 +99,7 @@ public interface HolographicDisplaysAPI {
/** /**
* @since 1 * @since 1
*/ */
void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplacementSupplier replacementSupplier); void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplaceFunction replaceFunction);
/** /**
* @since 1 * @since 1

View File

@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
* @since 1 * @since 1
*/ */
@FunctionalInterface @FunctionalInterface
public interface GlobalPlaceholderReplacementSupplier { public interface GlobalPlaceholderReplaceFunction {
/** /**
* @see GlobalPlaceholder#getReplacement(String) * @see GlobalPlaceholder#getReplacement(String)

View File

@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
* @since 1 * @since 1
*/ */
@FunctionalInterface @FunctionalInterface
public interface IndividualPlaceholderReplacementSupplier { public interface IndividualPlaceholderReplaceFunction {
/** /**
* @see IndividualPlaceholder#getReplacement(Player, String) * @see IndividualPlaceholder#getReplacement(Player, String)

View File

@ -11,10 +11,10 @@ import me.filoghost.holographicdisplays.api.beta.Position;
import me.filoghost.holographicdisplays.api.beta.hologram.Hologram; import me.filoghost.holographicdisplays.api.beta.hologram.Hologram;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderFactory; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderFactory;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplaceFunction;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderFactory; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderFactory;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplaceFunction;
import me.filoghost.holographicdisplays.plugin.hologram.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.hologram.base.ImmutablePosition;
import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderRegistry; import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderRegistry;
import org.bukkit.Location; import org.bukkit.Location;
@ -54,12 +54,12 @@ class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI {
} }
@Override @Override
public void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier) { public void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplaceFunction replaceFunction) {
checkIdentifier(identifier); checkIdentifier(identifier);
Preconditions.checkArgument(refreshIntervalTicks >= 0, "refreshIntervalTicks should be positive"); Preconditions.checkArgument(refreshIntervalTicks >= 0, "refreshIntervalTicks should be positive");
Preconditions.notNull(replacementSupplier, "replacementSupplier"); Preconditions.notNull(replaceFunction, "replaceFunction");
placeholderRegistry.registerGlobalPlaceholder(plugin, identifier, refreshIntervalTicks, replacementSupplier); placeholderRegistry.registerGlobalPlaceholder(plugin, identifier, refreshIntervalTicks, replaceFunction);
} }
@Override @Override
@ -79,12 +79,12 @@ class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI {
} }
@Override @Override
public void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplacementSupplier replacementSupplier) { public void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplaceFunction replaceFunction) {
checkIdentifier(identifier); checkIdentifier(identifier);
Preconditions.checkArgument(refreshIntervalTicks >= 0, "refreshIntervalTicks should be positive"); Preconditions.checkArgument(refreshIntervalTicks >= 0, "refreshIntervalTicks should be positive");
Preconditions.notNull(replacementSupplier, "replacementSupplier"); Preconditions.notNull(replaceFunction, "replaceFunction");
placeholderRegistry.registerIndividualPlaceholder(plugin, identifier, refreshIntervalTicks, replacementSupplier); placeholderRegistry.registerIndividualPlaceholder(plugin, identifier, refreshIntervalTicks, replaceFunction);
} }
@Override @Override

View File

@ -13,10 +13,10 @@ import me.filoghost.fcommons.collection.CollectionUtils;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderFactory; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderFactory;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplaceFunction;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderFactory; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderFactory;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplaceFunction;
import me.filoghost.holographicdisplays.plugin.placeholder.PlaceholderIdentifier; import me.filoghost.holographicdisplays.plugin.placeholder.PlaceholderIdentifier;
import me.filoghost.holographicdisplays.plugin.placeholder.PlaceholderOccurrence; import me.filoghost.holographicdisplays.plugin.placeholder.PlaceholderOccurrence;
import me.filoghost.holographicdisplays.plugin.placeholder.PluginName; import me.filoghost.holographicdisplays.plugin.placeholder.PluginName;
@ -43,8 +43,8 @@ public class PlaceholderRegistry {
} }
public void registerIndividualPlaceholder( public void registerIndividualPlaceholder(
Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplacementSupplier replacementSupplier) { Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplaceFunction replaceFunction) {
registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, replacementSupplier)); registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, replaceFunction));
} }
public void registerIndividualPlaceholder(Plugin plugin, String identifier, IndividualPlaceholder placeholder) { public void registerIndividualPlaceholder(Plugin plugin, String identifier, IndividualPlaceholder placeholder) {
@ -57,8 +57,8 @@ public class PlaceholderRegistry {
} }
public void registerGlobalPlaceholder( public void registerGlobalPlaceholder(
Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplacementSupplier replacementSupplier) { Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplaceFunction replaceFunction) {
registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, replacementSupplier)); registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, replaceFunction));
} }
public void registerGlobalPlaceholder(Plugin plugin, String identifier, GlobalPlaceholder placeholder) { public void registerGlobalPlaceholder(Plugin plugin, String identifier, GlobalPlaceholder placeholder) {
@ -122,14 +122,14 @@ public class PlaceholderRegistry {
Plugin plugin, Plugin plugin,
String textPlaceholder, String textPlaceholder,
int refreshIntervalTicks, int refreshIntervalTicks,
GlobalPlaceholderReplacementSupplier replacementSupplier) { GlobalPlaceholderReplaceFunction replaceFunction) {
String identifier = convertToNewFormat(textPlaceholder); String identifier = convertToNewFormat(textPlaceholder);
if (!identifier.equals(textPlaceholder)) { if (!identifier.equals(textPlaceholder)) {
Log.warning("The plugin " + plugin.getName() + " registered the placeholder " + textPlaceholder Log.warning("The plugin " + plugin.getName() + " registered the placeholder " + textPlaceholder
+ " with the old v2 API, but it doesn't comply with the new format. In order to display it," + " with the old v2 API, but it doesn't comply with the new format. In order to display it,"
+ " you must use {" + textPlaceholder + "} instead."); + " you must use {" + textPlaceholder + "} instead.");
} }
GlobalPlaceholder placeholder = new SimpleGlobalPlaceholder(refreshIntervalTicks, replacementSupplier); GlobalPlaceholder placeholder = new SimpleGlobalPlaceholder(refreshIntervalTicks, replaceFunction);
GlobalPlaceholderFactory placeholderFactory = (String argument) -> placeholder; GlobalPlaceholderFactory placeholderFactory = (String argument) -> placeholder;
LegacyGlobalPlaceholderExpansion expansion = new LegacyGlobalPlaceholderExpansion( LegacyGlobalPlaceholderExpansion expansion = new LegacyGlobalPlaceholderExpansion(
plugin, plugin,

View File

@ -6,16 +6,16 @@
package me.filoghost.holographicdisplays.plugin.placeholder.registry; package me.filoghost.holographicdisplays.plugin.placeholder.registry;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholderReplaceFunction;
class SimpleGlobalPlaceholder implements GlobalPlaceholder { class SimpleGlobalPlaceholder implements GlobalPlaceholder {
private final int refreshIntervalTicks; private final int refreshIntervalTicks;
private final GlobalPlaceholderReplacementSupplier replacementSupplier; private final GlobalPlaceholderReplaceFunction replaceFunction;
SimpleGlobalPlaceholder(int refreshIntervalTicks, GlobalPlaceholderReplacementSupplier replacementSupplier) { SimpleGlobalPlaceholder(int refreshIntervalTicks, GlobalPlaceholderReplaceFunction replaceFunction) {
this.refreshIntervalTicks = refreshIntervalTicks; this.refreshIntervalTicks = refreshIntervalTicks;
this.replacementSupplier = replacementSupplier; this.replaceFunction = replaceFunction;
} }
@Override @Override
@ -25,7 +25,7 @@ class SimpleGlobalPlaceholder implements GlobalPlaceholder {
@Override @Override
public String getReplacement(String argument) { public String getReplacement(String argument) {
return replacementSupplier.getReplacement(argument); return replaceFunction.getReplacement(argument);
} }
} }

View File

@ -6,7 +6,7 @@
package me.filoghost.holographicdisplays.plugin.placeholder.registry; package me.filoghost.holographicdisplays.plugin.placeholder.registry;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholder;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplacementSupplier; import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplaceFunction;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -14,11 +14,11 @@ import org.jetbrains.annotations.Nullable;
class SimpleIndividualPlaceholder implements IndividualPlaceholder { class SimpleIndividualPlaceholder implements IndividualPlaceholder {
private final int refreshIntervalTicks; private final int refreshIntervalTicks;
private final IndividualPlaceholderReplacementSupplier replacementSupplier; private final IndividualPlaceholderReplaceFunction replaceFunction;
SimpleIndividualPlaceholder(int refreshIntervalTicks, IndividualPlaceholderReplacementSupplier replacementSupplier) { SimpleIndividualPlaceholder(int refreshIntervalTicks, IndividualPlaceholderReplaceFunction replaceFunction) {
this.refreshIntervalTicks = refreshIntervalTicks; this.refreshIntervalTicks = refreshIntervalTicks;
this.replacementSupplier = replacementSupplier; this.replaceFunction = replaceFunction;
} }
@Override @Override
@ -28,7 +28,7 @@ class SimpleIndividualPlaceholder implements IndividualPlaceholder {
@Override @Override
public String getReplacement(@NotNull Player player, @Nullable String argument) { public String getReplacement(@NotNull Player player, @Nullable String argument) {
return replacementSupplier.getReplacement(player, argument); return replaceFunction.getReplacement(player, argument);
} }
} }