Add ability to disable random Mojang uuid API calls (#3586)

* feature: ability to disable impromtu Mojang uuid API calls

* refactor: update comment for the new setting
This commit is contained in:
Bernhard 2022-05-11 14:11:57 +02:00 committed by GitHub
parent 8b75dece69
commit 85911646f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -513,8 +513,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
this.backgroundPipeline.registerService(essentialsUUIDService); this.backgroundPipeline.registerService(essentialsUUIDService);
} }
if (Settings.UUID.IMPROMPTU_SERVICE_MOJANG_API) {
final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT); final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT);
this.impromptuPipeline.registerService(impromptuMojangService); this.impromptuPipeline.registerService(impromptuMojangService);
}
final SquirrelIdUUIDService backgroundMojangService = new SquirrelIdUUIDService(Settings.UUID.BACKGROUND_LIMIT); final SquirrelIdUUIDService backgroundMojangService = new SquirrelIdUUIDService(Settings.UUID.BACKGROUND_LIMIT);
this.backgroundPipeline.registerService(backgroundMojangService); this.backgroundPipeline.registerService(backgroundMojangService);
} else { } else {

View File

@ -249,6 +249,9 @@ public class Settings extends Config {
public static int UUID_CACHE_SIZE = 100000; public static int UUID_CACHE_SIZE = 100000;
@Comment("Rate limit (per 10 minutes) for background UUID fetching from the Mojang API") @Comment("Rate limit (per 10 minutes) for background UUID fetching from the Mojang API")
public static int BACKGROUND_LIMIT = 200; public static int BACKGROUND_LIMIT = 200;
@Comment("Whether the Mojang API service is enabled for impromptu api calls. If false only the Background task will use" +
" http requests to fill the UUID cache (requires restart)")
public static boolean IMPROMPTU_SERVICE_MOJANG_API = true;
@Comment("Rate limit (per 10 minutes) for random UUID fetching from the Mojang API") @Comment("Rate limit (per 10 minutes) for random UUID fetching from the Mojang API")
public static int IMPROMPTU_LIMIT = 300; public static int IMPROMPTU_LIMIT = 300;
@Comment("Timeout (in milliseconds) for non-blocking UUID requests (mostly commands)") @Comment("Timeout (in milliseconds) for non-blocking UUID requests (mostly commands)")
@ -691,6 +694,7 @@ public class Settings extends Config {
@Comment({"If blocks at the edges of queued operations should be set causing updates", @Comment({"If blocks at the edges of queued operations should be set causing updates",
" - Slightly slower, but prevents issues such as fences left connected to nothing"}) " - Slightly slower, but prevents issues such as fences left connected to nothing"})
public static boolean UPDATE_EDGES = true; public static boolean UPDATE_EDGES = true;
} }
@Comment("Settings related to tab completion") @Comment("Settings related to tab completion")