From 6cf2c0ad97ddde136cb44329293fa5ffac2a5669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 12 Jul 2020 17:04:30 +0200 Subject: [PATCH] Disable the paper uuid service for offline mode servers and add toggles for all third party uuid services --- .../com/plotsquared/bukkit/BukkitMain.java | 18 +++++++++++------- .../core/configuration/Settings.java | 10 ++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 39b2a3c9d..a35466d1d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -259,9 +259,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< PlotSquared.log(Captions.PREFIX + "(UUID) Using the offline mode UUID service"); } - final OfflinePlayerUUIDService offlinePlayerUUIDService = new OfflinePlayerUUIDService(); - impromptuPipeline.registerService(offlinePlayerUUIDService); - backgroundPipeline.registerService(offlinePlayerUUIDService); + if (Settings.UUID.SERVICE_BUKKIT) { + final OfflinePlayerUUIDService offlinePlayerUUIDService = new OfflinePlayerUUIDService(); + impromptuPipeline.registerService(offlinePlayerUUIDService); + backgroundPipeline.registerService(offlinePlayerUUIDService); + } final SQLiteUUIDService sqLiteUUIDService = new SQLiteUUIDService("user_cache.db"); @@ -274,7 +276,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< } final LuckPermsUUIDService luckPermsUUIDService; - if (Bukkit.getPluginManager().getPlugin("LuckPerms") != null) { + if (Settings.UUID.SERVICE_LUCKPERMS && + Bukkit.getPluginManager().getPlugin("LuckPerms") != null) { luckPermsUUIDService = new LuckPermsUUIDService(); PlotSquared .log(Captions.PREFIX + "(UUID) Using LuckPerms as a complementary UUID service"); @@ -283,7 +286,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< } final BungeePermsUUIDService bungeePermsUUIDService; - if (Bukkit.getPluginManager().getPlugin("BungeePerms") != null) { + if (Settings.UUID.SERVICE_BUNGEE_PERMS && + Bukkit.getPluginManager().getPlugin("BungeePerms") != null) { bungeePermsUUIDService = new BungeePermsUUIDService(); PlotSquared .log(Captions.PREFIX + "(UUID) Using BungeePerms as a complementary UUID service"); @@ -292,7 +296,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< } final EssentialsUUIDService essentialsUUIDService; - if (Bukkit.getPluginManager().getPlugin("Essentials") != null) { + if (Settings.UUID.SERVICE_ESSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) { essentialsUUIDService = new EssentialsUUIDService(); PlotSquared .log(Captions.PREFIX + "(UUID) Using Essentials as a complementary UUID service"); @@ -302,7 +306,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< if (!Settings.UUID.OFFLINE) { // If running Paper we'll also try to use their profiles - if (PaperLib.isPaper()) { + if (Bukkit.getOnlineMode() && PaperLib.isPaper() && Settings.UUID.SERVICE_PAPER) { final PaperUUIDService paperUUIDService = new PaperUUIDService(); impromptuPipeline.registerService(paperUUIDService); backgroundPipeline.registerService(paperUUIDService); 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 f575fba43..352728b43 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -260,6 +260,16 @@ public class Settings extends Config { @Comment("Whether or not automatic background caching should be enabled. It is HIGHLY recommended to keep this turned on." + " This should only be disabled if the server has a very large number of plots (>100k)") public static boolean BACKGROUND_CACHING_ENABLED = true; + @Comment("Whether the paper service is enabled") + public static boolean SERVICE_PAPER = true; + @Comment("Whether the LP service is enabled") + public static boolean SERVICE_LUCKPERMS = true; + @Comment("Whether the Bukkit service is enabled") + public static boolean SERVICE_BUKKIT = true; + @Comment("Whether the EssX service is enabled") + public static boolean SERVICE_ESSX = true; + @Comment("Whether the BungeePerms service is enabled") + public static boolean SERVICE_BUNGEE_PERMS = true; }