diff --git a/api/pom.xml b/api/pom.xml index c43589f7..c77ebc24 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko.luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT 4.0.0 diff --git a/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java b/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java index d56b0fb8..f73b584f 100644 --- a/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java +++ b/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java @@ -62,6 +62,24 @@ public interface LPConfiguration { */ boolean getIncludeGlobalPerms(); + /** + * @return if the users on this server will have their global world permissions applied + * @since 2.9 + */ + boolean getIncludeGlobalWorldPerms(); + + /** + * @return true if the platform is applying global groups + * @since 2.9 + */ + boolean getApplyGlobalGroups(); + + /** + * @return true if the platform is applying global world groups + * @since 2.9 + */ + boolean getApplyGlobalWorldGroups(); + /** * @return the online mode setting in the config */ @@ -88,6 +106,12 @@ public interface LPConfiguration { */ boolean getLogNotify(); + /** + * @return true if permission checks are being recorded / debugged + * @since 2.9 + */ + boolean getDebugPermissionChecks(); + /** * @return true if the vanilla op system is enabled * @since 2.8 @@ -100,6 +124,12 @@ public interface LPConfiguration { */ boolean getCommandsAllowOp(); + /** + * @return true if auto op is enabled + * @since 2.9 + */ + boolean getAutoOp(); + /** * @return the name of the server used within Vault operations * @since 2.7 diff --git a/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java b/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java index 4e29c08a..43bf60f5 100644 --- a/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java +++ b/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java @@ -187,7 +187,7 @@ public interface LuckPermsApi { Track getTrack(String name); /** - * Gets a wrapped tracj object from the track storage. This method does not return null, unlike {@link #getTrack} + * Gets a wrapped track object from the track storage. This method does not return null, unlike {@link #getTrack} * @param name the name of the track to get * @return an optional {@link Track} object * @throws NullPointerException if the name is null diff --git a/api/src/main/java/me/lucko/luckperms/api/PlatformType.java b/api/src/main/java/me/lucko/luckperms/api/PlatformType.java index 15694edc..ca8937b3 100644 --- a/api/src/main/java/me/lucko/luckperms/api/PlatformType.java +++ b/api/src/main/java/me/lucko/luckperms/api/PlatformType.java @@ -30,7 +30,12 @@ public enum PlatformType { BUKKIT("Bukkit"), BUNGEE("Bungee"), - SPONGE("Sponge"); + SPONGE("Sponge"), + + /** + * @since 2.9 + */ + STANDALONE("Standalone"); private final String friendlyName; diff --git a/bukkit-legacy/pom.xml b/bukkit-legacy/pom.xml index a09d0d40..9312124f 100644 --- a/bukkit-legacy/pom.xml +++ b/bukkit-legacy/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko.luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT 4.0.0 diff --git a/bukkit-placeholders/pom.xml b/bukkit-placeholders/pom.xml index dc6355e6..016eaf02 100644 --- a/bukkit-placeholders/pom.xml +++ b/bukkit-placeholders/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko.luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT 4.0.0 diff --git a/bukkit/pom.xml b/bukkit/pom.xml index eb888b42..52b7ceb8 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko.luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 6466420c..1ef4d404 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko.luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 0e2fcf5a..98aadc65 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko.luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT 4.0.0 diff --git a/common/src/main/java/me/lucko/luckperms/api/implementation/ApiProvider.java b/common/src/main/java/me/lucko/luckperms/api/implementation/ApiProvider.java index 342fb6f3..e28a47cc 100644 --- a/common/src/main/java/me/lucko/luckperms/api/implementation/ApiProvider.java +++ b/common/src/main/java/me/lucko/luckperms/api/implementation/ApiProvider.java @@ -67,7 +67,7 @@ public class ApiProvider implements LuckPermsApi { @Override public double getApiVersion() { - return 2.8; + return 2.9; } @Override diff --git a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java index 4be9a22f..6072a603 100644 --- a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java +++ b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java @@ -61,6 +61,21 @@ public class LPConfigurationLink implements LPConfiguration { return master.getIncludeGlobalPerms(); } + @Override + public boolean getIncludeGlobalWorldPerms() { + return master.getIncludeGlobalWorldPerms(); + } + + @Override + public boolean getApplyGlobalGroups() { + return master.getApplyGlobalGroups(); + } + + @Override + public boolean getApplyGlobalWorldGroups() { + return master.getApplyGlobalWorldGroups(); + } + @Override public boolean getOnlineMode() { return master.getOnlineMode(); @@ -86,6 +101,11 @@ public class LPConfigurationLink implements LPConfiguration { return master.getLogNotify(); } + @Override + public boolean getDebugPermissionChecks() { + return master.getDebugPermissionChecks(); + } + @Override public boolean getEnableOps() { return master.getEnableOps(); @@ -96,6 +116,11 @@ public class LPConfigurationLink implements LPConfiguration { return master.getCommandsAllowOp(); } + @Override + public boolean getAutoOp() { + return master.getAutoOp(); + } + @Override public String getVaultServer() { return master.getVaultServer(); diff --git a/pom.xml b/pom.xml index 74946120..a53d601f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,10 +6,11 @@ me.lucko.luckperms luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT common api + standalone bukkit bukkit-legacy bukkit-placeholders @@ -38,7 +39,7 @@ UTF-8 - 2.8 + 2.9 diff --git a/sponge/pom.xml b/sponge/pom.xml index 16848800..d858215f 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko.luckperms - 2.8-SNAPSHOT + 2.9-SNAPSHOT 4.0.0 diff --git a/standalone/pom.xml b/standalone/pom.xml new file mode 100644 index 00000000..eda360ec --- /dev/null +++ b/standalone/pom.xml @@ -0,0 +1,145 @@ + + + + luckperms + me.lucko.luckperms + 2.9-SNAPSHOT + + 4.0.0 + + luckperms-standalone + jar + + + clean package + LuckPermsStandalone-${release.version}.${git.closest.tag.commit.count} + ${basedir}/src/main/java + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + + me.lucko.luckperms.LPStandaloneApp + + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.3 + + + package + + shade + + + false + + + org.slf4j + me.lucko.luckperms.lib.slf4j + + + com.zaxxer.hikari + me.lucko.luckperms.lib.hikari + + + com.mongodb + me.lucko.luckperms.lib.mongodb + + + org.bson + me.lucko.luckperms.lib.bson + + + org.h2 + me.lucko.luckperms.lib.h2 + + + org.sqlite + me.lucko.luckperms.lib.sqlite + + + + + + + + pl.project13.maven + git-commit-id-plugin + 2.2.1 + + + + revision + + + + + true + + + + + + + + + me.lucko.luckperms + luckperms-common + ${project.version} + compile + + + + me.lucko.luckperms + luckperms-api + ${project.version} + compile + + + + org.projectlombok + lombok + 1.16.10 + provided + + + + com.google.code.gson + gson + 2.7 + compile + + + + com.google.guava + guava + 19.0 + compile + + + + diff --git a/standalone/src/main/java/me/lucko/luckperms/LPStandaloneApp.java b/standalone/src/main/java/me/lucko/luckperms/LPStandaloneApp.java new file mode 100644 index 00000000..753cd9de --- /dev/null +++ b/standalone/src/main/java/me/lucko/luckperms/LPStandaloneApp.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; + +import me.lucko.luckperms.internal.StandaloneBase; + +public class LPStandaloneApp { + private StandaloneBase standaloneBase; + + public static void main(String[] args) { + new LPStandaloneApp().start(); + } + + public void start() { + standaloneBase = new StandaloneBase(this); + LuckPerms.registerProvider(standaloneBase.getApiProvider()); + } + + public void stop() { + standaloneBase.shutdown(); + } + +} diff --git a/standalone/src/main/java/me/lucko/luckperms/gui/InterfaceManager.java b/standalone/src/main/java/me/lucko/luckperms/gui/InterfaceManager.java new file mode 100644 index 00000000..67846f02 --- /dev/null +++ b/standalone/src/main/java/me/lucko/luckperms/gui/InterfaceManager.java @@ -0,0 +1,27 @@ +/* + * 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.gui; + +public class InterfaceManager { + // TODO +} diff --git a/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneBase.java b/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneBase.java new file mode 100644 index 00000000..3e07a41f --- /dev/null +++ b/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneBase.java @@ -0,0 +1,220 @@ +/* + * 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.internal; + +import lombok.Getter; +import me.lucko.luckperms.LPStandaloneApp; +import me.lucko.luckperms.LuckPermsPlugin; +import me.lucko.luckperms.api.Logger; +import me.lucko.luckperms.api.PlatformType; +import me.lucko.luckperms.api.implementation.ApiProvider; +import me.lucko.luckperms.commands.ConsecutiveExecutor; +import me.lucko.luckperms.commands.Sender; +import me.lucko.luckperms.constants.Constants; +import me.lucko.luckperms.constants.Message; +import me.lucko.luckperms.constants.Permission; +import me.lucko.luckperms.core.LPConfiguration; +import me.lucko.luckperms.core.UuidCache; +import me.lucko.luckperms.data.Importer; +import me.lucko.luckperms.groups.GroupManager; +import me.lucko.luckperms.storage.Datastore; +import me.lucko.luckperms.tracks.TrackManager; +import me.lucko.luckperms.users.StandaloneUserManager; +import me.lucko.luckperms.users.UserManager; +import me.lucko.luckperms.utils.LogFactory; + +import java.io.File; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +@Getter +public class StandaloneBase implements LuckPermsPlugin { + private final ExecutorService threadPool = Executors.newCachedThreadPool(); + + private final java.util.logging.Logger logger; + + private final UserManager userManager; + private final GroupManager groupManager; + private final TrackManager trackManager; + private final LPConfiguration configuration; + private final Datastore datastore; + private final Logger log; + private final UuidCache uuidCache; + private final ApiProvider apiProvider; + + public StandaloneBase(LPStandaloneApp app) { + logger = java.util.logging.Logger.getGlobal(); + log = LogFactory.wrap(logger); + + configuration = new StandaloneConfiguration(this); + + // TODO datastore + datastore = null; + // Load everything, including all users. + + uuidCache = new UuidCache(true); + userManager = new StandaloneUserManager(this); + groupManager = new GroupManager(this); + trackManager = new TrackManager(); + + apiProvider = new ApiProvider(this); + + // TODO callback to the app, start gui stuff? + } + + public void shutdown() { + datastore.shutdown(); + } + + @Override + public String getVersion() { + return "2.9.0"; // TODO set dynamically + } + + @Override + public PlatformType getType() { + return PlatformType.STANDALONE; + } + + @Override + public File getMainDir() { + return null; // Is this needed? TODO + } + + @Override + public File getDataFolder() { + return null; // Is this needed? TODO + } + + @Override + public void runUpdateTask() { + // Is this needed?? TODO + } + + @Override + public void doAsync(Runnable r) { + threadPool.execute(r); + } + + @Override + public void doSync(Runnable r) { + threadPool.execute(r); + } + + + + /* + * Methods below are only required in plugins. + * They're just left empty / default. + */ + + + @Override + public Importer getImporter() { + return null; + } + + @Override + public ConsecutiveExecutor getConsecutiveExecutor() { + return null; + } + + @Override + public Message getPlayerStatus(UUID uuid) { + return Message.PLAYER_OFFLINE; + } + + @Override + public int getPlayerCount() { + return 0; + } + + @Override + public List getPlayerList() { + return Collections.emptyList(); + } + + @Override + public List getNotifyListeners() { + return Collections.emptyList(); + } + + @Override + public Sender getConsoleSender() { + return new Sender() { + @Override + public String getName() { + return Constants.getConsoleName(); + } + + @Override + public UUID getUuid() { + return Constants.getConsoleUUID(); + } + + @Override + public void sendMessage(String s) { + getLogger().info(s); + } + + @Override + public boolean hasPermission(Permission permission) { + return true; + } + }; + } + + @Override + public List getPossiblePermissions() { + return Collections.emptyList(); + } + + @Override + public Set getIgnoringLogs() { + return Collections.emptySet(); + } + + @Override + public Object getPlugin(String name) { + return null; + } + + @Override + public Object getService(Class clazz) { + return null; + } + + @Override + public UUID getUUID(String playerName) { + return null; + } + + @Override + public boolean isPluginLoaded(String name) { + return false; + } +} diff --git a/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneConfiguration.java b/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneConfiguration.java new file mode 100644 index 00000000..df6902c8 --- /dev/null +++ b/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneConfiguration.java @@ -0,0 +1,55 @@ +/* + * 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.internal; + +import me.lucko.luckperms.core.LPConfiguration; + +public class StandaloneConfiguration extends LPConfiguration { + public StandaloneConfiguration(StandaloneBase plugin) { + super(plugin, "global", true, "null"); + } + + @Override + protected void init() { + } + + @Override + protected void set(String path, Object value) { + + } + + @Override + protected String getString(String path, String def) { + return def; + } + + @Override + protected int getInt(String path, int def) { + return def; + } + + @Override + protected boolean getBoolean(String path, boolean def) { + return def; + } +} diff --git a/standalone/src/main/java/me/lucko/luckperms/users/StandaloneUser.java b/standalone/src/main/java/me/lucko/luckperms/users/StandaloneUser.java new file mode 100644 index 00000000..0d8ef9e0 --- /dev/null +++ b/standalone/src/main/java/me/lucko/luckperms/users/StandaloneUser.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.users; + +import me.lucko.luckperms.LuckPermsPlugin; + +import java.util.UUID; + +public class StandaloneUser extends User { + + StandaloneUser(UUID uuid, LuckPermsPlugin plugin) { + super(uuid, plugin); + } + + StandaloneUser(UUID uuid, String username, LuckPermsPlugin plugin) { + super(uuid, username, plugin); + } + + @Override + public void refreshPermissions() { + // Do nothing. + } +} diff --git a/standalone/src/main/java/me/lucko/luckperms/users/StandaloneUserManager.java b/standalone/src/main/java/me/lucko/luckperms/users/StandaloneUserManager.java new file mode 100644 index 00000000..b88757c8 --- /dev/null +++ b/standalone/src/main/java/me/lucko/luckperms/users/StandaloneUserManager.java @@ -0,0 +1,57 @@ +/* + * 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.users; + +import me.lucko.luckperms.LuckPermsPlugin; + +import java.util.UUID; + +public class StandaloneUserManager extends UserManager { + private final LuckPermsPlugin plugin; + + public StandaloneUserManager(LuckPermsPlugin plugin) { + super(plugin); + this.plugin = plugin; + } + + @Override + public void cleanup(User user) { + // unload(user); + // never unload????? TODO + } + + @Override + public User make(UUID id) { + return new StandaloneUser(id, plugin); + } + + @Override + public User make(UUID uuid, String username) { + return new StandaloneUser(uuid, username, plugin); + } + + @Override + public void updateAllUsers() { + getAll().values().forEach(u -> plugin.getDatastore().loadUser(u.getUuid(), u.getName())); + } +}