From 734b011dc784ffdcd17b8de36fe32870e2ff8abc Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 22 Feb 2021 22:51:36 +0000 Subject: [PATCH] Some minor tidying --- .../lucko/luckperms/bukkit/LPBukkitBootstrap.java | 2 +- .../me/lucko/luckperms/bukkit/LPBukkitPlugin.java | 14 ++++++-------- .../luckperms/bukkit/vault/VaultHookManager.java | 12 ++++++------ .../luckperms/common/model/PermissionHolder.java | 2 +- .../lucko/luckperms/common/query/DataSelector.java | 2 +- .../me/lucko/luckperms/nukkit/LPNukkitPlugin.java | 14 ++++++-------- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitBootstrap.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitBootstrap.java index 380fbeed9..fd9333f76 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitBootstrap.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitBootstrap.java @@ -162,7 +162,7 @@ public class LPBukkitBootstrap implements LuckPermsBootstrap, LoaderBootstrap { logger.severe(""); logger.severe("If your server is running 1.8, please update to 1.8.8 or higher."); logger.severe("If your server is running 1.7.10, please download the Bukkit-Legacy version of LuckPerms from here:"); - logger.severe("==> https://ci.lucko.me/job/LuckPerms/"); + logger.severe("==> https://luckperms.net/download"); logger.severe("----------------------------------------------------------------------"); getServer().getPluginManager().disablePlugin(this.loader); return; diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java index 8d9736769..682ff0635 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java @@ -267,15 +267,13 @@ public class LPBukkitPlugin extends AbstractLuckPermsPlugin { @Override protected void performFinalSetup() { // register permissions - try { - PluginManager pm = this.bootstrap.getServer().getPluginManager(); - PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE; + PluginManager pluginManager = this.bootstrap.getServer().getPluginManager(); + PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE; - for (CommandPermission p : CommandPermission.values()) { - pm.addPermission(new Permission(p.getPermission(), permDefault)); - } - } catch (Exception e) { - // this throws an exception if the plugin is /reloaded, grr + for (CommandPermission permission : CommandPermission.values()) { + Permission bukkitPermission = new Permission(permission.getPermission(), permDefault); + pluginManager.removePermission(bukkitPermission); + pluginManager.addPermission(bukkitPermission); } // remove all operators on startup if they're disabled diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultHookManager.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultHookManager.java index 01afcd591..06ec6dd6c 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultHookManager.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultHookManager.java @@ -60,9 +60,9 @@ public class VaultHookManager { this.chat = new LuckPermsVaultChat(this.plugin, this.permission); } - final ServicesManager sm = this.plugin.getBootstrap().getServer().getServicesManager(); - sm.register(Permission.class, this.permission, this.plugin.getLoader(), ServicePriority.High); - sm.register(Chat.class, this.chat, this.plugin.getLoader(), ServicePriority.High); + ServicesManager servicesManager = this.plugin.getBootstrap().getServer().getServicesManager(); + servicesManager.register(Permission.class, this.permission, this.plugin.getLoader(), ServicePriority.High); + servicesManager.register(Chat.class, this.chat, this.plugin.getLoader(), ServicePriority.High); } catch (Exception e) { this.plugin.getLogger().severe("Error occurred whilst hooking into Vault.", e); @@ -73,15 +73,15 @@ public class VaultHookManager { * Unregisters the LuckPerms Vault hooks, if present. */ public void unhook() { - final ServicesManager sm = this.plugin.getBootstrap().getServer().getServicesManager(); + ServicesManager servicesManager = this.plugin.getBootstrap().getServer().getServicesManager(); if (this.permission != null) { - sm.unregister(Permission.class, this.permission); + servicesManager.unregister(Permission.class, this.permission); this.permission = null; } if (this.chat != null) { - sm.unregister(Chat.class, this.chat); + servicesManager.unregister(Chat.class, this.chat); this.chat = null; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java index 926b23dd1..226771385 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java @@ -247,7 +247,7 @@ public abstract class PermissionHolder { } private DataType[] queryOrder(QueryOptions queryOptions) { - return DataSelector.select(queryOptions, getIdentifier()); + return DataSelector.selectOrder(queryOptions, getIdentifier()); } public List getOwnNodes(QueryOptions queryOptions) { diff --git a/common/src/main/java/me/lucko/luckperms/common/query/DataSelector.java b/common/src/main/java/me/lucko/luckperms/common/query/DataSelector.java index 92ba97f4b..34a6e7ec6 100644 --- a/common/src/main/java/me/lucko/luckperms/common/query/DataSelector.java +++ b/common/src/main/java/me/lucko/luckperms/common/query/DataSelector.java @@ -46,7 +46,7 @@ public final class DataSelector { private static final DataType[] TRANSIENT = new DataType[]{DataType.TRANSIENT}; private static final DataType[] NONE = new DataType[0]; - public static DataType[] select(QueryOptions queryOptions, PermissionHolder.Identifier identifier) { + public static DataType[] selectOrder(QueryOptions queryOptions, PermissionHolder.Identifier identifier) { final DataQueryOrderFunction orderFunc = queryOptions.option(DataQueryOrderFunction.KEY).orElse(null); final DataTypeFilterFunction filterFunc = queryOptions.option(DataTypeFilterFunction.KEY).orElse(null); diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/LPNukkitPlugin.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/LPNukkitPlugin.java index 266ed5a86..24b411b8c 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/LPNukkitPlugin.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/LPNukkitPlugin.java @@ -191,15 +191,13 @@ public class LPNukkitPlugin extends AbstractLuckPermsPlugin { @Override protected void performFinalSetup() { // register permissions - try { - PluginManager pm = this.bootstrap.getServer().getPluginManager(); - PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE; + PluginManager pluginManager = this.bootstrap.getServer().getPluginManager(); + PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE; - for (CommandPermission p : CommandPermission.values()) { - pm.addPermission(new Permission(p.getPermission(), null, permDefault.toString())); - } - } catch (Exception e) { - // this throws an exception if the plugin is /reloaded, grr + for (CommandPermission permission : CommandPermission.values()) { + Permission bukkitPermission = new Permission(permission.getPermission(), null, permDefault.toString()); + pluginManager.removePermission(bukkitPermission); + pluginManager.addPermission(bukkitPermission); } // remove all operators on startup if they're disabled