diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java index c264998d4..f22621159 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitSenderFactory.java @@ -23,9 +23,9 @@ package me.lucko.luckperms.bukkit; import me.lucko.luckperms.bukkit.compat.MessageHandler; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.SenderFactory; import me.lucko.luckperms.common.constants.Constants; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; 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 87ab4462a..d22e439de 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java @@ -39,14 +39,13 @@ import me.lucko.luckperms.bukkit.model.ChildPermissionProvider; import me.lucko.luckperms.bukkit.model.DefaultsProvider; import me.lucko.luckperms.bukkit.model.LPPermissible; import me.lucko.luckperms.bukkit.vault.VaultHook; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.ApiHandler; import me.lucko.luckperms.common.api.ApiProvider; import me.lucko.luckperms.common.caching.handlers.CachedStateManager; import me.lucko.luckperms.common.calculators.CalculatorFactory; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.config.ConfigKeys; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.contexts.ContextManager; import me.lucko.luckperms.common.contexts.ServerCalculator; @@ -66,6 +65,7 @@ import me.lucko.luckperms.common.managers.impl.GenericTrackManager; import me.lucko.luckperms.common.managers.impl.GenericUserManager; import me.lucko.luckperms.common.messaging.InternalMessagingService; import me.lucko.luckperms.common.messaging.RedisMessaging; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.Storage; import me.lucko.luckperms.common.storage.StorageFactory; import me.lucko.luckperms.common.storage.StorageType; @@ -88,7 +88,6 @@ import org.bukkit.plugin.java.JavaPlugin; import java.io.File; import java.io.InputStream; import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -97,22 +96,14 @@ import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Getter public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { private Set ignoringLogs; - private Set shutdownHooks; - private Executor syncExecutor; - private Executor asyncExecutor; - private Executor asyncBukkitExecutor; - private ExecutorService asyncLpExecutor; + private LPBukkitScheduler scheduler; private VaultHook vaultHook = null; - private LPConfiguration configuration; + private LuckPermsConfiguration configuration; private UserManager userManager; private GroupManager groupManager; private TrackManager trackManager; @@ -138,12 +129,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { @Override public void onEnable() { - // Used whilst the plugin is enabling / disabling / disabled - asyncLpExecutor = Executors.newCachedThreadPool(); - asyncBukkitExecutor = r -> getServer().getScheduler().runTaskAsynchronously(this, r); - - asyncExecutor = asyncLpExecutor; - syncExecutor = r -> getServer().getScheduler().runTask(this, r); + scheduler = new LPBukkitScheduler(this); localeManager = new NoopLocaleManager(); senderFactory = new BukkitSenderFactory(this); @@ -151,9 +137,8 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this); ignoringLogs = ConcurrentHashMap.newKeySet(); - shutdownHooks = Collections.synchronizedSet(new HashSet<>()); - debugHandler = new DebugHandler(asyncBukkitExecutor, getVersion()); - permissionCache = new PermissionCache(asyncBukkitExecutor); + debugHandler = new DebugHandler(scheduler.getAsyncBukkitExecutor(), getVersion()); + permissionCache = new PermissionCache(scheduler.getAsyncBukkitExecutor()); getLog().info("Loading configuration..."); configuration = new BukkitConfig(this); @@ -168,7 +153,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { childPermissionProvider = new ChildPermissionProvider(); // give all plugins a chance to load their defaults, then refresh. - getServer().getScheduler().runTaskLater(this, () -> { + scheduler.doSyncLater(() -> { defaultsProvider.refresh(); childPermissionProvider.setup(); @@ -298,34 +283,35 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { int mins = getConfiguration().get(ConfigKeys.SYNC_TIME); if (mins > 0) { long ticks = mins * 60 * 20; - getServer().getScheduler().runTaskTimerAsynchronously(this, () -> updateTaskBuffer.request(), 40L, ticks); + scheduler.doAsyncRepeating(() -> updateTaskBuffer.request(), ticks); } + scheduler.doAsyncLater(() -> updateTaskBuffer.request(), 40L); // run an update instantly. updateTaskBuffer.requestDirectly(); // register tasks - getServer().getScheduler().runTaskTimerAsynchronously(this, new ExpireTemporaryTask(this), 60L, 60L); - getServer().getScheduler().runTaskTimerAsynchronously(this, new CacheHousekeepingTask(this), 2400L, 2400L); + scheduler.doAsyncRepeating(new ExpireTemporaryTask(this), 60L); + scheduler.doAsyncRepeating(new CacheHousekeepingTask(this), 2400L); // register permissions registerPermissions(getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE); if (!getConfiguration().get(ConfigKeys.OPS_ENABLED)) { - getServer().getScheduler().runTask(this, () -> getServer().getOperators().forEach(o -> o.setOp(false))); + scheduler.doSync(() -> getServer().getOperators().forEach(o -> o.setOp(false))); } // replace the temporary executor when the Bukkit one starts getServer().getScheduler().runTaskAsynchronously(this, () -> { - asyncExecutor = asyncBukkitExecutor; + scheduler.setUseBukkitAsync(true); }); // Load any online users (in the case of a reload) for (Player player : getServer().getOnlinePlayers()) { - doAsync(() -> { + scheduler.doAsync(() -> { listener.onAsyncLogin(player.getUniqueId(), player.getName()); User user = getUserManager().get(getUuidCache().getUUID(player.getUniqueId())); if (user != null) { - doSync(() -> { + scheduler.doSync(() -> { try { LPPermissible lpPermissible = new LPPermissible(player, user, this); Injector.inject(player, lpPermissible); @@ -344,12 +330,10 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { @Override public void onDisable() { // Switch back to the LP executor, the bukkit one won't allow new tasks - asyncExecutor = asyncLpExecutor; + scheduler.setUseBukkitAsync(false); started = false; - shutdownHooks.forEach(Runnable::run); - defaultsProvider.close(); permissionCache.setShutdown(true); debugHandler.setShutdown(true); @@ -383,13 +367,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { vaultHook.unhook(this); } - // wait for executor - asyncLpExecutor.shutdown(); - try { - asyncLpExecutor.awaitTermination(30, TimeUnit.SECONDS); - } catch (InterruptedException e) { - e.printStackTrace(); - } + scheduler.shutdown(); // Bukkit will do this again when #onDisable completes, but we do it early to prevent NPEs elsewhere. getServer().getScheduler().cancelTasks(this); @@ -466,28 +444,13 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { } } - @Override - public void doAsync(Runnable r) { - asyncExecutor.execute(r); - } - - @Override - public void doSync(Runnable r) { - syncExecutor.execute(r); - } - - @Override - public void doAsyncRepeating(Runnable r, long interval) { - getServer().getScheduler().runTaskTimerAsynchronously(this, r, interval, interval); - } - @Override public String getVersion() { return getDescription().getVersion(); } @Override - public PlatformType getType() { + public PlatformType getServerType() { return PlatformType.BUKKIT; } @@ -502,8 +465,8 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { } @Override - public File getMainDir() { - return getDataFolder(); + public File getDataDirectory() { + return super.getDataFolder(); } @Override @@ -549,12 +512,12 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { } @Override - public boolean isOnline(UUID external) { + public boolean isPlayerOnline(UUID external) { return getServer().getPlayer(external) != null; } @Override - public List getSenders() { + public List getOnlineSenders() { return getServer().getOnlinePlayers().stream() .map(p -> getSenderFactory().wrap(p)) .collect(Collectors.toList()); @@ -647,19 +610,9 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { return map; } - @Override - public Object getPlugin(String name) { - return getServer().getPluginManager().getPlugin(name); - } - - @Override - public Object getService(Class clazz) { - return getServer().getServicesManager().load(clazz); - } - @SuppressWarnings("deprecation") @Override - public UUID getUUID(String playerName) { + public UUID getUuidFromUsername(String playerName) { try { return getServer().getOfflinePlayer(playerName).getUniqueId(); } catch (Exception e) { @@ -667,16 +620,6 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { } } - @Override - public boolean isPluginLoaded(String name) { - return getServer().getPluginManager().isPluginEnabled(name); - } - - @Override - public void addShutdownHook(Runnable r) { - shutdownHooks.add(r); - } - private void registerPermissions(PermissionDefault def) { PluginManager pm = getServer().getPluginManager(); diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitScheduler.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitScheduler.java new file mode 100644 index 000000000..08f2c5c49 --- /dev/null +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitScheduler.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2016 Lucko (Luck) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.bukkit; + +import lombok.Getter; +import lombok.Setter; + +import me.lucko.luckperms.common.plugin.LuckPermsScheduler; + +import org.bukkit.scheduler.BukkitTask; + +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class LPBukkitScheduler implements LuckPermsScheduler { + private final LPBukkitPlugin plugin; + + @Getter + private ExecutorService asyncLpExecutor; + @Getter + private Executor asyncBukkitExecutor; + private Executor syncExecutor; + + @Getter + @Setter + private boolean useBukkitAsync = false; + + private Set tasks = ConcurrentHashMap.newKeySet(); + + public LPBukkitScheduler(LPBukkitPlugin plugin) { + this.plugin = plugin; + + this.asyncLpExecutor = Executors.newCachedThreadPool(); + this.asyncBukkitExecutor = r -> plugin.getServer().getScheduler().runTaskAsynchronously(plugin, r); + this.syncExecutor = r -> plugin.getServer().getScheduler().runTask(plugin, r); + } + + @Override + public Executor getAsyncExecutor() { + return useBukkitAsync ? asyncBukkitExecutor : asyncLpExecutor; + } + + @Override + public Executor getSyncExecutor() { + return syncExecutor; + } + + @Override + public void doAsync(Runnable r) { + getAsyncExecutor().execute(r); + } + + @Override + public void doSync(Runnable r) { + getSyncExecutor().execute(r); + } + + @Override + public void doAsyncRepeating(Runnable r, long interval) { + BukkitTask task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, r, interval, interval); + tasks.add(task); + } + + @Override + public void doSyncRepeating(Runnable r, long interval) { + BukkitTask task = plugin.getServer().getScheduler().runTaskTimer(plugin, r, interval, interval); + tasks.add(task); + } + + @Override + public void doAsyncLater(Runnable r, long delay) { + plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, r, delay); + } + + @Override + public void doSyncLater(Runnable r, long delay) { + plugin.getServer().getScheduler().runTaskLater(plugin, r, delay); + } + + @Override + public void shutdown() { + tasks.forEach(BukkitTask::cancel); + // wait for executor + asyncLpExecutor.shutdown(); + try { + asyncLpExecutor.awaitTermination(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } +} diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java index e76d5fd24..8ea99858c 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/WorldCalculator.java @@ -28,8 +28,8 @@ import com.google.common.collect.Maps; import me.lucko.luckperms.api.context.ContextCalculator; import me.lucko.luckperms.api.context.MutableContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import org.bukkit.entity.Player; import org.bukkit.event.Listener; diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java index 9882b3f31..59b413519 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java @@ -30,7 +30,6 @@ import de.bananaco.bpermissions.api.World; import de.bananaco.bpermissions.api.WorldManager; import me.lucko.luckperms.api.MetaUtils; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -40,6 +39,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; @@ -243,7 +243,7 @@ public class MigrationBPermissions extends SubCommand { try { uuid = UUID.fromString(user.getName()); } catch (IllegalArgumentException e) { - uuid = plugin.getUUID(user.getName()); + uuid = plugin.getUuidFromUsername(user.getName()); } if (uuid == null) { diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationGroupManager.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationGroupManager.java index c783ecda4..4a189835f 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationGroupManager.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationGroupManager.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.bukkit.migration; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectLacksException; @@ -43,6 +43,7 @@ import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder; +import org.bukkit.Bukkit; import java.util.AbstractMap; import java.util.HashMap; @@ -67,7 +68,7 @@ public class MigrationGroupManager extends SubCommand { }; log.accept("Starting GroupManager migration."); - if (!plugin.isPluginLoaded("GroupManager")) { + if (!Bukkit.getPluginManager().isPluginEnabled("GroupManager")) { log.accept("Error -> GroupManager is not loaded."); return CommandResult.STATE_ERROR; } @@ -76,7 +77,7 @@ public class MigrationGroupManager extends SubCommand { .map(String::toLowerCase) .collect(Collectors.toList()); - GroupManager gm = (GroupManager) plugin.getPlugin("GroupManager"); + GroupManager gm = (GroupManager) Bukkit.getPluginManager().getPlugin("GroupManager"); // Migrate Global Groups log.accept("Starting Global Group migration."); diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPermissionsEx.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPermissionsEx.java index 4d868484a..231332aa6 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPermissionsEx.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPermissionsEx.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.bukkit.migration; import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.PlatformType; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,9 +35,12 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; +import org.bukkit.Bukkit; + import ru.tehkode.permissions.NativeInterface; import ru.tehkode.permissions.PermissionGroup; import ru.tehkode.permissions.PermissionManager; @@ -67,12 +69,12 @@ public class MigrationPermissionsEx extends SubCommand { }; log.accept("Starting PermissionsEx migration."); - if (!plugin.isPluginLoaded("PermissionsEx")) { + if (!Bukkit.getPluginManager().isPluginEnabled("PermissionsEx")) { log.accept("Error -> PermissionsEx is not loaded."); return CommandResult.STATE_ERROR; } - if (plugin.getType() != PlatformType.BUKKIT) { + if (plugin.getServerType() != PlatformType.BUKKIT) { // Sponge uses a completely different version of PEX. log.accept("PEX import is not supported on this platform."); return CommandResult.STATE_ERROR; @@ -82,7 +84,7 @@ public class MigrationPermissionsEx extends SubCommand { .map(String::toLowerCase) .collect(Collectors.toList()); - PermissionsEx pex = (PermissionsEx) plugin.getPlugin("PermissionsEx"); + PermissionsEx pex = (PermissionsEx) Bukkit.getPluginManager().getPlugin("PermissionsEx"); PermissionManager manager = pex.getPermissionsManager(); NativeInterface ni; @@ -249,7 +251,7 @@ public class MigrationPermissionsEx extends SubCommand { } catch (IllegalArgumentException e) { u = ni.nameToUUID(user.getIdentifier()); if (u == null) { - u = plugin.getUUID(user.getIdentifier()); + u = plugin.getUuidFromUsername(user.getIdentifier()); } } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPowerfulPerms.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPowerfulPerms.java index ce0df0bb4..e7137db8c 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPowerfulPerms.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPowerfulPerms.java @@ -35,7 +35,6 @@ import com.zaxxer.hikari.HikariDataSource; import me.lucko.luckperms.api.data.Callback; import me.lucko.luckperms.bukkit.migration.utils.LPResultRunnable; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -46,9 +45,12 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; +import org.bukkit.Bukkit; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.sql.Connection; @@ -202,7 +204,7 @@ public class MigrationPowerfulPerms extends SubCommand { }; log.accept("Starting PowerfulPerms migration."); - if (!plugin.isPluginLoaded("PowerfulPerms")) { + if (!Bukkit.getPluginManager().isPluginEnabled("PowerfulPerms")) { log.accept("Error -> PowerfulPerms is not loaded."); return CommandResult.STATE_ERROR; } @@ -266,7 +268,7 @@ public class MigrationPowerfulPerms extends SubCommand { log.accept("Found " + uuids.size() + " uuids. Starting migration."); - PowerfulPermsPlugin ppPlugin = (PowerfulPermsPlugin) plugin.getPlugin("PowerfulPerms"); + PowerfulPermsPlugin ppPlugin = (PowerfulPermsPlugin) Bukkit.getPluginManager().getPlugin("PowerfulPerms"); PermissionManager pm = ppPlugin.getPermissionManager(); // Groups first. diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationZPermissions.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationZPermissions.java index d1ca0c39f..da407891e 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationZPermissions.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationZPermissions.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.bukkit.migration; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -34,9 +33,11 @@ import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; +import org.bukkit.Bukkit; import org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsService; import org.tyrannyofheaven.bukkit.zPermissions.dao.PermissionService; import org.tyrannyofheaven.bukkit.zPermissions.model.EntityMetadata; @@ -63,19 +64,19 @@ public class MigrationZPermissions extends SubCommand { }; log.accept("Starting zPermissions migration."); - if (!plugin.isPluginLoaded("zPermissions")) { + if (!Bukkit.getPluginManager().isPluginEnabled("zPermissions")) { log.accept("Error -> zPermissions is not loaded."); return CommandResult.STATE_ERROR; } - ZPermissionsService service = (ZPermissionsService) plugin.getService(ZPermissionsService.class); - if (service == null) { + if (!Bukkit.getServicesManager().isProvidedFor(ZPermissionsService.class)) { log.accept("Error -> zPermissions is not loaded."); return CommandResult.STATE_ERROR; } + ZPermissionsService service = Bukkit.getServicesManager().getRegistration(ZPermissionsService.class).getProvider(); + PermissionService internalService; - try { Field psField = service.getClass().getDeclaredField("permissionService"); psField.setAccessible(true); diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java index 9cf313b40..a017a6a10 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java @@ -57,7 +57,7 @@ public class VaultPermissionHook extends Permission { private final String name = "LuckPerms"; - private Function WORLD_CORRECTION_FUNCTION = s -> isIgnoreWorld() ? null : s; + private Function worldCorrectionFunction = s -> isIgnoreWorld() ? null : s; public VaultPermissionHook(LPBukkitPlugin plugin) { this.plugin = plugin; @@ -132,11 +132,11 @@ public class VaultPermissionHook extends Permission { public void save(PermissionHolder holder) { if (holder instanceof User) { User u = (User) holder; - plugin.getStorage().saveUser(u).thenRunAsync(() -> u.getRefreshBuffer().request(), plugin.getAsyncExecutor()); + plugin.getStorage().saveUser(u).thenRunAsync(() -> u.getRefreshBuffer().request(), plugin.getScheduler().getAsyncExecutor()); } if (holder instanceof Group) { Group g = (Group) holder; - plugin.getStorage().saveGroup(g).thenRunAsync(() -> plugin.getUpdateTaskBuffer().request(), plugin.getAsyncExecutor()); + plugin.getStorage().saveGroup(g).thenRunAsync(() -> plugin.getUpdateTaskBuffer().request(), plugin.getScheduler().getAsyncExecutor()); } } @@ -151,7 +151,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean playerHas(String world, @NonNull String player, @NonNull String permission) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Checking if player " + player + " has permission: " + permission + " on world " + world + ", server " + getServer()); User user = plugin.getUserManager().getByUsername(player); @@ -167,7 +167,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean playerAdd(String world, @NonNull String player, @NonNull String permission) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Adding permission to player " + player + ": '" + permission + "' on world " + world + ", server " + getServer()); final User user = plugin.getUserManager().getByUsername(player); @@ -179,7 +179,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean playerRemove(String world, @NonNull String player, @NonNull String permission) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Removing permission from player " + player + ": '" + permission + "' on world " + world + ", server " + getServer()); final User user = plugin.getUserManager().getByUsername(player); @@ -191,7 +191,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean groupHas(String world, @NonNull String groupName, @NonNull String permission) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Checking if group " + groupName + " has permission: " + permission + " on world " + world + ", server " + getServer()); final Group group = plugin.getGroupManager().getIfLoaded(groupName); @@ -204,7 +204,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean groupAdd(String world, @NonNull String groupName, @NonNull String permission) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Adding permission to group " + groupName + ": '" + permission + "' on world " + world + ", server " + getServer()); final Group group = plugin.getGroupManager().getIfLoaded(groupName); @@ -216,7 +216,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean groupRemove(String world, @NonNull String groupName, @NonNull String permission) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Removing permission from group " + groupName + ": '" + permission + "' on world " + world + ", server " + getServer()); final Group group = plugin.getGroupManager().getIfLoaded(groupName); @@ -228,7 +228,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean playerInGroup(String world, @NonNull String player, @NonNull String group) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Checking if player " + player + " is in group: " + group + " on world " + world + ", server " + getServer()); final User user = plugin.getUserManager().getByUsername(player); @@ -245,7 +245,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean playerAddGroup(String world, @NonNull String player, @NonNull String groupName) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Adding player " + player + " to group: '" + groupName + "' on world " + world + ", server " + getServer()); final User user = plugin.getUserManager().getByUsername(player); @@ -271,7 +271,7 @@ public class VaultPermissionHook extends Permission { @Override public boolean playerRemoveGroup(String world, @NonNull String player, @NonNull String groupName) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Removing player " + player + " from group: '" + groupName + "' on world " + world + ", server " + getServer()); final User user = plugin.getUserManager().getByUsername(player); @@ -297,7 +297,7 @@ public class VaultPermissionHook extends Permission { @Override public String[] getPlayerGroups(String world, @NonNull String player) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Getting groups of player: " + player + ", on world " + world + ", server " + getServer()); User user = plugin.getUserManager().getByUsername(player); @@ -314,7 +314,7 @@ public class VaultPermissionHook extends Permission { @Override public String getPrimaryGroup(String world, @NonNull String player) { - world = WORLD_CORRECTION_FUNCTION.apply(world); + world = worldCorrectionFunction.apply(world); log("Getting primary group of player: " + player); final User user = plugin.getUserManager().getByUsername(player); diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeSenderFactory.java b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeSenderFactory.java index fb67e1fc9..26966a29f 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeSenderFactory.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeSenderFactory.java @@ -22,9 +22,9 @@ package me.lucko.luckperms.bungee; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.SenderFactory; import me.lucko.luckperms.common.constants.Constants; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.TextComponent; diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java b/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java index 24e4acc28..4a6135f0d 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java @@ -30,7 +30,6 @@ import me.lucko.luckperms.api.PlatformType; import me.lucko.luckperms.api.context.ContextSet; import me.lucko.luckperms.api.context.MutableContextSet; import me.lucko.luckperms.bungee.messaging.BungeeMessagingService; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.ApiHandler; import me.lucko.luckperms.common.api.ApiProvider; import me.lucko.luckperms.common.caching.handlers.CachedStateManager; @@ -38,7 +37,7 @@ import me.lucko.luckperms.common.calculators.CalculatorFactory; import me.lucko.luckperms.common.commands.CommandManager; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.config.ConfigKeys; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import me.lucko.luckperms.common.contexts.ContextManager; import me.lucko.luckperms.common.contexts.ServerCalculator; import me.lucko.luckperms.common.core.UuidCache; @@ -57,6 +56,8 @@ import me.lucko.luckperms.common.managers.impl.GenericTrackManager; import me.lucko.luckperms.common.managers.impl.GenericUserManager; import me.lucko.luckperms.common.messaging.InternalMessagingService; import me.lucko.luckperms.common.messaging.RedisMessaging; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; +import me.lucko.luckperms.common.plugin.LuckPermsScheduler; import me.lucko.luckperms.common.storage.Storage; import me.lucko.luckperms.common.storage.StorageFactory; import me.lucko.luckperms.common.storage.StorageType; @@ -73,22 +74,18 @@ import net.md_5.bungee.api.plugin.Plugin; import java.io.File; import java.io.InputStream; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Getter public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { private final Set ignoringLogs = ConcurrentHashMap.newKeySet(); - private final Set shutdownHooks = Collections.synchronizedSet(new HashSet<>()); - private Executor executor; - private LPConfiguration configuration; + private LuckPermsScheduler scheduler; + private LuckPermsConfiguration configuration; private UserManager userManager; private GroupManager groupManager; private TrackManager trackManager; @@ -109,13 +106,13 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { @Override public void onEnable() { - executor = r -> getProxy().getScheduler().runAsync(this, r); + scheduler = new LPBungeeScheduler(this); localeManager = new NoopLocaleManager(); senderFactory = new BungeeSenderFactory(this); log = new LoggerImpl(getConsoleSender()); LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this); - debugHandler = new DebugHandler(executor, getVersion()); - permissionCache = new PermissionCache(executor); + debugHandler = new DebugHandler(scheduler.getAsyncExecutor(), getVersion()); + permissionCache = new PermissionCache(scheduler.getAsyncExecutor()); getLog().info("Loading configuration..."); configuration = new BungeeConfig(this); @@ -214,23 +211,23 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { // schedule update tasks int mins = getConfiguration().get(ConfigKeys.SYNC_TIME); if (mins > 0) { - getProxy().getScheduler().schedule(this, new UpdateTask(this), mins, mins, TimeUnit.MINUTES); + long ticks = mins * 60 * 20; + scheduler.doAsyncRepeating(() -> updateTaskBuffer.request(), ticks); } + scheduler.doAsyncLater(() -> updateTaskBuffer.request(), 40L); // run an update instantly. updateTaskBuffer.requestDirectly(); // register tasks - getProxy().getScheduler().schedule(this, new ExpireTemporaryTask(this), 3L, 3L, TimeUnit.SECONDS); - getProxy().getScheduler().schedule(this, new CacheHousekeepingTask(this), 2L, 2L, TimeUnit.MINUTES); + scheduler.doAsyncRepeating(new ExpireTemporaryTask(this), 60L); + scheduler.doAsyncRepeating(new CacheHousekeepingTask(this), 2400L); getLog().info("Successfully loaded."); } @Override public void onDisable() { - shutdownHooks.forEach(Runnable::run); - getLog().info("Closing datastore..."); storage.shutdown(); @@ -252,7 +249,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { } @Override - public PlatformType getType() { + public PlatformType getServerType() { return PlatformType.BUNGEE; } @@ -267,8 +264,8 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { } @Override - public File getMainDir() { - return getDataFolder(); + public File getDataDirectory() { + return super.getDataFolder(); } @Override @@ -314,12 +311,12 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { } @Override - public boolean isOnline(UUID external) { + public boolean isPlayerOnline(UUID external) { return getProxy().getPlayer(external) != null; } @Override - public List getSenders() { + public List getOnlineSenders() { return getProxy().getPlayers().stream() .map(p -> getSenderFactory().wrap(p)) .collect(Collectors.toList()); @@ -360,54 +357,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { } @Override - public Object getPlugin(String name) { - return getProxy().getPluginManager().getPlugin(name); - } - - @Override - public Object getService(Class clazz) { - return null; - } - - @Override - public UUID getUUID(String playerName) { + public UUID getUuidFromUsername(String playerName) { return null; // Not needed on Bungee } - - @Override - public boolean isPluginLoaded(String name) { - return getProxy().getPluginManager().getPlugins().stream() - .anyMatch(p -> p.getDescription().getName().equalsIgnoreCase(name)); - } - - @Override - public void addShutdownHook(Runnable r) { - shutdownHooks.add(r); - } - - @Override - public void doAsync(Runnable r) { - getProxy().getScheduler().runAsync(this, r); - } - - @Override - public void doSync(Runnable r) { - doAsync(r); - } - - @Override - public Executor getSyncExecutor() { - return executor; - } - - @Override - public Executor getAsyncExecutor() { - return executor; - } - - @Override - public void doAsyncRepeating(Runnable r, long interval) { - long millis = interval * 50L; // convert from ticks to milliseconds - getProxy().getScheduler().schedule(this, r, millis, millis, TimeUnit.MILLISECONDS); - } } diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeeScheduler.java b/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeeScheduler.java new file mode 100644 index 000000000..f43a1d0dd --- /dev/null +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeeScheduler.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2016 Lucko (Luck) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.bungee; + +import me.lucko.luckperms.common.plugin.LuckPermsScheduler; + +import net.md_5.bungee.api.scheduler.ScheduledTask; + +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; + +public class LPBungeeScheduler implements LuckPermsScheduler { + private final LPBungeePlugin plugin; + + private Executor asyncExecutor; + private Set tasks = ConcurrentHashMap.newKeySet(); + + public LPBungeeScheduler(LPBungeePlugin plugin) { + this.plugin = plugin; + this.asyncExecutor = r -> plugin.getProxy().getScheduler().runAsync(plugin, r); + } + + @Override + public Executor getAsyncExecutor() { + return asyncExecutor; + } + + @Override + public Executor getSyncExecutor() { + return asyncExecutor; + } + + @Override + public void doAsync(Runnable r) { + asyncExecutor.execute(r); + } + + @Override + public void doSync(Runnable r) { + doAsync(r); + } + + @Override + public void doAsyncRepeating(Runnable r, long interval) { + long millis = interval * 50L; // convert from ticks to milliseconds + ScheduledTask task = plugin.getProxy().getScheduler().schedule(plugin, r, millis, millis, TimeUnit.MILLISECONDS); + tasks.add(task); + } + + @Override + public void doSyncRepeating(Runnable r, long interval) { + doAsyncRepeating(r, interval); + } + + @Override + public void doAsyncLater(Runnable r, long delay) { + long millis = delay * 50L; // convert from ticks to milliseconds + plugin.getProxy().getScheduler().schedule(plugin, r, millis, TimeUnit.MILLISECONDS); + } + + @Override + public void doSyncLater(Runnable r, long delay) { + doAsyncLater(r, delay); + } + + @Override + public void shutdown() { + tasks.forEach(ScheduledTask::cancel); + } +} diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/migration/MigrationBungeePerms.java b/bungee/src/main/java/me/lucko/luckperms/bungee/migration/MigrationBungeePerms.java index bc48f483f..7a3900053 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/migration/MigrationBungeePerms.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/migration/MigrationBungeePerms.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.bungee.migration; import me.lucko.luckperms.api.MetaUtils; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java b/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java index 937821f82..82e9a00e0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java @@ -46,7 +46,6 @@ import me.lucko.luckperms.api.context.ContextSet; import me.lucko.luckperms.api.context.IContextCalculator; import me.lucko.luckperms.api.event.LPEvent; import me.lucko.luckperms.api.event.LPListener; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.delegate.DatastoreDelegate; import me.lucko.luckperms.common.api.delegate.GroupDelegate; import me.lucko.luckperms.common.api.delegate.LPConfigurationDelegate; @@ -57,6 +56,7 @@ import me.lucko.luckperms.common.api.delegate.UserDelegate; import me.lucko.luckperms.common.api.delegate.UuidCacheDelegate; import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.UserIdentifier; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Optional; import java.util.Set; @@ -104,7 +104,7 @@ public class ApiProvider implements LuckPermsApi { @Override public PlatformType getPlatformType() { - return plugin.getType(); + return plugin.getServerType(); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegate/DatastoreDelegate.java b/common/src/main/java/me/lucko/luckperms/common/api/delegate/DatastoreDelegate.java index 79145fb25..07dd0f0c2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegate/DatastoreDelegate.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegate/DatastoreDelegate.java @@ -32,8 +32,8 @@ import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.Track; import me.lucko.luckperms.api.User; import me.lucko.luckperms.api.data.Callback; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.Storage; import java.util.Set; @@ -65,7 +65,7 @@ public class DatastoreDelegate implements Datastore { private void registerCallback(CompletableFuture fut, Callback c) { if (c != null) { - fut.thenAcceptAsync(Callback.convertToConsumer(c), plugin.getSyncExecutor()); + fut.thenAcceptAsync(Callback.convertToConsumer(c), plugin.getScheduler().getSyncExecutor()); } } @@ -105,7 +105,7 @@ public class DatastoreDelegate implements Datastore { @Override public void getLog(@NonNull Callback callback) { - master.force().getLog().thenAcceptAsync(log -> callback.onComplete(new LogDelegate(log)), plugin.getSyncExecutor()); + master.force().getLog().thenAcceptAsync(log -> callback.onComplete(new LogDelegate(log)), plugin.getScheduler().getSyncExecutor()); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegate/LPConfigurationDelegate.java b/common/src/main/java/me/lucko/luckperms/common/api/delegate/LPConfigurationDelegate.java index e7fe8408d..e1c6e73c2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegate/LPConfigurationDelegate.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegate/LPConfigurationDelegate.java @@ -28,15 +28,16 @@ import me.lucko.luckperms.api.LPConfiguration; import me.lucko.luckperms.api.data.DatastoreConfiguration; import me.lucko.luckperms.api.data.MySQLConfiguration; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import java.util.Map; /** - * Provides a link between {@link LPConfiguration} and {@link me.lucko.luckperms.common.config.LPConfiguration} + * Provides a link between {@link LPConfiguration} and {@link LuckPermsConfiguration} */ @AllArgsConstructor public class LPConfigurationDelegate implements LPConfiguration { - private final me.lucko.luckperms.common.config.LPConfiguration master; + private final LuckPermsConfiguration master; @Override public String getServer() { diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegate/StorageDelegate.java b/common/src/main/java/me/lucko/luckperms/common/api/delegate/StorageDelegate.java index c1778062d..b09ce613a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegate/StorageDelegate.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegate/StorageDelegate.java @@ -32,8 +32,8 @@ import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.Storage; import me.lucko.luckperms.api.Track; import me.lucko.luckperms.api.User; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.List; import java.util.Set; @@ -67,12 +67,12 @@ public class StorageDelegate implements Storage { @Override public Executor getSyncExecutor() { - return plugin.getSyncExecutor(); + return plugin.getScheduler().getSyncExecutor(); } @Override public Executor getAsyncExecutor() { - return plugin.getAsyncExecutor(); + return plugin.getScheduler().getAsyncExecutor(); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/CachedStateManager.java b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/CachedStateManager.java index 3a83e872e..d0f471b04 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/CachedStateManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/CachedStateManager.java @@ -27,8 +27,8 @@ import lombok.RequiredArgsConstructor; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.HashSet; import java.util.Set; diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/GroupReference.java b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/GroupReference.java index 717fc7f1d..656955d47 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/GroupReference.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/GroupReference.java @@ -27,9 +27,9 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.function.Consumer; diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/HolderReference.java b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/HolderReference.java index 7212dfa1f..f7e79691e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/HolderReference.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/HolderReference.java @@ -22,8 +22,8 @@ package me.lucko.luckperms.common.caching.handlers; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Identifiable; import java.util.function.Consumer; diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/UserReference.java b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/UserReference.java index 441dfd8e0..13bb83e9a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/handlers/UserReference.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/handlers/UserReference.java @@ -27,10 +27,10 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.UserIdentifier; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.function.Consumer; diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/MetaStackElement.java b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/MetaStackElement.java index 64f1cdfa8..15e88f847 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/MetaStackElement.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/MetaStackElement.java @@ -23,8 +23,8 @@ package me.lucko.luckperms.common.caching.stacking; import me.lucko.luckperms.api.LocalizedNode; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.Track; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Map; import java.util.Optional; diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/StackElementFactory.java b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/StackElementFactory.java index 12cabfe97..0cfc406ea 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/StackElementFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/StackElementFactory.java @@ -24,13 +24,13 @@ package me.lucko.luckperms.common.caching.stacking; import lombok.experimental.UtilityClass; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.caching.stacking.elements.HighestPriorityElement; import me.lucko.luckperms.common.caching.stacking.elements.HighestPriorityOwnElement; import me.lucko.luckperms.common.caching.stacking.elements.HighestPriorityTrackElement; import me.lucko.luckperms.common.caching.stacking.elements.LowestPriorityElement; import me.lucko.luckperms.common.caching.stacking.elements.LowestPriorityOwnElement; import me.lucko.luckperms.common.caching.stacking.elements.LowestPriorityTrackElement; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ImmutableCollectors; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/HighestPriorityTrackElement.java b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/HighestPriorityTrackElement.java index 799b75b71..3773b5666 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/HighestPriorityTrackElement.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/HighestPriorityTrackElement.java @@ -25,8 +25,8 @@ package me.lucko.luckperms.common.caching.stacking.elements; import lombok.RequiredArgsConstructor; import me.lucko.luckperms.api.LocalizedNode; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.caching.stacking.MetaStackElement; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Map; import java.util.Optional; diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/LowestPriorityTrackElement.java b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/LowestPriorityTrackElement.java index 8ff7d3677..efaeb348d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/LowestPriorityTrackElement.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/stacking/elements/LowestPriorityTrackElement.java @@ -25,8 +25,8 @@ package me.lucko.luckperms.common.caching.stacking.elements; import lombok.RequiredArgsConstructor; import me.lucko.luckperms.api.LocalizedNode; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.caching.stacking.MetaStackElement; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Map; import java.util.Optional; diff --git a/common/src/main/java/me/lucko/luckperms/common/calculators/PermissionCalculator.java b/common/src/main/java/me/lucko/luckperms/common/calculators/PermissionCalculator.java index c79e19c3c..4432ca037 100644 --- a/common/src/main/java/me/lucko/luckperms/common/calculators/PermissionCalculator.java +++ b/common/src/main/java/me/lucko/luckperms/common/calculators/PermissionCalculator.java @@ -29,7 +29,7 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import me.lucko.luckperms.api.Tristate; -import me.lucko.luckperms.common.LuckPermsPlugin; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.List; import java.util.Map; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/Command.java b/common/src/main/java/me/lucko/luckperms/common/commands/Command.java index b8d075e19..a05c029f4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/Command.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/Command.java @@ -26,9 +26,9 @@ import lombok.Getter; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Collections; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java index 2246c20e7..b77fff944 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java @@ -26,7 +26,6 @@ import lombok.Getter; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.group.CreateGroup; import me.lucko.luckperms.common.commands.group.DeleteGroup; import me.lucko.luckperms.common.commands.group.GroupMainCommand; @@ -53,6 +52,7 @@ import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import io.github.mkremins.fanciful.ChatColor; import io.github.mkremins.fanciful.FancyMessage; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java index 6b23ec39f..3598c1f62 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java @@ -24,10 +24,10 @@ package me.lucko.luckperms.common.commands; import lombok.Getter; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/SingleCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/SingleCommand.java index f9204443c..1eba4e7c1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/SingleCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/SingleCommand.java @@ -24,10 +24,10 @@ package me.lucko.luckperms.common.commands; import lombok.Getter; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.List; import java.util.function.Predicate; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java index a91a7fa41..68c42e643 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java @@ -26,7 +26,6 @@ import lombok.Getter; import com.google.common.base.Splitter; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.PermissionCache; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedMainCommand.java index 3f4771014..32ded48b4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedMainCommand.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -31,6 +30,7 @@ import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedSubCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedSubCommand.java index 6babb889a..bfaba2576 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedSubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/SharedSubCommand.java @@ -27,7 +27,6 @@ import lombok.Getter; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -38,6 +37,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Collections; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddPrefix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddPrefix.java index cd2718421..4b3dda7b7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddPrefix.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddSuffix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddSuffix.java index 44be485b4..c345c30ab 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddSuffix.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempPrefix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempPrefix.java index 3d657a9b2..6c6628608 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempPrefix.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempSuffix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempSuffix.java index ab12d3863..9dc73dd09 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempSuffix.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java index 0e4bc7420..f0be099e4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.meta; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java index b890f3ee3..1e7253772 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.Contexts; import me.lucko.luckperms.api.LocalizedNode; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.generic.SharedSubCommand; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ExtractedContexts; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemovePrefix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemovePrefix.java index e42fb4383..ca00ab537 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemovePrefix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemovePrefix.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveSuffix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveSuffix.java index d68cd8587..1148e5288 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveSuffix.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempPrefix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempPrefix.java index 0c99e81e8..2046a6ea2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempPrefix.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempSuffix.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempSuffix.java index 112f05836..27afecdef 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempSuffix.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java index 023a5096b..a960b7215 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java index 5e74d3660..febbd51f4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.generic.meta; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java index 58324b326..e12020af1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.meta; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java index 5b14807f4..e45623485 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.meta; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java index 9093a53a4..6aa49a06f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.generic.other; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java index 3d4a079d4..0f294d20c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.parent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java index effa2ba7a..fe5edb77c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.parent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java index 618e72954..1f8d5fd24 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.parent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java index a0e3b8dc8..dc4f7dc62 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.parent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.generic.SharedSubCommand; @@ -31,6 +30,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java index fb12f4f31..f6cb1bc85 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.parent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java index 77b72e583..7f3594579 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.parent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java index 7e8d16eac..dc0d47a16 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.parent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java index 64a3509b7..b5b61ff67 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.permission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java index 78b902dac..331fa6aa9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.permission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.InheritanceInfo; import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java index 7c9144b4a..221430be8 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.permission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import io.github.mkremins.fanciful.FancyMessage; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java index 9efaeacc2..0828afb3b 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.permission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java index 654563da2..f56100b10 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.permission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java index 971355fa0..7f73c05e4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.permission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java index 7eebc2364..d1740493e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.generic.permission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java index b8ba7e242..845f628f6 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.group; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; @@ -30,6 +29,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java index 3018d006b..af12223cc 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.group; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupBulkChange.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupBulkChange.java index 0d5dee6ae..ff44a98d0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupBulkChange.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupBulkChange.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.group; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.model.Group; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClear.java index 8f3e4bc43..6ee8545b1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClear.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.group; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java index 0b9b6e714..a68d02e6d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.group; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java index 842733acc..bf72faf2d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.group; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupMainCommand.java index f505ec47e..5937f2970 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupMainCommand.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.group; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Command; import me.lucko.luckperms.common.commands.MainCommand; import me.lucko.luckperms.common.commands.generic.meta.CommandMeta; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.commands.generic.permission.CommandPermission; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.core.model.Group; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.ArrayList; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java index f4f6bbc4f..fbc92d5cc 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.group; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java index 8091be41e..b33fc75f1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.group; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.model.Group; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java index 14360f87f..2b935562f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.group; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; import me.lucko.luckperms.common.commands.sender.Sender; @@ -30,6 +29,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogMainCommand.java index 79ced85b1..324e7d01a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogMainCommand.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.log; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Command; import me.lucko.luckperms.common.commands.MainCommand; import me.lucko.luckperms.common.commands.log.subcommands.LogExport; @@ -37,6 +36,7 @@ import me.lucko.luckperms.common.commands.log.subcommands.LogUserHistory; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Collections; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogExport.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogExport.java index d23799c1a..0e6c770d5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogExport.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogExport.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.log.subcommands; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.io.File; @@ -50,7 +50,7 @@ public class LogExport extends SubCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, List args, String label) throws CommandException { - File f = new File(plugin.getMainDir(), args.get(0)); + File f = new File(plugin.getDataDirectory(), args.get(0)); if (f.exists()) { Message.LOG_EXPORT_ALREADY_EXISTS.send(sender, f.getAbsolutePath()); return CommandResult.INVALID_ARGS; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogGroupHistory.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogGroupHistory.java index f7fcb606d..e1fed3cb7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogGroupHistory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogGroupHistory.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.log.subcommands; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogNotify.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogNotify.java index bf1d75c06..9f0835175 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogNotify.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogNotify.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.log.subcommands; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -31,6 +30,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogRecent.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogRecent.java index ee62b9155..c723cd8f0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogRecent.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogRecent.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.log.subcommands; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Patterns; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogSearch.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogSearch.java index 1f7fb5a86..096db47d9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogSearch.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogSearch.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.log.subcommands; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogTrackHistory.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogTrackHistory.java index 348792b1d..1fd596f17 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogTrackHistory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogTrackHistory.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.log.subcommands; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogUserHistory.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogUserHistory.java index 92a475010..2e35d0048 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogUserHistory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/subcommands/LogUserHistory.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.log.subcommands; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Patterns; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java index 088dc6014..3f511b511 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.migration; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Command; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -30,6 +29,7 @@ import me.lucko.luckperms.common.commands.MainCommand; import me.lucko.luckperms.common.commands.SubCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java index 2c04abd14..86537a9ae 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.misc; import me.lucko.luckperms.api.Tristate; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.caching.UserCache; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ExportCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ExportCommand.java index b6b0f1a6f..b3f586e90 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ExportCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ExportCommand.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.misc; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.Storage; import me.lucko.luckperms.common.utils.Predicates; @@ -112,7 +112,7 @@ public class ExportCommand extends SingleCommand { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { Consumer log = s -> Message.EXPORT_LOG.send(sender, s); - File f = new File(plugin.getMainDir(), args.get(0)); + File f = new File(plugin.getDataDirectory(), args.get(0)); if (f.exists()) { Message.LOG_EXPORT_ALREADY_EXISTS.send(sender, f.getAbsolutePath()); return CommandResult.INVALID_ARGS; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ImportCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ImportCommand.java index 209f605ea..9e1a53d01 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ImportCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ImportCommand.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.misc; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; @@ -30,6 +29,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.Importer; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.io.File; @@ -56,7 +56,7 @@ public class ImportCommand extends SingleCommand { Importer importer = plugin.getImporter(); - File f = new File(plugin.getMainDir(), args.get(0)); + File f = new File(plugin.getDataDirectory(), args.get(0)); if (!f.exists()) { Message.IMPORT_LOG_DOESNT_EXIST.send(sender, f.getAbsolutePath()); return CommandResult.INVALID_ARGS; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java index 3ee446ed5..ad78fae23 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java @@ -22,15 +22,15 @@ package me.lucko.luckperms.common.commands.misc; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.config.ConfigKeys; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.LinkedHashMap; @@ -59,10 +59,10 @@ public class InfoCommand extends SingleCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { - final LPConfiguration c = plugin.getConfiguration(); + final LuckPermsConfiguration c = plugin.getConfiguration(); Message.INFO.send(sender, plugin.getVersion(), - plugin.getType().getFriendlyName(), + plugin.getServerType().getFriendlyName(), plugin.getStorage().getName(), c.get(ConfigKeys.SERVER), c.get(ConfigKeys.SYNC_TIME), diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/NetworkSyncCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/NetworkSyncCommand.java index b5b69e7cc..ecf6a4281 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/NetworkSyncCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/NetworkSyncCommand.java @@ -22,13 +22,13 @@ package me.lucko.luckperms.common.commands.misc; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.messaging.InternalMessagingService; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ReloadConfigCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ReloadConfigCommand.java index 6830d0b2a..c6061ff07 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ReloadConfigCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ReloadConfigCommand.java @@ -22,13 +22,13 @@ package me.lucko.luckperms.common.commands.misc; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/SearchCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/SearchCommand.java index 46d84d541..70a45065c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/SearchCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/SearchCommand.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.misc; import me.lucko.luckperms.api.HeldPermission; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import io.github.mkremins.fanciful.FancyMessage; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/SyncCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/SyncCommand.java index 72fa0d693..50984e9fb 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/SyncCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/SyncCommand.java @@ -22,12 +22,12 @@ package me.lucko.luckperms.common.commands.misc; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java index 2be0f71f8..3b3d98790 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.misc; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; @@ -30,6 +29,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.debug.DebugListener; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import io.github.mkremins.fanciful.ChatColor; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/sender/AbstractSender.java b/common/src/main/java/me/lucko/luckperms/common/commands/sender/AbstractSender.java index 997f30f28..83d4f3652 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/sender/AbstractSender.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/sender/AbstractSender.java @@ -24,9 +24,9 @@ package me.lucko.luckperms.common.commands.sender; import lombok.Getter; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import io.github.mkremins.fanciful.FancyMessage; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/sender/Sender.java b/common/src/main/java/me/lucko/luckperms/common/commands/sender/Sender.java index 50b93eb8d..99fc648ad 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/sender/Sender.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/sender/Sender.java @@ -22,9 +22,9 @@ package me.lucko.luckperms.common.commands.sender; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import io.github.mkremins.fanciful.FancyMessage; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/sender/SenderFactory.java b/common/src/main/java/me/lucko/luckperms/common/commands/sender/SenderFactory.java index c70204784..4362d42c8 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/sender/SenderFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/sender/SenderFactory.java @@ -24,7 +24,7 @@ package me.lucko.luckperms.common.commands.sender; import lombok.RequiredArgsConstructor; -import me.lucko.luckperms.common.LuckPermsPlugin; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import io.github.mkremins.fanciful.FancyMessage; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java index d3fd38896..57c754430 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; @@ -30,6 +29,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java index 0aaef62d0..24b487145 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; @@ -31,6 +30,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/ListTracks.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/ListTracks.java index 4f221c020..40619f01e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/ListTracks.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/ListTracks.java @@ -22,13 +22,13 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SingleCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java index 4590d3898..c6b277a0f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClear.java index fc0d0681d..b02229a87 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClear.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -31,6 +30,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java index b2ef11e87..3801ce195 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInfo.java index 0ec79f3de..1a4a6c018 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInfo.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -31,6 +30,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Track; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java index f7dce66ba..7bbd1ec17 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackMainCommand.java index 8115418cd..443654e21 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackMainCommand.java @@ -24,12 +24,12 @@ package me.lucko.luckperms.common.commands.track; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Command; import me.lucko.luckperms.common.commands.MainCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.core.model.Track; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.ArrayList; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java index b875094a0..9d17458ac 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java index 0501a22ea..80f811877 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.track; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserBulkChange.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserBulkChange.java index 1243d9fc7..799b9329a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserBulkChange.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserBulkChange.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.user; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectLacksException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClear.java index b18d9f6e4..b2897841c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClear.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.user; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -34,6 +33,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java index e90420635..4f0f9f13d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java @@ -26,7 +26,6 @@ import com.google.common.base.Objects; import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.event.events.UserDemoteEvent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.delegate.TrackDelegate; import me.lucko.luckperms.common.api.delegate.UserDelegate; import me.lucko.luckperms.common.commands.Arg; @@ -44,6 +43,7 @@ import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserGetUUID.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserGetUUID.java index 04ba818e3..11f769a74 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserGetUUID.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserGetUUID.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.user; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -30,6 +29,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserInfo.java index 9e7f350cb..867f018a0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserInfo.java @@ -26,7 +26,6 @@ import me.lucko.luckperms.api.Contexts; import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.caching.MetaData; import me.lucko.luckperms.api.caching.UserData; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.Predicates; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserMainCommand.java index a379a310d..8465e1453 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserMainCommand.java @@ -24,7 +24,6 @@ package me.lucko.luckperms.common.commands.user; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Command; import me.lucko.luckperms.common.commands.MainCommand; import me.lucko.luckperms.common.commands.generic.meta.CommandMeta; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Patterns; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.List; import java.util.UUID; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java index 9bb16bc6e..f7784093f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java @@ -26,7 +26,6 @@ import com.google.common.base.Objects; import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.event.events.UserPromoteEvent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.delegate.TrackDelegate; import me.lucko.luckperms.common.api.delegate.UserDelegate; import me.lucko.luckperms.common.commands.Arg; @@ -44,6 +43,7 @@ import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserSwitchPrimaryGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserSwitchPrimaryGroup.java index 6b5f1a827..4b9a2aa52 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserSwitchPrimaryGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserSwitchPrimaryGroup.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.user; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.LogEntry; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditGroup.java index 204b0930a..293c1e4f9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditGroup.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.usersbulkedit; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.Storage; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditPermission.java b/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditPermission.java index fef02fab4..298ac8576 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditPermission.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/BulkEditPermission.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands.usersbulkedit; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.Storage; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/UsersBulkEditMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/UsersBulkEditMainCommand.java index 28bb16a40..e3bf9739a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/UsersBulkEditMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/usersbulkedit/UsersBulkEditMainCommand.java @@ -24,10 +24,10 @@ package me.lucko.luckperms.common.commands.usersbulkedit; import com.google.common.collect.ImmutableList; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Command; import me.lucko.luckperms.common.commands.MainCommand; import me.lucko.luckperms.common.commands.sender.Sender; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.Storage; import java.util.Collections; diff --git a/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java b/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java index 1e65bec40..c213046a1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java @@ -33,7 +33,7 @@ import java.util.Set; import java.util.stream.Collectors; @SuppressWarnings("unchecked") -public abstract class AbstractConfiguration implements LPConfiguration { +public abstract class AbstractConfiguration implements LuckPermsConfiguration { private final LoadingCache, Optional> cache = CacheBuilder.newBuilder() .build(new CacheLoader, Optional>() { @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKey.java b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKey.java index 4ad6d3520..bcfa1807c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKey.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKey.java @@ -24,6 +24,6 @@ package me.lucko.luckperms.common.config; public interface ConfigKey { - T get(LPConfiguration config); + T get(LuckPermsConfiguration config); } diff --git a/common/src/main/java/me/lucko/luckperms/common/config/LPConfiguration.java b/common/src/main/java/me/lucko/luckperms/common/config/LuckPermsConfiguration.java similarity index 94% rename from common/src/main/java/me/lucko/luckperms/common/config/LPConfiguration.java rename to common/src/main/java/me/lucko/luckperms/common/config/LuckPermsConfiguration.java index addd97ab5..2b897de8d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/LPConfiguration.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/LuckPermsConfiguration.java @@ -22,12 +22,12 @@ package me.lucko.luckperms.common.config; -import me.lucko.luckperms.common.LuckPermsPlugin; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.List; import java.util.Map; -public interface LPConfiguration { +public interface LuckPermsConfiguration { LuckPermsPlugin getPlugin(); diff --git a/common/src/main/java/me/lucko/luckperms/common/config/keys/AbstractKey.java b/common/src/main/java/me/lucko/luckperms/common/config/keys/AbstractKey.java index 509d2a0d6..7bf6a55b2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/keys/AbstractKey.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/keys/AbstractKey.java @@ -25,16 +25,16 @@ package me.lucko.luckperms.common.config.keys; import lombok.AllArgsConstructor; import me.lucko.luckperms.common.config.ConfigKey; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import java.util.function.Function; @AllArgsConstructor(staticName = "of") public class AbstractKey implements ConfigKey { - private final Function function; + private final Function function; @Override - public T get(LPConfiguration config) { + public T get(LuckPermsConfiguration config) { return function.apply(config); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/config/keys/BooleanKey.java b/common/src/main/java/me/lucko/luckperms/common/config/keys/BooleanKey.java index 28fa770e7..929193948 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/keys/BooleanKey.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/keys/BooleanKey.java @@ -25,7 +25,7 @@ package me.lucko.luckperms.common.config.keys; import lombok.AllArgsConstructor; import me.lucko.luckperms.common.config.ConfigKey; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; @AllArgsConstructor(staticName = "of") public class BooleanKey implements ConfigKey { @@ -33,7 +33,7 @@ public class BooleanKey implements ConfigKey { private final boolean def; @Override - public Boolean get(LPConfiguration config) { + public Boolean get(LuckPermsConfiguration config) { return config.getBoolean(path, def); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/config/keys/IntegerKey.java b/common/src/main/java/me/lucko/luckperms/common/config/keys/IntegerKey.java index b84cbbbbd..f58924f20 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/keys/IntegerKey.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/keys/IntegerKey.java @@ -25,7 +25,7 @@ package me.lucko.luckperms.common.config.keys; import lombok.AllArgsConstructor; import me.lucko.luckperms.common.config.ConfigKey; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; @AllArgsConstructor(staticName = "of") public class IntegerKey implements ConfigKey { @@ -33,7 +33,7 @@ public class IntegerKey implements ConfigKey { private final int def; @Override - public Integer get(LPConfiguration config) { + public Integer get(LuckPermsConfiguration config) { return config.getInt(path, def); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/config/keys/MapKey.java b/common/src/main/java/me/lucko/luckperms/common/config/keys/MapKey.java index 41391e50c..17e9929bd 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/keys/MapKey.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/keys/MapKey.java @@ -27,7 +27,7 @@ import lombok.AllArgsConstructor; import com.google.common.collect.ImmutableMap; import me.lucko.luckperms.common.config.ConfigKey; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import java.util.Map; @@ -36,7 +36,7 @@ public class MapKey implements ConfigKey> { private final String path; @Override - public Map get(LPConfiguration config) { + public Map get(LuckPermsConfiguration config) { return ImmutableMap.copyOf(config.getMap(path, ImmutableMap.of())); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/config/keys/StaticKey.java b/common/src/main/java/me/lucko/luckperms/common/config/keys/StaticKey.java index b64a0ae9a..c9fe451ab 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/keys/StaticKey.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/keys/StaticKey.java @@ -25,14 +25,14 @@ package me.lucko.luckperms.common.config.keys; import lombok.AllArgsConstructor; import me.lucko.luckperms.common.config.ConfigKey; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; @AllArgsConstructor(staticName = "of") public class StaticKey implements ConfigKey { private final T val; @Override - public T get(LPConfiguration config) { + public T get(LuckPermsConfiguration config) { return val; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/config/keys/StringKey.java b/common/src/main/java/me/lucko/luckperms/common/config/keys/StringKey.java index 65d6a7b63..ac4957ab1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/keys/StringKey.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/keys/StringKey.java @@ -25,7 +25,7 @@ package me.lucko.luckperms.common.config.keys; import lombok.AllArgsConstructor; import me.lucko.luckperms.common.config.ConfigKey; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; @AllArgsConstructor(staticName = "of") public class StringKey implements ConfigKey { @@ -33,7 +33,7 @@ public class StringKey implements ConfigKey { private final String def; @Override - public String get(LPConfiguration config) { + public String get(LuckPermsConfiguration config) { return config.getString(path, def); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/contexts/ServerCalculator.java b/common/src/main/java/me/lucko/luckperms/common/contexts/ServerCalculator.java index 82e1daad4..e66623dd4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/contexts/ServerCalculator.java +++ b/common/src/main/java/me/lucko/luckperms/common/contexts/ServerCalculator.java @@ -29,13 +29,13 @@ import com.google.common.collect.Maps; import me.lucko.luckperms.api.context.ContextCalculator; import me.lucko.luckperms.api.context.MutableContextSet; import me.lucko.luckperms.common.config.ConfigKeys; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import java.util.Map; @AllArgsConstructor public class ServerCalculator extends ContextCalculator { - private final LPConfiguration config; + private final LuckPermsConfiguration config; @Override public MutableContextSet giveApplicableContext(T subject, MutableContextSet accumulator) { diff --git a/common/src/main/java/me/lucko/luckperms/common/core/UuidCache.java b/common/src/main/java/me/lucko/luckperms/common/core/UuidCache.java index 009a923c9..82acce200 100644 --- a/common/src/main/java/me/lucko/luckperms/common/core/UuidCache.java +++ b/common/src/main/java/me/lucko/luckperms/common/core/UuidCache.java @@ -28,8 +28,8 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Maps; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.UUID; diff --git a/common/src/main/java/me/lucko/luckperms/common/core/model/Group.java b/common/src/main/java/me/lucko/luckperms/common/core/model/Group.java index 4929001fe..5dc376729 100644 --- a/common/src/main/java/me/lucko/luckperms/common/core/model/Group.java +++ b/common/src/main/java/me/lucko/luckperms/common/core/model/Group.java @@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.caching.handlers.GroupReference; import me.lucko.luckperms.common.caching.handlers.HolderReference; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Identifiable; @ToString(of = {"name"}) diff --git a/common/src/main/java/me/lucko/luckperms/common/core/model/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/core/model/PermissionHolder.java index 42b8e7720..e5b820823 100644 --- a/common/src/main/java/me/lucko/luckperms/common/core/model/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/core/model/PermissionHolder.java @@ -44,7 +44,6 @@ import me.lucko.luckperms.api.event.events.GroupRemoveEvent; import me.lucko.luckperms.api.event.events.PermissionNodeExpireEvent; import me.lucko.luckperms.api.event.events.PermissionNodeSetEvent; import me.lucko.luckperms.api.event.events.PermissionNodeUnsetEvent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.delegate.GroupDelegate; import me.lucko.luckperms.common.api.delegate.PermissionHolderDelegate; import me.lucko.luckperms.common.caching.MetaHolder; @@ -59,6 +58,7 @@ import me.lucko.luckperms.common.core.InheritanceInfo; import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.PriorityComparator; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Cache; import me.lucko.luckperms.common.utils.ExtractedContexts; import me.lucko.luckperms.common.utils.ImmutableLocalizedNode; diff --git a/common/src/main/java/me/lucko/luckperms/common/core/model/User.java b/common/src/main/java/me/lucko/luckperms/common/core/model/User.java index 06460a374..50d5a3446 100644 --- a/common/src/main/java/me/lucko/luckperms/common/core/model/User.java +++ b/common/src/main/java/me/lucko/luckperms/common/core/model/User.java @@ -29,12 +29,12 @@ import lombok.ToString; import me.lucko.luckperms.api.caching.UserData; import me.lucko.luckperms.api.event.events.UserPermissionRefreshEvent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.delegate.UserDelegate; import me.lucko.luckperms.common.caching.UserCache; import me.lucko.luckperms.common.caching.handlers.HolderReference; import me.lucko.luckperms.common.caching.handlers.UserReference; import me.lucko.luckperms.common.core.UserIdentifier; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.BufferedRequest; import me.lucko.luckperms.common.utils.Identifiable; diff --git a/common/src/main/java/me/lucko/luckperms/common/data/Importer.java b/common/src/main/java/me/lucko/luckperms/common/data/Importer.java index 5c06fa0d5..e60c38240 100644 --- a/common/src/main/java/me/lucko/luckperms/common/data/Importer.java +++ b/common/src/main/java/me/lucko/luckperms/common/data/Importer.java @@ -28,7 +28,6 @@ import lombok.Setter; import com.google.common.base.Splitter; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandManager; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.sender.Sender; @@ -36,6 +35,7 @@ import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import io.github.mkremins.fanciful.FancyMessage; diff --git a/common/src/main/java/me/lucko/luckperms/common/data/LogEntry.java b/common/src/main/java/me/lucko/luckperms/common/data/LogEntry.java index e74ca6352..d2ebfa65c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/data/LogEntry.java +++ b/common/src/main/java/me/lucko/luckperms/common/data/LogEntry.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.data; import me.lucko.luckperms.api.event.events.LogNotifyEvent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.constants.Message; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.PermissionHolder; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.List; @@ -58,7 +58,7 @@ public class LogEntry extends me.lucko.luckperms.api.LogEntry { final String msg = super.getFormatted(); - List senders = plugin.getSenders(); + List senders = plugin.getOnlineSenders(); senders.add(plugin.getConsoleSender()); if (sender == null) { diff --git a/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java b/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java index 9a113fa91..e22bf61b0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java @@ -29,8 +29,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import me.lucko.luckperms.api.PlatformType; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.StorageType; import java.io.File; @@ -80,7 +80,7 @@ public class DependencyManager { plugin.getLog().info("Identified the following dependencies: " + dependencies.toString()); - File data = new File(plugin.getDataFolder(), "lib"); + File data = new File(plugin.getDataDirectory(), "lib"); data.mkdirs(); // Download files. @@ -131,7 +131,7 @@ public class DependencyManager { private static void loadJar(LuckPermsPlugin plugin, File file, String baseClass) throws Exception { URLClassLoader classLoader = (URLClassLoader) plugin.getClass().getClassLoader(); - if (plugin.getType() != PlatformType.SPONGE && !plugin.getServerName().equals("KCauldron")) { + if (plugin.getServerType() != PlatformType.SPONGE && !plugin.getServerName().equals("KCauldron")) { classLoader = (URLClassLoader) classLoader.getParent(); } diff --git a/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericGroupManager.java b/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericGroupManager.java index 72fb19e2c..e8469771c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericGroupManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericGroupManager.java @@ -24,10 +24,10 @@ package me.lucko.luckperms.common.managers.impl; import lombok.RequiredArgsConstructor; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.managers.AbstractManager; import me.lucko.luckperms.common.managers.GroupManager; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; @RequiredArgsConstructor public class GenericGroupManager extends AbstractManager implements GroupManager { diff --git a/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericUserManager.java b/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericUserManager.java index a0666b7e1..51c7154a9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericUserManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/managers/impl/GenericUserManager.java @@ -25,11 +25,11 @@ package me.lucko.luckperms.common.managers.impl; import lombok.RequiredArgsConstructor; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.UserIdentifier; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.managers.AbstractManager; import me.lucko.luckperms.common.managers.UserManager; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import java.util.Set; @@ -130,7 +130,7 @@ public class GenericUserManager extends AbstractManager im @Override public void cleanup(User user) { - if (!plugin.isOnline(plugin.getUuidCache().getExternalUUID(user.getUuid()))) { + if (!plugin.isPlayerOnline(plugin.getUuidCache().getExternalUUID(user.getUuid()))) { unload(user); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/messaging/AbstractMessagingService.java b/common/src/main/java/me/lucko/luckperms/common/messaging/AbstractMessagingService.java index be0a82e3c..9f18f77fa 100644 --- a/common/src/main/java/me/lucko/luckperms/common/messaging/AbstractMessagingService.java +++ b/common/src/main/java/me/lucko/luckperms/common/messaging/AbstractMessagingService.java @@ -25,7 +25,7 @@ package me.lucko.luckperms.common.messaging; import lombok.Getter; import lombok.RequiredArgsConstructor; -import me.lucko.luckperms.common.LuckPermsPlugin; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.Collections; import java.util.HashSet; diff --git a/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java b/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java index 24b4b9cd9..d9fb5597f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java +++ b/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java @@ -24,7 +24,7 @@ package me.lucko.luckperms.common.messaging; import lombok.RequiredArgsConstructor; -import me.lucko.luckperms.common.LuckPermsPlugin; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; diff --git a/common/src/main/java/me/lucko/luckperms/common/LuckPermsPlugin.java b/common/src/main/java/me/lucko/luckperms/common/plugin/LuckPermsPlugin.java similarity index 84% rename from common/src/main/java/me/lucko/luckperms/common/LuckPermsPlugin.java rename to common/src/main/java/me/lucko/luckperms/common/plugin/LuckPermsPlugin.java index 0ba9ca570..4690fcb14 100644 --- a/common/src/main/java/me/lucko/luckperms/common/LuckPermsPlugin.java +++ b/common/src/main/java/me/lucko/luckperms/common/plugin/LuckPermsPlugin.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common; +package me.lucko.luckperms.common.plugin; import me.lucko.luckperms.api.Contexts; import me.lucko.luckperms.api.Logger; @@ -31,7 +31,7 @@ import me.lucko.luckperms.common.calculators.CalculatorFactory; import me.lucko.luckperms.common.commands.BaseCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.contexts.ContextManager; import me.lucko.luckperms.common.core.UuidCache; @@ -54,7 +54,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Set; import java.util.UUID; -import java.util.concurrent.Executor; /** * Main internal interface for LuckPerms plugins, providing the base for abstraction throughout the project. @@ -89,7 +88,7 @@ public interface LuckPermsPlugin { * * @return the plugin config */ - LPConfiguration getConfiguration(); + LuckPermsConfiguration getConfiguration(); /** * Gets the primary data storage instance. This is likely to be wrapped with extra layers for caching, etc. @@ -177,30 +176,19 @@ public interface LuckPermsPlugin { PermissionCache getPermissionCache(); /** - * Execute a runnable asynchronously + * Gets the LuckPerms Scheduler instance * - * @param r the task to run + * @return the scheduler */ - void doAsync(Runnable r); + LuckPermsScheduler getScheduler(); - /** - * Execute a runnable synchronously - * - * @param r the task to run - */ - void doSync(Runnable r); + default void doAsync(Runnable r) { + getScheduler().doAsync(r); + } - Executor getSyncExecutor(); - - Executor getAsyncExecutor(); - - /** - * Execute a runnable asynchronously on a loop - * - * @param r the task to run - * @param interval the time between runs in ticks - */ - void doAsyncRepeating(Runnable r, long interval); + default void doSync(Runnable r) { + getScheduler().doSync(r); + } /** * Gets a string of the plugin's version @@ -214,7 +202,7 @@ public interface LuckPermsPlugin { * * @return the platform type */ - PlatformType getType(); + PlatformType getServerType(); /** * Gets the name or "brand" of the running platform @@ -228,19 +216,27 @@ public interface LuckPermsPlugin { */ String getServerVersion(); - /** - * Gets the plugins main directory - * - * @return the main plugin directory - */ - File getMainDir(); - /** * Gets the plugins main data storage directory * + *

Bukkit: /root/plugins/LuckPerms

+ *

Bungee: /root/plugins/LuckPerms

+ *

Sponge: /root/luckperms/

+ * * @return the platforms data folder */ - File getDataFolder(); + File getDataDirectory(); + + /** + * Gets the plugins config directory. + * + *

This is the same as {@link #getDataDirectory()} on Bukkit/Bungee, but different on Sponge.

+ * + * @return the platforms config folder + */ + default File getConfigDirectory() { + return getDataDirectory(); + } /** * Gets a bundled resource file from the jar @@ -258,7 +254,7 @@ public interface LuckPermsPlugin { */ default Message getPlayerStatus(UUID uuid) { UUID external = getUuidCache().getExternalUUID(uuid); - return isOnline(external) ? Message.PLAYER_ONLINE : Message.PLAYER_OFFLINE; + return isPlayerOnline(external) ? Message.PLAYER_ONLINE : Message.PLAYER_OFFLINE; } /** @@ -305,14 +301,14 @@ public interface LuckPermsPlugin { * @param external the users external uuid * @return true if the user is online */ - boolean isOnline(UUID external); + boolean isPlayerOnline(UUID external); /** * Gets a list of online Senders on the platform * * @return a {@link List} of senders online on the platform */ - List getSenders(); + List getOnlineSenders(); /** * Gets the console. @@ -349,37 +345,13 @@ public interface LuckPermsPlugin { */ Set getIgnoringLogs(); - /** - * Gets a loaded plugins instance from the platform - * - * @param name the name of the plugin - * @return a plugin instance - */ - Object getPlugin(String name); - - /** - * Gets a provided service from the platform. - * - * @param clazz the class of the service - * @return the service instance, if it is provided for - */ - Object getService(Class clazz); - /** * Gets the UUID of a player. Used as a backup for migration * * @param playerName the players name * @return a uuid if found, or null if not */ - UUID getUUID(String playerName); - - /** - * Checks if a plugin is loaded on the platform - * - * @param name the name of the plugin - * @return true if the plugin is loaded - */ - boolean isPluginLoaded(String name); + UUID getUuidFromUsername(String playerName); /** * Gets the update task buffer of the platform, used for scheduling and running update tasks. @@ -388,12 +360,6 @@ public interface LuckPermsPlugin { */ BufferedRequest getUpdateTaskBuffer(); - /** - * Adds a runnable to be called when the plugin disables - * @param r the runnable to run - */ - void addShutdownHook(Runnable r); - /** * Called at the end of the sync task. */ @@ -415,7 +381,7 @@ public interface LuckPermsPlugin { sender.sendMessage(Util.color("&b | | | / ` |__/ &3|__) |__ |__) |\\/| /__` ")); sender.sendMessage(Util.color("&b |___ \\__/ \\__, | \\ &3| |___ | \\ | | .__/ ")); sender.sendMessage(Util.color(" ")); - sender.sendMessage(Util.color("&2 Loading version &bv" + plugin.getVersion() + "&2 on " + plugin.getType().getFriendlyName() + " - " + plugin.getServerName())); + sender.sendMessage(Util.color("&2 Loading version &bv" + plugin.getVersion() + "&2 on " + plugin.getServerType().getFriendlyName() + " - " + plugin.getServerName())); sender.sendMessage(Util.color(" ")); } diff --git a/common/src/main/java/me/lucko/luckperms/common/plugin/LuckPermsScheduler.java b/common/src/main/java/me/lucko/luckperms/common/plugin/LuckPermsScheduler.java new file mode 100644 index 000000000..c4aadbb35 --- /dev/null +++ b/common/src/main/java/me/lucko/luckperms/common/plugin/LuckPermsScheduler.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Lucko (Luck) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.common.plugin; + +import java.util.concurrent.Executor; + +public interface LuckPermsScheduler { + + Executor getAsyncExecutor(); + Executor getSyncExecutor(); + + void doAsync(Runnable r); + void doSync(Runnable r); + + void doAsyncRepeating(Runnable r, long interval); + void doSyncRepeating(Runnable r, long interval); + + void doAsyncLater(Runnable r, long delay); + void doSyncLater(Runnable r, long delay); + + void shutdown(); + +} diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/AbstractStorage.java b/common/src/main/java/me/lucko/luckperms/common/storage/AbstractStorage.java index 2dd09eb7e..05c678741 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/AbstractStorage.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/AbstractStorage.java @@ -28,11 +28,11 @@ import lombok.experimental.Delegate; import me.lucko.luckperms.api.HeldPermission; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.backing.AbstractBacking; import me.lucko.luckperms.common.storage.wrappings.BufferedOutputStorage; import me.lucko.luckperms.common.storage.wrappings.TolerantStorage; @@ -50,7 +50,7 @@ import java.util.function.Supplier; public class AbstractStorage implements Storage { public static Storage wrap(LuckPermsPlugin plugin, AbstractBacking backing) { BufferedOutputStorage bufferedDs = BufferedOutputStorage.wrap(TolerantStorage.wrap(new AbstractStorage(backing)), 1000L); - plugin.doAsyncRepeating(bufferedDs, 10L); + plugin.getScheduler().doAsyncRepeating(bufferedDs, 10L); return bufferedDs; } @@ -58,7 +58,7 @@ public class AbstractStorage implements Storage { private final AbstractBacking backing; private CompletableFuture makeFuture(Supplier supplier) { - return CompletableFuture.supplyAsync(supplier, backing.getPlugin().getAsyncExecutor()); + return CompletableFuture.supplyAsync(supplier, backing.getPlugin().getScheduler().getAsyncExecutor()); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/SplitBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/SplitBacking.java index fc11b9e9d..6023cae89 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/SplitBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/SplitBacking.java @@ -26,11 +26,11 @@ import com.google.common.collect.ImmutableMap; import me.lucko.luckperms.api.HeldPermission; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.backing.AbstractBacking; import java.util.List; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java index 1ae94ff79..ef153108a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/StorageFactory.java @@ -26,8 +26,8 @@ import lombok.experimental.UtilityClass; import com.google.common.collect.ImmutableSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.backing.AbstractBacking; import me.lucko.luckperms.common.storage.backing.JSONBacking; import me.lucko.luckperms.common.storage.backing.MongoDBBacking; @@ -124,17 +124,17 @@ public class StorageFactory { case MYSQL: return new SQLBacking(plugin, new MySQLProvider(plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)); case SQLITE: - return new SQLBacking(plugin, new SQLiteProvider(new File(plugin.getDataFolder(), "luckperms.sqlite")), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)); + return new SQLBacking(plugin, new SQLiteProvider(new File(plugin.getDataDirectory(), "luckperms.sqlite")), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)); case H2: - return new SQLBacking(plugin, new H2Provider(new File(plugin.getDataFolder(), "luckperms.db")), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)); + return new SQLBacking(plugin, new H2Provider(new File(plugin.getDataDirectory(), "luckperms.db")), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)); case POSTGRESQL: return new SQLBacking(plugin, new PostgreSQLProvider(plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)); case MONGODB: return new MongoDBBacking(plugin, plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)); case YAML: - return new YAMLBacking(plugin, plugin.getDataFolder()); + return new YAMLBacking(plugin, plugin.getDataDirectory()); default: - return new JSONBacking(plugin, plugin.getDataFolder()); + return new JSONBacking(plugin, plugin.getDataDirectory()); } } } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/AbstractBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/AbstractBacking.java index 82d45bfcb..effd86da0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/AbstractBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/AbstractBacking.java @@ -29,11 +29,11 @@ import lombok.Setter; import me.lucko.luckperms.api.HeldPermission; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.List; import java.util.Set; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java index aa744ad8d..8e240a238 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java @@ -23,9 +23,9 @@ package me.lucko.luckperms.common.storage.backing; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.data.Log; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.io.BufferedReader; import java.io.BufferedWriter; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/JSONBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/JSONBacking.java index a7febcc4d..0635bffdf 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/JSONBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/JSONBacking.java @@ -28,7 +28,6 @@ import com.google.gson.stream.JsonWriter; import me.lucko.luckperms.api.HeldPermission; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.UserIdentifier; import me.lucko.luckperms.common.core.model.Group; @@ -37,6 +36,7 @@ import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.managers.GroupManager; import me.lucko.luckperms.common.managers.TrackManager; import me.lucko.luckperms.common.managers.impl.GenericUserManager; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.holder.NodeHeldPermission; import me.lucko.luckperms.common.utils.ThrowingFunction; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java index dfeeb58a8..fb7fae640 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java @@ -34,7 +34,6 @@ import com.mongodb.client.model.InsertOneOptions; import me.lucko.luckperms.api.HeldPermission; import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.UserIdentifier; import me.lucko.luckperms.common.core.model.Group; @@ -44,6 +43,7 @@ import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.managers.GroupManager; import me.lucko.luckperms.common.managers.TrackManager; import me.lucko.luckperms.common.managers.impl.GenericUserManager; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.DatastoreConfiguration; import me.lucko.luckperms.common.storage.holder.NodeHeldPermission; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/SQLBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/SQLBacking.java index 2213f4788..b00ef5895 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/SQLBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/SQLBacking.java @@ -32,7 +32,6 @@ import com.google.gson.reflect.TypeToken; import me.lucko.luckperms.api.HeldPermission; import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.UserIdentifier; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; @@ -41,6 +40,7 @@ import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.managers.GroupManager; import me.lucko.luckperms.common.managers.TrackManager; import me.lucko.luckperms.common.managers.impl.GenericUserManager; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.backing.sqlprovider.SQLProvider; import me.lucko.luckperms.common.storage.backing.utils.LegacySchemaMigration; import me.lucko.luckperms.common.storage.backing.utils.NodeDataHolder; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/YAMLBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/YAMLBacking.java index bf16e0460..c1c73e29b 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/YAMLBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/YAMLBacking.java @@ -26,7 +26,6 @@ import com.google.common.collect.ImmutableList; import me.lucko.luckperms.api.HeldPermission; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.UserIdentifier; import me.lucko.luckperms.common.core.model.Group; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.managers.GroupManager; import me.lucko.luckperms.common.managers.TrackManager; import me.lucko.luckperms.common.managers.impl.GenericUserManager; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.storage.holder.NodeHeldPermission; import org.yaml.snakeyaml.DumperOptions; diff --git a/common/src/main/java/me/lucko/luckperms/common/tasks/CacheHousekeepingTask.java b/common/src/main/java/me/lucko/luckperms/common/tasks/CacheHousekeepingTask.java index afcabd7e5..1b64b2782 100644 --- a/common/src/main/java/me/lucko/luckperms/common/tasks/CacheHousekeepingTask.java +++ b/common/src/main/java/me/lucko/luckperms/common/tasks/CacheHousekeepingTask.java @@ -24,8 +24,8 @@ package me.lucko.luckperms.common.tasks; import lombok.RequiredArgsConstructor; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; @RequiredArgsConstructor public class CacheHousekeepingTask implements Runnable { diff --git a/common/src/main/java/me/lucko/luckperms/common/tasks/ExpireTemporaryTask.java b/common/src/main/java/me/lucko/luckperms/common/tasks/ExpireTemporaryTask.java index 95daf4100..88190a7cf 100644 --- a/common/src/main/java/me/lucko/luckperms/common/tasks/ExpireTemporaryTask.java +++ b/common/src/main/java/me/lucko/luckperms/common/tasks/ExpireTemporaryTask.java @@ -24,9 +24,9 @@ package me.lucko.luckperms.common.tasks; import lombok.AllArgsConstructor; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; @AllArgsConstructor public class ExpireTemporaryTask implements Runnable { diff --git a/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java b/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java index e0f8ba344..33b81e17a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java +++ b/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java @@ -26,8 +26,8 @@ import lombok.AllArgsConstructor; import me.lucko.luckperms.api.event.events.PostSyncEvent; import me.lucko.luckperms.api.event.events.PreSyncEvent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; @AllArgsConstructor public class UpdateTask implements Runnable { diff --git a/common/src/main/java/me/lucko/luckperms/common/utils/AbstractListener.java b/common/src/main/java/me/lucko/luckperms/common/utils/AbstractListener.java index 16dd4dc48..eb1a4ba03 100644 --- a/common/src/main/java/me/lucko/luckperms/common/utils/AbstractListener.java +++ b/common/src/main/java/me/lucko/luckperms/common/utils/AbstractListener.java @@ -25,11 +25,11 @@ package me.lucko.luckperms.common.utils; import lombok.AllArgsConstructor; import me.lucko.luckperms.api.event.events.UserFirstLoginEvent; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.core.UuidCache; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.defaults.Rule; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import java.util.UUID; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java index b46667c29..dbc797a3e 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java @@ -29,7 +29,6 @@ import com.google.inject.Inject; import me.lucko.luckperms.api.Contexts; import me.lucko.luckperms.api.LuckPermsApi; import me.lucko.luckperms.api.PlatformType; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.api.ApiHandler; import me.lucko.luckperms.common.api.ApiProvider; import me.lucko.luckperms.common.caching.handlers.CachedStateManager; @@ -37,7 +36,7 @@ import me.lucko.luckperms.common.calculators.CalculatorFactory; import me.lucko.luckperms.common.commands.BaseCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.config.ConfigKeys; -import me.lucko.luckperms.common.config.LPConfiguration; +import me.lucko.luckperms.common.config.LuckPermsConfiguration; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.contexts.ContextManager; import me.lucko.luckperms.common.contexts.ServerCalculator; @@ -53,6 +52,8 @@ import me.lucko.luckperms.common.managers.TrackManager; import me.lucko.luckperms.common.managers.impl.GenericTrackManager; import me.lucko.luckperms.common.messaging.InternalMessagingService; import me.lucko.luckperms.common.messaging.RedisMessaging; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; +import me.lucko.luckperms.common.plugin.LuckPermsScheduler; import me.lucko.luckperms.common.storage.Storage; import me.lucko.luckperms.common.storage.StorageFactory; import me.lucko.luckperms.common.storage.StorageType; @@ -86,12 +87,10 @@ import org.spongepowered.api.event.game.state.GamePostInitializationEvent; import org.spongepowered.api.event.game.state.GamePreInitializationEvent; import org.spongepowered.api.event.game.state.GameStoppingServerEvent; import org.spongepowered.api.plugin.Plugin; -import org.spongepowered.api.plugin.PluginContainer; import org.spongepowered.api.scheduler.AsynchronousExecutor; import org.spongepowered.api.scheduler.Scheduler; import org.spongepowered.api.scheduler.SpongeExecutorService; import org.spongepowered.api.scheduler.SynchronousExecutor; -import org.spongepowered.api.scheduler.Task; import org.spongepowered.api.service.permission.PermissionDescription; import org.spongepowered.api.service.permission.PermissionService; import org.spongepowered.api.service.permission.Subject; @@ -102,14 +101,12 @@ import java.io.File; import java.io.InputStream; import java.nio.file.Path; import java.util.Collections; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.StreamSupport; @@ -118,7 +115,6 @@ import java.util.stream.StreamSupport; public class LPSpongePlugin implements LuckPermsPlugin { private final Set ignoringLogs = ConcurrentHashMap.newKeySet(); - private final Set shutdownHooks = Collections.synchronizedSet(new HashSet<>()); @Inject private Logger logger; @@ -130,20 +126,21 @@ public class LPSpongePlugin implements LuckPermsPlugin { @ConfigDir(sharedRoot = false) private Path configDir; - private Scheduler scheduler = Sponge.getScheduler(); + private Scheduler spongeScheduler = Sponge.getScheduler(); @Inject @SynchronousExecutor - private SpongeExecutorService syncExecutor; + private SpongeExecutorService syncExecutorService; @Inject @AsynchronousExecutor - private SpongeExecutorService asyncExecutor; + private SpongeExecutorService asyncExecutorService; private LPTimings timings; private boolean lateLoad = false; - private LPConfiguration configuration; + private LuckPermsScheduler scheduler; + private LuckPermsConfiguration configuration; private SpongeUserManager userManager; private SpongeGroupManager groupManager; private TrackManager trackManager; @@ -165,12 +162,13 @@ public class LPSpongePlugin implements LuckPermsPlugin { @Listener(order = Order.FIRST) public void onEnable(GamePreInitializationEvent event) { + scheduler = new LPSpongeScheduler(this); localeManager = new NoopLocaleManager(); senderFactory = new SpongeSenderFactory(this); log = new LoggerImpl(getConsoleSender()); LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this); - debugHandler = new DebugHandler(asyncExecutor, getVersion()); - permissionCache = new PermissionCache(asyncExecutor); + debugHandler = new DebugHandler(scheduler.getAsyncExecutor(), getVersion()); + permissionCache = new PermissionCache(scheduler.getAsyncExecutor()); timings = new LPTimings(this); getLog().info("Loading configuration..."); @@ -228,7 +226,7 @@ public class LPSpongePlugin implements LuckPermsPlugin { // load locale localeManager = new SimpleLocaleManager(); - File locale = new File(getMainDir(), "lang.yml"); + File locale = new File(getDataDirectory(), "lang.yml"); if (locale.exists()) { getLog().info("Found locale file. Attempting to load from it."); try { @@ -279,23 +277,19 @@ public class LPSpongePlugin implements LuckPermsPlugin { // schedule update tasks int mins = getConfiguration().get(ConfigKeys.SYNC_TIME); if (mins > 0) { - Task t = scheduler.createTaskBuilder().async().interval(mins, TimeUnit.MINUTES).execute(new UpdateTask(this)) - .submit(LPSpongePlugin.this); - addShutdownHook(t::cancel); + long ticks = mins * 60 * 20; + scheduler.doAsyncRepeating(() -> updateTaskBuffer.request(), ticks); } + scheduler.doAsyncLater(() -> updateTaskBuffer.request(), 40L); // run an update instantly. updateTaskBuffer.requestDirectly(); // register tasks - Task t2 = scheduler.createTaskBuilder().async().intervalTicks(60L).execute(new ExpireTemporaryTask(this)).submit(this); - Task t3 = scheduler.createTaskBuilder().async().intervalTicks(2400L).execute(new CacheHousekeepingTask(this)).submit(this); - Task t4 = scheduler.createTaskBuilder().async().intervalTicks(2400L).execute(new ServiceCacheHousekeepingTask(service)).submit(this); - Task t5 = scheduler.createTaskBuilder().async().intervalTicks(2400L).execute(() -> userManager.performCleanup()).submit(this); - addShutdownHook(t2::cancel); - addShutdownHook(t3::cancel); - addShutdownHook(t4::cancel); - addShutdownHook(t5::cancel); + scheduler.doAsyncRepeating(new ExpireTemporaryTask(this), 60L); + scheduler.doAsyncRepeating(new CacheHousekeepingTask(this), 2400L); + scheduler.doAsyncRepeating(new ServiceCacheHousekeepingTask(service), 2400L); + scheduler.doAsyncRepeating(() -> userManager.performCleanup(), 2400L); getLog().info("Successfully loaded."); } @@ -320,6 +314,8 @@ public class LPSpongePlugin implements LuckPermsPlugin { getLog().info("Unregistering API..."); ApiHandler.unregisterProvider(); + + scheduler.shutdown(); } @Listener @@ -356,9 +352,8 @@ public class LPSpongePlugin implements LuckPermsPlugin { service.invalidateParentCaches(); } - @SuppressWarnings("ResultOfMethodCallIgnored") @Override - public File getMainDir() { + public File getDataDirectory() { File base = configDir.toFile().getParentFile().getParentFile(); File luckPermsDir = new File(base, "luckperms"); luckPermsDir.mkdirs(); @@ -366,8 +361,8 @@ public class LPSpongePlugin implements LuckPermsPlugin { } @Override - public File getDataFolder() { - return getMainDir(); + public File getConfigDirectory() { + return configDir.toFile(); } @Override @@ -403,13 +398,13 @@ public class LPSpongePlugin implements LuckPermsPlugin { } @Override - public PlatformType getType() { + public PlatformType getServerType() { return PlatformType.SPONGE; } @Override public String getServerName() { - return getGame().getPlatform().getType().name(); + return getGame().getPlatform().getImplementation().getDescription().orElse("null"); } @Override @@ -433,12 +428,12 @@ public class LPSpongePlugin implements LuckPermsPlugin { } @Override - public boolean isOnline(UUID external) { + public boolean isPlayerOnline(UUID external) { return game.getServer().getPlayer(external).isPresent(); } @Override - public List getSenders() { + public List getOnlineSenders() { return game.getServer().getOnlinePlayers().stream() .map(s -> getSenderFactory().wrap(s)) .collect(Collectors.toList()); @@ -455,45 +450,10 @@ public class LPSpongePlugin implements LuckPermsPlugin { } @Override - public Object getPlugin(String name) { - return game.getPluginManager().getPlugin(name).map(PluginContainer::getInstance).orElse(null); - } - - @Override - public Object getService(Class clazz) { - return game.getServiceManager().provideUnchecked(clazz); - } - - @Override - public UUID getUUID(String playerName) { + public UUID getUuidFromUsername(String playerName) { return game.getServer().getPlayer(playerName).map(Player::getUniqueId).orElse(null); } - @Override - public boolean isPluginLoaded(String name) { - return game.getPluginManager().isLoaded(name); - } - - @Override - public void addShutdownHook(Runnable r) { - shutdownHooks.add(r); - } - - @Override - public void doAsync(Runnable r) { - scheduler.createTaskBuilder().async().execute(r).submit(this); - } - - @Override - public void doSync(Runnable r) { - scheduler.createTaskBuilder().execute(r).submit(this); - } - - @Override - public void doAsyncRepeating(Runnable r, long interval) { - scheduler.createTaskBuilder().async().intervalTicks(interval).execute(r).submit(this); - } - @Override public List getExtraCommands() { return Collections.singletonList(new SpongeMainCommand(this)); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongeScheduler.java b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongeScheduler.java new file mode 100644 index 000000000..645674d2b --- /dev/null +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongeScheduler.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016 Lucko (Luck) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.sponge; + +import me.lucko.luckperms.common.plugin.LuckPermsScheduler; + +import org.spongepowered.api.scheduler.Task; + +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; + +public class LPSpongeScheduler implements LuckPermsScheduler { + private final LPSpongePlugin plugin; + private Set tasks = ConcurrentHashMap.newKeySet(); + + public LPSpongeScheduler(LPSpongePlugin plugin) { + this.plugin = plugin; + } + + @Override + public Executor getAsyncExecutor() { + return plugin.getAsyncExecutorService(); + } + + @Override + public Executor getSyncExecutor() { + return plugin.getSyncExecutorService(); + } + + @Override + public void doAsync(Runnable r) { + plugin.getSpongeScheduler().createTaskBuilder().async().execute(r).submit(plugin); + } + + @Override + public void doSync(Runnable r) { + plugin.getSpongeScheduler().createTaskBuilder().execute(r).submit(plugin); + } + + @Override + public void doAsyncRepeating(Runnable r, long interval) { + Task task = plugin.getSpongeScheduler().createTaskBuilder().async().intervalTicks(interval).delayTicks(interval).execute(r).submit(plugin); + tasks.add(task); + } + + @Override + public void doSyncRepeating(Runnable r, long interval) { + Task task = plugin.getSpongeScheduler().createTaskBuilder().intervalTicks(interval).delayTicks(interval).execute(r).submit(plugin); + tasks.add(task); + } + + @Override + public void doAsyncLater(Runnable r, long delay) { + plugin.getSpongeScheduler().createTaskBuilder().async().delayTicks(delay).execute(r).submit(plugin); + } + + @Override + public void doSyncLater(Runnable r, long delay) { + plugin.getSpongeScheduler().createTaskBuilder().delayTicks(delay).execute(r).submit(plugin); + } + + @Override + public void shutdown() { + tasks.forEach(Task::cancel); + } +} diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeSenderFactory.java b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeSenderFactory.java index a5701a704..58fb3574e 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeSenderFactory.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeSenderFactory.java @@ -22,9 +22,9 @@ package me.lucko.luckperms.sponge; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.SenderFactory; import me.lucko.luckperms.common.constants.Constants; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.entity.living.player.Player; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionClear.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionClear.java index 931d3d17f..caebb6aa6 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionClear.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionClear.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.permission.SubjectData; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionInfo.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionInfo.java index 42f46c308..35bd4fdff 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionInfo.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionInfo.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.context.Context; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionSet.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionSet.java index bc0f73c25..d6542f0d5 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionSet.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionSet.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.permission.SubjectData; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionUnset.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionUnset.java index e87a1c6bf..c0986c705 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionUnset.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/OptionUnset.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.permission.SubjectData; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentAdd.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentAdd.java index cfac31da1..b03874e61 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentAdd.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentAdd.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.Sponge; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentClear.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentClear.java index 66a796dd0..33b741e1c 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentClear.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentClear.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.permission.SubjectData; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentInfo.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentInfo.java index 1007f5960..2339b28f8 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentInfo.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentInfo.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.context.Context; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentRemove.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentRemove.java index 6d567c323..724d2f681 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentRemove.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/ParentRemove.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.Sponge; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionClear.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionClear.java index ae7f647a8..aecea4703 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionClear.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionClear.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.permission.SubjectData; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionInfo.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionInfo.java index 502043ec9..2699196cf 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionInfo.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionInfo.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.context.Context; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java index 146f53d58..87a72f03a 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.sponge.commands; import me.lucko.luckperms.api.context.ContextSet; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.service.permission.SubjectData; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeMainCommand.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeMainCommand.java index 2b1b469ad..13295f484 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeMainCommand.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeMainCommand.java @@ -25,7 +25,6 @@ package me.lucko.luckperms.sponge.commands; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.BaseCommand; import me.lucko.luckperms.common.commands.Command; @@ -35,6 +34,7 @@ import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.ImmutableCollectors; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.sponge.LPSpongePlugin; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/messaging/BungeeMessagingService.java b/sponge/src/main/java/me/lucko/luckperms/sponge/messaging/BungeeMessagingService.java index 72ee0602b..79338db58 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/messaging/BungeeMessagingService.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/messaging/BungeeMessagingService.java @@ -63,7 +63,7 @@ public class BungeeMessagingService extends AbstractMessagingService implements @Override protected void sendMessage(String channel, String message) { - plugin.getScheduler().createTaskBuilder().interval(10, TimeUnit.SECONDS).execute(task -> { + plugin.getSpongeScheduler().createTaskBuilder().interval(10, TimeUnit.SECONDS).execute(task -> { Collection players = plugin.getGame().getServer().getOnlinePlayers(); if (players.isEmpty()) { return; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionManager.java b/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionManager.java index 336a4b153..f35add7d6 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionManager.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionManager.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.sponge.migration; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -32,6 +31,7 @@ import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import org.spongepowered.api.Sponge; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionsEx.java b/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionsEx.java index a377b6a1c..970d38fc3 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionsEx.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/migration/MigrationPermissionsEx.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.sponge.migration; -import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.SubCommand; @@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.Track; import me.lucko.luckperms.common.core.model.User; +import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.sponge.LPSpongePlugin; diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java index 1b6fe6f5c..99ff973d5 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java @@ -129,7 +129,7 @@ public class LuckPermsService implements PermissionService { localOptionCaches = Collections.newSetFromMap(new MapMaker().weakKeys().makeMap()); localDataCaches = Collections.newSetFromMap(new MapMaker().weakKeys().makeMap()); - storage = new SubjectStorage(new File(plugin.getDataFolder(), "local")); + storage = new SubjectStorage(new File(plugin.getDataDirectory(), "local")); userSubjects = plugin.getUserManager(); fallbackUserSubjects = new PersistedCollection(this, "fallback-users", true); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsSubjectData.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsSubjectData.java index b158d8f99..fe15b1042 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsSubjectData.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsSubjectData.java @@ -74,11 +74,11 @@ public class LuckPermsSubjectData implements LPSubjectData { private void objectSave(PermissionHolder t) { if (t instanceof User) { service.getPlugin().getStorage().saveUser(((User) t)) - .thenRunAsync(() -> ((User) t).getRefreshBuffer().request(), service.getPlugin().getAsyncExecutor()); + .thenRunAsync(() -> ((User) t).getRefreshBuffer().request(), service.getPlugin().getScheduler().getAsyncExecutor()); } if (t instanceof Group) { service.getPlugin().getStorage().saveGroup((Group) t) - .thenRunAsync(() -> service.getPlugin().getUpdateTaskBuffer().request(), service.getPlugin().getAsyncExecutor()); + .thenRunAsync(() -> service.getPlugin().getUpdateTaskBuffer().request(), service.getPlugin().getScheduler().getAsyncExecutor()); } }