use of com.creeperface.nukkit.placeholderapi.api.PlaceholderAPI in project Plan by plan-player-analytics.
the class NukkitPlaceholderRegistrar method register.
public void register() {
PlaceholderAPI api = PlaceholderAPI.getInstance();
placeholders.getPlaceholders().forEach((name, loader) -> api.builder(name, Serializable.class).visitorLoader(options -> {
try {
return loader.apply(getPlayer(options.getPlayer()), getPlaceholderParameterValues(options.getParameters()));
} catch (Exception e) {
errorLogger.warn(e, ErrorContext.builder().related("Registering PlaceholderAPI").build());
return null;
}
}).build());
placeholders.getStaticPlaceholders().forEach((name, loader) -> api.builder(name, Serializable.class).loader(options -> {
try {
return loader.apply(new Arguments(getPlaceholderParameterValues(options.getParameters())));
} catch (Exception e) {
errorLogger.warn(e, ErrorContext.builder().related("Registering PlaceholderAPI").build());
return null;
}
}).build());
}
Aggregations