mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-23 10:55:10 +01:00
Return registered placeholder in API
This commit is contained in:
parent
045f363adb
commit
fda3f4b933
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user