Some minor tidying

This commit is contained in:
Luck 2021-02-22 22:51:36 +00:00
parent 4018493285
commit 734b011dc7
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
6 changed files with 21 additions and 25 deletions

View File

@ -162,7 +162,7 @@ public class LPBukkitBootstrap implements LuckPermsBootstrap, LoaderBootstrap {
logger.severe(""); 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.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("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("----------------------------------------------------------------------"); logger.severe("----------------------------------------------------------------------");
getServer().getPluginManager().disablePlugin(this.loader); getServer().getPluginManager().disablePlugin(this.loader);
return; return;

View File

@ -267,15 +267,13 @@ public class LPBukkitPlugin extends AbstractLuckPermsPlugin {
@Override @Override
protected void performFinalSetup() { protected void performFinalSetup() {
// register permissions // register permissions
try { PluginManager pluginManager = this.bootstrap.getServer().getPluginManager();
PluginManager pm = this.bootstrap.getServer().getPluginManager(); PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE;
PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE;
for (CommandPermission p : CommandPermission.values()) { for (CommandPermission permission : CommandPermission.values()) {
pm.addPermission(new Permission(p.getPermission(), permDefault)); Permission bukkitPermission = new Permission(permission.getPermission(), permDefault);
} pluginManager.removePermission(bukkitPermission);
} catch (Exception e) { pluginManager.addPermission(bukkitPermission);
// this throws an exception if the plugin is /reloaded, grr
} }
// remove all operators on startup if they're disabled // remove all operators on startup if they're disabled

View File

@ -60,9 +60,9 @@ public class VaultHookManager {
this.chat = new LuckPermsVaultChat(this.plugin, this.permission); this.chat = new LuckPermsVaultChat(this.plugin, this.permission);
} }
final ServicesManager sm = this.plugin.getBootstrap().getServer().getServicesManager(); ServicesManager servicesManager = this.plugin.getBootstrap().getServer().getServicesManager();
sm.register(Permission.class, this.permission, this.plugin.getLoader(), ServicePriority.High); servicesManager.register(Permission.class, this.permission, this.plugin.getLoader(), ServicePriority.High);
sm.register(Chat.class, this.chat, this.plugin.getLoader(), ServicePriority.High); servicesManager.register(Chat.class, this.chat, this.plugin.getLoader(), ServicePriority.High);
} catch (Exception e) { } catch (Exception e) {
this.plugin.getLogger().severe("Error occurred whilst hooking into Vault.", 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. * Unregisters the LuckPerms Vault hooks, if present.
*/ */
public void unhook() { public void unhook() {
final ServicesManager sm = this.plugin.getBootstrap().getServer().getServicesManager(); ServicesManager servicesManager = this.plugin.getBootstrap().getServer().getServicesManager();
if (this.permission != null) { if (this.permission != null) {
sm.unregister(Permission.class, this.permission); servicesManager.unregister(Permission.class, this.permission);
this.permission = null; this.permission = null;
} }
if (this.chat != null) { if (this.chat != null) {
sm.unregister(Chat.class, this.chat); servicesManager.unregister(Chat.class, this.chat);
this.chat = null; this.chat = null;
} }
} }

View File

@ -247,7 +247,7 @@ public abstract class PermissionHolder {
} }
private DataType[] queryOrder(QueryOptions queryOptions) { private DataType[] queryOrder(QueryOptions queryOptions) {
return DataSelector.select(queryOptions, getIdentifier()); return DataSelector.selectOrder(queryOptions, getIdentifier());
} }
public List<Node> getOwnNodes(QueryOptions queryOptions) { public List<Node> getOwnNodes(QueryOptions queryOptions) {

View File

@ -46,7 +46,7 @@ public final class DataSelector {
private static final DataType[] TRANSIENT = new DataType[]{DataType.TRANSIENT}; private static final DataType[] TRANSIENT = new DataType[]{DataType.TRANSIENT};
private static final DataType[] NONE = new DataType[0]; 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 DataQueryOrderFunction orderFunc = queryOptions.option(DataQueryOrderFunction.KEY).orElse(null);
final DataTypeFilterFunction filterFunc = queryOptions.option(DataTypeFilterFunction.KEY).orElse(null); final DataTypeFilterFunction filterFunc = queryOptions.option(DataTypeFilterFunction.KEY).orElse(null);

View File

@ -191,15 +191,13 @@ public class LPNukkitPlugin extends AbstractLuckPermsPlugin {
@Override @Override
protected void performFinalSetup() { protected void performFinalSetup() {
// register permissions // register permissions
try { PluginManager pluginManager = this.bootstrap.getServer().getPluginManager();
PluginManager pm = this.bootstrap.getServer().getPluginManager(); PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE;
PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE;
for (CommandPermission p : CommandPermission.values()) { for (CommandPermission permission : CommandPermission.values()) {
pm.addPermission(new Permission(p.getPermission(), null, permDefault.toString())); Permission bukkitPermission = new Permission(permission.getPermission(), null, permDefault.toString());
} pluginManager.removePermission(bukkitPermission);
} catch (Exception e) { pluginManager.addPermission(bukkitPermission);
// this throws an exception if the plugin is /reloaded, grr
} }
// remove all operators on startup if they're disabled // remove all operators on startup if they're disabled