Add a bit more validation to the PAPI cache time option

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

View File

@ -94,7 +94,7 @@ public class Settings {
@Getter
@YamlKey("papi_cache_time")
@YamlComment("How long in seconds to cache PAPI placeholders for. (0 to disable)")
@YamlComment("How long in seconds to cache PAPI placeholders for, in seconds. (0 to disable)")
private int papiCacheTime = 30;
@Getter

View File

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