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.placeholder.GlobalPlaceholder;
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.IndividualPlaceholderFactory;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplacementSupplier;
import me.filoghost.holographicdisplays.api.beta.placeholder.IndividualPlaceholderReplaceFunction;
import org.bukkit.Location;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@ -84,7 +84,7 @@ public interface HolographicDisplaysAPI {
/**
* @since 1
*/
void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacementSupplier replacementSupplier);
void registerGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplaceFunction replaceFunction);
/**
* @since 1
@ -99,7 +99,7 @@ public interface HolographicDisplaysAPI {
/**
* @since 1
*/
void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplacementSupplier replacementSupplier);
void registerIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplaceFunction replaceFunction);
/**
* @since 1

View File

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

View File

@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
* @since 1
*/
@FunctionalInterface
public interface IndividualPlaceholderReplacementSupplier {
public interface IndividualPlaceholderReplaceFunction {
/**
* @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.placeholder.GlobalPlaceholder;
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.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.placeholder.registry.PlaceholderRegistry;
import org.bukkit.Location;
@ -54,12 +54,12 @@ class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI {
}
@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);
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
@ -79,12 +79,12 @@ class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI {
}
@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);
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

View File

@ -13,10 +13,10 @@ import me.filoghost.fcommons.collection.CollectionUtils;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.holographicdisplays.api.beta.placeholder.GlobalPlaceholder;
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.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.PlaceholderOccurrence;
import me.filoghost.holographicdisplays.plugin.placeholder.PluginName;
@ -43,8 +43,8 @@ public class PlaceholderRegistry {
}
public void registerIndividualPlaceholder(
Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplacementSupplier replacementSupplier) {
registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, replacementSupplier));
Plugin plugin, String identifier, int refreshIntervalTicks, IndividualPlaceholderReplaceFunction replaceFunction) {
registerIndividualPlaceholder(plugin, identifier, new SimpleIndividualPlaceholder(refreshIntervalTicks, replaceFunction));
}
public void registerIndividualPlaceholder(Plugin plugin, String identifier, IndividualPlaceholder placeholder) {
@ -57,8 +57,8 @@ public class PlaceholderRegistry {
}
public void registerGlobalPlaceholder(
Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplacementSupplier replacementSupplier) {
registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, replacementSupplier));
Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplaceFunction replaceFunction) {
registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, replaceFunction));
}
public void registerGlobalPlaceholder(Plugin plugin, String identifier, GlobalPlaceholder placeholder) {
@ -122,14 +122,14 @@ public class PlaceholderRegistry {
Plugin plugin,
String textPlaceholder,
int refreshIntervalTicks,
GlobalPlaceholderReplacementSupplier replacementSupplier) {
GlobalPlaceholderReplaceFunction replaceFunction) {
String identifier = convertToNewFormat(textPlaceholder);
if (!identifier.equals(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,"
+ " you must use {" + textPlaceholder + "} instead.");
}
GlobalPlaceholder placeholder = new SimpleGlobalPlaceholder(refreshIntervalTicks, replacementSupplier);
GlobalPlaceholder placeholder = new SimpleGlobalPlaceholder(refreshIntervalTicks, replaceFunction);
GlobalPlaceholderFactory placeholderFactory = (String argument) -> placeholder;
LegacyGlobalPlaceholderExpansion expansion = new LegacyGlobalPlaceholderExpansion(
plugin,

View File

@ -6,16 +6,16 @@
package me.filoghost.holographicdisplays.plugin.placeholder.registry;
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 {
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.replacementSupplier = replacementSupplier;
this.replaceFunction = replaceFunction;
}
@Override
@ -25,7 +25,7 @@ class SimpleGlobalPlaceholder implements GlobalPlaceholder {
@Override
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;
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.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 IndividualPlaceholderReplacementSupplier replacementSupplier;
private final IndividualPlaceholderReplaceFunction replaceFunction;
SimpleIndividualPlaceholder(int refreshIntervalTicks, IndividualPlaceholderReplacementSupplier replacementSupplier) {
SimpleIndividualPlaceholder(int refreshIntervalTicks, IndividualPlaceholderReplaceFunction replaceFunction) {
this.refreshIntervalTicks = refreshIntervalTicks;
this.replacementSupplier = replacementSupplier;
this.replaceFunction = replaceFunction;
}
@Override
@ -28,7 +28,7 @@ class SimpleIndividualPlaceholder implements IndividualPlaceholder {
@Override
public String getReplacement(@NotNull Player player, @Nullable String argument) {
return replacementSupplier.getReplacement(player, argument);
return replaceFunction.getReplacement(player, argument);
}
}