Add option to configure the PAPIProxyBridge cache time

This commit is contained in:
William 2023-06-12 13:16:12 +01:00
parent 07fd9c306a
commit a55eda8e52
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -89,8 +89,14 @@ public class Settings {
@Getter
@YamlKey("enable_papi_hook")
@YamlComment("Whether to enable the PAPIProxyBridge hook for PAPI support")
private boolean enablePapiHook = true;
@Getter
@YamlKey("papi_cache_time")
@YamlComment("How long in seconds to cache PAPI placeholders for. (0 to disable)")
private int papiCacheTime = 30;
@Getter
@YamlKey("enable_miniplaceholders_hook")
@YamlComment("If you are using MINIMESSAGE formatting, enable this to support MiniPlaceholders in formatting.")

View File

@ -33,6 +33,7 @@ public class PAPIProxyBridgeHook extends Hook {
public PAPIProxyBridgeHook(@NotNull Velocitab plugin) {
super(plugin);
this.api = PlaceholderAPI.getInstance();
this.api.setCacheExpiry(plugin.getSettings().getPapiCacheTime());
}
public CompletableFuture<String> formatPlaceholders(@NotNull String input, @NotNull Player player) {