Rename API classes

This commit is contained in:
filoghost 2021-08-31 21:05:38 +02:00
parent 9ff7b0d7b6
commit 7db51a6dae
13 changed files with 50 additions and 50 deletions

View File

@ -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.PlaceholderReplacer;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacer;
import org.bukkit.Location;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@ -79,7 +79,7 @@ public interface HolographicDisplaysAPI {
/**
* @since 1
*/
void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull PlaceholderReplacer replacer);
void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacer replacer);
/**
* @since 1

View File

@ -8,7 +8,7 @@ package me.filoghost.holographicdisplays.api.placeholder;
/**
* @since 1
*/
public interface Placeholder extends PlaceholderReplacer {
public interface GlobalPlaceholder extends GlobalPlaceholderReplacer {
/**
* @since 1

View File

@ -10,11 +10,11 @@ import org.jetbrains.annotations.Nullable;
/**
* @since 1
*/
public interface PlaceholderFactory {
public interface GlobalPlaceholderFactory {
/**
* @since 1
*/
@Nullable Placeholder getPlaceholder(@Nullable String argument);
@Nullable GlobalPlaceholder getPlaceholder(@Nullable String argument);
}

View File

@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
* @since 1
*/
@FunctionalInterface
public interface PlaceholderReplacer {
public interface GlobalPlaceholderReplacer {
/**
* Callback for providing a placeholder replacement, given the argument of the placeholder (if present).

View File

@ -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.PlaceholderReplacer;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacer;
import me.filoghost.holographicdisplays.plugin.hologram.base.ImmutablePosition;
import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderRegistry;
import org.bukkit.Location;
@ -49,7 +49,7 @@ class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI {
}
@Override
public void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull PlaceholderReplacer replacer) {
public void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplacer replacer) {
Preconditions.notEmpty(identifier, "identifier");
for (char c : identifier.toCharArray()) {
Preconditions.checkArgument(isValidIdentifierCharacter(c), "identifier contains invalid character '" + c + "'");

View File

@ -7,11 +7,11 @@ package me.filoghost.holographicdisplays.plugin.internal.placeholder;
import com.google.common.collect.ImmutableList;
import me.filoghost.fcommons.Preconditions;
import me.filoghost.holographicdisplays.api.placeholder.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder;
import java.util.List;
public class AnimationPlaceholder implements Placeholder {
public class AnimationPlaceholder implements GlobalPlaceholder {
private final int refreshIntervalTicks;
private final ImmutableList<String> frames;

View File

@ -7,14 +7,14 @@ package me.filoghost.holographicdisplays.plugin.internal.placeholder;
import me.filoghost.fcommons.collection.CaseInsensitiveHashMap;
import me.filoghost.fcommons.collection.CaseInsensitiveMap;
import me.filoghost.holographicdisplays.api.placeholder.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.PlaceholderFactory;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderFactory;
import java.util.Map;
public class AnimationPlaceholderFactory implements PlaceholderFactory {
public class AnimationPlaceholderFactory implements GlobalPlaceholderFactory {
private final CaseInsensitiveMap<Placeholder> animationsByFileName;
private final CaseInsensitiveMap<GlobalPlaceholder> animationsByFileName;
public AnimationPlaceholderFactory(Map<String, AnimationPlaceholder> animationsByFileName) {
this.animationsByFileName = new CaseInsensitiveHashMap<>();
@ -22,12 +22,12 @@ public class AnimationPlaceholderFactory implements PlaceholderFactory {
}
@Override
public Placeholder getPlaceholder(String fileNameArgument) {
Placeholder placeholder = animationsByFileName.get(fileNameArgument);
public GlobalPlaceholder getPlaceholder(String fileNameArgument) {
GlobalPlaceholder placeholder = animationsByFileName.get(fileNameArgument);
if (placeholder != null) {
return placeholder;
} else {
return new StaticPlaceholder("[Animation not found: " + fileNameArgument + "]");
return new ImmutablePlaceholder("[Animation not found: " + fileNameArgument + "]");
}
}

View File

@ -5,13 +5,13 @@
*/
package me.filoghost.holographicdisplays.plugin.internal.placeholder;
import me.filoghost.holographicdisplays.api.placeholder.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder;
public class StaticPlaceholder implements Placeholder {
public class ImmutablePlaceholder implements GlobalPlaceholder {
private final String text;
public StaticPlaceholder(String text) {
public ImmutablePlaceholder(String text) {
this.text = text;
}

View File

@ -6,13 +6,13 @@
package me.filoghost.holographicdisplays.plugin.internal.placeholder;
import me.filoghost.fcommons.Strings;
import me.filoghost.holographicdisplays.api.placeholder.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.PlaceholderFactory;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderFactory;
import me.filoghost.holographicdisplays.plugin.bridge.bungeecord.BungeeServerTracker;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.Nullable;
public class OnlinePlayersPlaceholderFactory implements PlaceholderFactory {
public class OnlinePlayersPlaceholderFactory implements GlobalPlaceholderFactory {
private final BungeeServerTracker bungeeServerTracker;
@ -21,7 +21,7 @@ public class OnlinePlayersPlaceholderFactory implements PlaceholderFactory {
}
@Override
public Placeholder getPlaceholder(@Nullable String argument) {
public GlobalPlaceholder getPlaceholder(@Nullable String argument) {
if (argument == null) {
// No argument specified, return online players in this server
return new LocalOnlinePlayersPlaceholder();
@ -32,7 +32,7 @@ public class OnlinePlayersPlaceholderFactory implements PlaceholderFactory {
}
private static class LocalOnlinePlayersPlaceholder implements Placeholder {
private static class LocalOnlinePlayersPlaceholder implements GlobalPlaceholder {
@Override
public int getRefreshIntervalTicks() {
@ -47,7 +47,7 @@ public class OnlinePlayersPlaceholderFactory implements PlaceholderFactory {
}
private static class BungeeOnlinePlayersPlaceholder implements Placeholder {
private static class BungeeOnlinePlayersPlaceholder implements GlobalPlaceholder {
private final String[] serverNames;
private final BungeeServerTracker bungeeServerTracker;

View File

@ -6,19 +6,19 @@
package me.filoghost.holographicdisplays.plugin.internal.placeholder;
import me.filoghost.fcommons.Strings;
import me.filoghost.holographicdisplays.api.placeholder.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.PlaceholderFactory;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderFactory;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
public class WorldPlayersPlaceholderFactory implements PlaceholderFactory {
public class WorldPlayersPlaceholderFactory implements GlobalPlaceholderFactory {
@Override
public Placeholder getPlaceholder(@Nullable String argument) {
public GlobalPlaceholder getPlaceholder(@Nullable String argument) {
if (argument == null) {
return new StaticPlaceholder("[No world specified]");
return new ImmutablePlaceholder("[No world specified]");
}
String[] worldNames = Strings.splitAndTrim(argument, ",");
@ -26,7 +26,7 @@ public class WorldPlayersPlaceholderFactory implements PlaceholderFactory {
}
private static class WorldPlayersPlaceholder implements Placeholder {
private static class WorldPlayersPlaceholder implements GlobalPlaceholder {
private final String[] worldNames;

View File

@ -5,8 +5,8 @@
*/
package me.filoghost.holographicdisplays.plugin.placeholder.registry;
import me.filoghost.holographicdisplays.api.placeholder.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.PlaceholderFactory;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderFactory;
import me.filoghost.holographicdisplays.plugin.placeholder.PlaceholderException;
import me.filoghost.holographicdisplays.plugin.placeholder.StandardPlaceholder;
import org.bukkit.entity.Player;
@ -16,9 +16,9 @@ import org.jetbrains.annotations.Nullable;
class GlobalPlaceholderExpansion extends PlaceholderExpansion {
private final PlaceholderFactory placeholderFactory;
private final GlobalPlaceholderFactory placeholderFactory;
GlobalPlaceholderExpansion(Plugin plugin, String identifier, PlaceholderFactory placeholderFactory) {
GlobalPlaceholderExpansion(Plugin plugin, String identifier, GlobalPlaceholderFactory placeholderFactory) {
super(plugin, identifier);
this.placeholderFactory = placeholderFactory;
}
@ -30,7 +30,7 @@ class GlobalPlaceholderExpansion extends PlaceholderExpansion {
@Override
public @Nullable StandardPlaceholder createPlaceholder(String argument) throws PlaceholderException {
Placeholder placeholder;
GlobalPlaceholder placeholder;
try {
placeholder = placeholderFactory.getPlaceholder(argument);
} catch (Throwable t) {
@ -47,9 +47,9 @@ class GlobalPlaceholderExpansion extends PlaceholderExpansion {
private static class GlobalStandardPlaceholder extends StandardPlaceholder {
private final @NotNull Placeholder placeholder;
private final @NotNull GlobalPlaceholder placeholder;
GlobalStandardPlaceholder(@NotNull Placeholder placeholder, @NotNull GlobalPlaceholderExpansion source) {
GlobalStandardPlaceholder(@NotNull GlobalPlaceholder placeholder, @NotNull GlobalPlaceholderExpansion source) {
super(source);
this.placeholder = placeholder;
}

View File

@ -11,9 +11,9 @@ import com.google.common.collect.Table;
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.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.PlaceholderFactory;
import me.filoghost.holographicdisplays.api.placeholder.PlaceholderReplacer;
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.plugin.placeholder.parsing.PlaceholderIdentifier;
import me.filoghost.holographicdisplays.plugin.placeholder.parsing.PlaceholderOccurrence;
import me.filoghost.holographicdisplays.plugin.placeholder.parsing.PluginName;
@ -51,15 +51,15 @@ public class PlaceholderRegistry {
}
public void registerGlobalPlaceholderReplacer(
Plugin plugin, String identifier, int refreshIntervalTicks, PlaceholderReplacer placeholderReplacer) {
Plugin plugin, String identifier, int refreshIntervalTicks, GlobalPlaceholderReplacer placeholderReplacer) {
registerGlobalPlaceholder(plugin, identifier, new SimpleGlobalPlaceholder(refreshIntervalTicks, placeholderReplacer));
}
public void registerGlobalPlaceholder(Plugin plugin, String identifier, Placeholder placeholder) {
public void registerGlobalPlaceholder(Plugin plugin, String identifier, GlobalPlaceholder placeholder) {
registerGlobalPlaceholderFactory(plugin, identifier, (String argument) -> placeholder);
}
public void registerGlobalPlaceholderFactory(Plugin plugin, String identifier, PlaceholderFactory factory) {
public void registerGlobalPlaceholderFactory(Plugin plugin, String identifier, GlobalPlaceholderFactory factory) {
PlaceholderExpansion expansion = new GlobalPlaceholderExpansion(plugin, identifier, factory);
registerExpansion(expansion);
}

View File

@ -5,15 +5,15 @@
*/
package me.filoghost.holographicdisplays.plugin.placeholder.registry;
import me.filoghost.holographicdisplays.api.placeholder.Placeholder;
import me.filoghost.holographicdisplays.api.placeholder.PlaceholderReplacer;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholder;
import me.filoghost.holographicdisplays.api.placeholder.GlobalPlaceholderReplacer;
class SimpleGlobalPlaceholder implements Placeholder {
class SimpleGlobalPlaceholder implements GlobalPlaceholder {
private final int refreshIntervalTicks;
private final PlaceholderReplacer placeholderReplacer;
private final GlobalPlaceholderReplacer placeholderReplacer;
SimpleGlobalPlaceholder(int refreshIntervalTicks, PlaceholderReplacer placeholderReplacer) {
SimpleGlobalPlaceholder(int refreshIntervalTicks, GlobalPlaceholderReplacer placeholderReplacer) {
this.refreshIntervalTicks = refreshIntervalTicks;
this.placeholderReplacer = placeholderReplacer;
}