From b59b98c11a5c53437809c05b8a27bd6b96d058f5 Mon Sep 17 00:00:00 2001 From: xaver106 Date: Sat, 23 Apr 2022 23:04:27 +0200 Subject: [PATCH] feature: ability to disable impromtu Mojang uuid API calls --- .../main/java/com/plotsquared/bukkit/BukkitPlatform.java | 6 ++++-- .../java/com/plotsquared/core/configuration/Settings.java | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index cd7dc4c7f..af6faf26f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -513,8 +513,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl this.backgroundPipeline.registerService(essentialsUUIDService); } - final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT); - this.impromptuPipeline.registerService(impromptuMojangService); + if (Settings.UUID.IMPROMPTU_SERVICE_MOJANG_API) { + final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT); + this.impromptuPipeline.registerService(impromptuMojangService); + } final SquirrelIdUUIDService backgroundMojangService = new SquirrelIdUUIDService(Settings.UUID.BACKGROUND_LIMIT); this.backgroundPipeline.registerService(backgroundMojangService); } else { diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 817550e64..81e215277 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -249,6 +249,8 @@ public class Settings extends Config { public static int UUID_CACHE_SIZE = 100000; @Comment("Rate limit (per 10 minutes) for background UUID fetching from the Mojang API") public static int BACKGROUND_LIMIT = 200; + @Comment("Whether the Mojang API service is enabled for inpromto (requires restart)") + public static boolean IMPROMPTU_SERVICE_MOJANG_API = true; @Comment("Rate limit (per 10 minutes) for random UUID fetching from the Mojang API") public static int IMPROMPTU_LIMIT = 300; @Comment("Timeout (in milliseconds) for non-blocking UUID requests (mostly commands)")