Events rewrite, remove most deprecated API methods (v3.0)
This commit is contained in:
@@ -24,8 +24,6 @@ package me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Context and options for a permission lookup.
|
||||
*
|
||||
@@ -51,18 +49,6 @@ public class Contexts {
|
||||
return new Contexts(context, includeGlobal, includeGlobalWorld, applyGroups, applyGlobalGroups, applyGlobalWorldGroups, op);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public static Contexts of(Map<String, String> context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups) {
|
||||
return new Contexts(context, includeGlobal, includeGlobalWorld, applyGroups, applyGlobalGroups, applyGlobalWorldGroups);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public static Contexts of(Map<String, String> context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
return new Contexts(context, includeGlobal, includeGlobalWorld, applyGroups, applyGlobalGroups, applyGlobalWorldGroups, op);
|
||||
}
|
||||
|
||||
/**
|
||||
* The contexts that apply for this lookup
|
||||
* The keys for servers and worlds are defined as static values.
|
||||
@@ -115,17 +101,6 @@ public class Contexts {
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Contexts(Map<String, String> context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
this(context == null ? null : ContextSet.fromMap(context), includeGlobal, includeGlobalWorld, applyGroups, applyGlobalGroups, applyGlobalWorldGroups, op);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public Contexts(Map<String, String> context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups) {
|
||||
this(context, includeGlobal, includeGlobalWorld, applyGroups, applyGlobalGroups, applyGlobalWorldGroups, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the contexts that apply for this lookup
|
||||
*
|
||||
@@ -136,17 +111,6 @@ public class Contexts {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the contexts that apply for this lookup
|
||||
*
|
||||
* @return an immutable map of context key value pairs
|
||||
* @deprecated in favour of {@link #getContexts()}
|
||||
*/
|
||||
@Deprecated
|
||||
public Map<String, String> getContext() {
|
||||
return this.context.toMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if OP defaults should be included
|
||||
*
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api;
|
||||
|
||||
import me.lucko.luckperms.api.data.Callback;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Deprecated Storage interface. Use {@link Storage} instead.
|
||||
*
|
||||
* @deprecated as of version 2.14 in favour of {@link Storage}.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface Datastore {
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isAcceptingLogins();
|
||||
|
||||
@Deprecated
|
||||
Sync sync();
|
||||
|
||||
@Deprecated
|
||||
Async async();
|
||||
|
||||
@Deprecated
|
||||
Future future();
|
||||
|
||||
@Deprecated
|
||||
interface Sync {
|
||||
boolean logAction(LogEntry entry);
|
||||
|
||||
Log getLog();
|
||||
|
||||
@Deprecated
|
||||
boolean loadOrCreateUser(UUID uuid, String username);
|
||||
|
||||
@Deprecated
|
||||
boolean loadUser(UUID uuid);
|
||||
|
||||
boolean loadUser(UUID uuid, String username);
|
||||
|
||||
boolean saveUser(User user);
|
||||
|
||||
boolean cleanupUsers();
|
||||
|
||||
Set<UUID> getUniqueUsers();
|
||||
|
||||
boolean createAndLoadGroup(String name);
|
||||
|
||||
boolean loadGroup(String name);
|
||||
|
||||
boolean loadAllGroups();
|
||||
|
||||
boolean saveGroup(Group group);
|
||||
|
||||
boolean deleteGroup(Group group);
|
||||
|
||||
boolean createAndLoadTrack(String name);
|
||||
|
||||
boolean loadTrack(String name);
|
||||
|
||||
boolean loadAllTracks();
|
||||
|
||||
boolean saveTrack(Track track);
|
||||
|
||||
boolean deleteTrack(Track track);
|
||||
|
||||
boolean saveUUIDData(String username, UUID uuid);
|
||||
|
||||
UUID getUUID(String username);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
interface Async {
|
||||
void logAction(LogEntry entry, Callback<Boolean> callback);
|
||||
|
||||
void getLog(Callback<Log> callback);
|
||||
|
||||
@Deprecated
|
||||
void loadOrCreateUser(UUID uuid, String username, Callback<Boolean> callback);
|
||||
|
||||
@Deprecated
|
||||
void loadUser(UUID uuid, Callback<Boolean> callback);
|
||||
|
||||
void loadUser(UUID uuid, String username, Callback<Boolean> callback);
|
||||
|
||||
void saveUser(User user, Callback<Boolean> callback);
|
||||
|
||||
void cleanupUsers(Callback<Boolean> callback);
|
||||
|
||||
void getUniqueUsers(Callback<Set<UUID>> callback);
|
||||
|
||||
void createAndLoadGroup(String name, Callback<Boolean> callback);
|
||||
|
||||
void loadGroup(String name, Callback<Boolean> callback);
|
||||
|
||||
void loadAllGroups(Callback<Boolean> callback);
|
||||
|
||||
void saveGroup(Group group, Callback<Boolean> callback);
|
||||
|
||||
void deleteGroup(Group group, Callback<Boolean> callback);
|
||||
|
||||
void createAndLoadTrack(String name, Callback<Boolean> callback);
|
||||
|
||||
void loadTrack(String name, Callback<Boolean> callback);
|
||||
|
||||
void loadAllTracks(Callback<Boolean> callback);
|
||||
|
||||
void saveTrack(Track track, Callback<Boolean> callback);
|
||||
|
||||
void deleteTrack(Track track, Callback<Boolean> callback);
|
||||
|
||||
void saveUUIDData(String username, UUID uuid, Callback<Boolean> callback);
|
||||
|
||||
void getUUID(String username, Callback<UUID> callback);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
interface Future {
|
||||
java.util.concurrent.Future<Boolean> logAction(LogEntry entry);
|
||||
|
||||
java.util.concurrent.Future<Log> getLog();
|
||||
|
||||
@Deprecated
|
||||
java.util.concurrent.Future<Boolean> loadOrCreateUser(UUID uuid, String username);
|
||||
|
||||
@Deprecated
|
||||
java.util.concurrent.Future<Boolean> loadUser(UUID uuid);
|
||||
|
||||
java.util.concurrent.Future<Boolean> loadUser(UUID uuid, String username);
|
||||
|
||||
java.util.concurrent.Future<Boolean> saveUser(User user);
|
||||
|
||||
java.util.concurrent.Future<Boolean> cleanupUsers();
|
||||
|
||||
java.util.concurrent.Future<Set<UUID>> getUniqueUsers();
|
||||
|
||||
java.util.concurrent.Future<Boolean> createAndLoadGroup(String name);
|
||||
|
||||
java.util.concurrent.Future<Boolean> loadGroup(String name);
|
||||
|
||||
java.util.concurrent.Future<Boolean> loadAllGroups();
|
||||
|
||||
java.util.concurrent.Future<Boolean> saveGroup(Group group);
|
||||
|
||||
java.util.concurrent.Future<Boolean> deleteGroup(Group group);
|
||||
|
||||
java.util.concurrent.Future<Boolean> createAndLoadTrack(String name);
|
||||
|
||||
java.util.concurrent.Future<Boolean> loadTrack(String name);
|
||||
|
||||
java.util.concurrent.Future<Boolean> loadAllTracks();
|
||||
|
||||
java.util.concurrent.Future<Boolean> saveTrack(Track track);
|
||||
|
||||
java.util.concurrent.Future<Boolean> deleteTrack(Track track);
|
||||
|
||||
java.util.concurrent.Future<Boolean> saveUUIDData(String username, UUID uuid);
|
||||
|
||||
java.util.concurrent.Future<UUID> getUUID(String username);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.data.DatastoreConfiguration;
|
||||
import me.lucko.luckperms.api.data.MySQLConfiguration;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -44,22 +43,6 @@ public interface LPConfiguration {
|
||||
*/
|
||||
int getSyncTime();
|
||||
|
||||
/**
|
||||
* Returns the default group, in a node representation
|
||||
* @return the default group, in a node representation
|
||||
* @deprecated as of 2.6, the default group is always "default"
|
||||
*/
|
||||
@Deprecated
|
||||
String getDefaultGroupNode();
|
||||
|
||||
/**
|
||||
* Returns the name of the default group
|
||||
* @return the name of the default group
|
||||
* @deprecated as of 2.6, the default group is always "default"
|
||||
*/
|
||||
@Deprecated
|
||||
String getDefaultGroupName();
|
||||
|
||||
/**
|
||||
* Returns if the users on this server will have their global permissions applied
|
||||
* @return if the users on this server will have their global permissions applied
|
||||
@@ -118,15 +101,6 @@ public interface LPConfiguration {
|
||||
*/
|
||||
boolean getLogNotify();
|
||||
|
||||
/**
|
||||
* Returns true if permission checks are being recorded / debugged
|
||||
* @return true if permission checks are being recorded / debugged
|
||||
* @since 2.9
|
||||
* @deprecated as this value is now always false. Functionality was replaced by the verbose command.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean getDebugPermissionChecks();
|
||||
|
||||
/**
|
||||
* Returns true if the vanilla op system is enabled
|
||||
* @return true if the vanilla op system is enabled
|
||||
@@ -162,15 +136,6 @@ public interface LPConfiguration {
|
||||
*/
|
||||
boolean getVaultIncludeGlobal();
|
||||
|
||||
/**
|
||||
* Returns the database values set in the configuration
|
||||
* @return the database values set in the configuration
|
||||
* @deprecated use {@link #getDatastoreConfig()}
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
MySQLConfiguration getDatabaseValues();
|
||||
|
||||
/**
|
||||
* Returns the values set for data storage in the configuration
|
||||
* @return the values set for data storage in the configuration
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextListener;
|
||||
import me.lucko.luckperms.api.context.ContextCalculator;
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.api.context.IContextCalculator;
|
||||
import me.lucko.luckperms.api.event.LPListener;
|
||||
import me.lucko.luckperms.api.event.EventBus;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
@@ -42,37 +41,31 @@ public interface LuckPermsApi {
|
||||
void runUpdateTask();
|
||||
|
||||
/**
|
||||
* Gets the API version
|
||||
* @return the version of the API running on the platform
|
||||
* @since 2.6
|
||||
*/
|
||||
double getApiVersion();
|
||||
|
||||
/**
|
||||
* Gets the plugin version
|
||||
* @return the version of the plugin running on the platform
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
/**
|
||||
* Gets the platform LuckPerms is running on
|
||||
* @return the platform LuckPerms is running on
|
||||
* @since 2.7
|
||||
*/
|
||||
PlatformType getPlatformType();
|
||||
|
||||
/**
|
||||
* Registers a listener to be sent LuckPerms events
|
||||
*
|
||||
* @param listener the listener instance
|
||||
* @throws NullPointerException if the listener is null
|
||||
* Gets the event bus, used for subscribing to events
|
||||
* @return the event bus
|
||||
* @since 3.0
|
||||
*/
|
||||
void registerListener(LPListener listener);
|
||||
|
||||
/**
|
||||
* Unregisters a previously registered listener from the EventBus
|
||||
*
|
||||
* @param listener the listener instance to unregister
|
||||
* @throws NullPointerException if the listener is null
|
||||
*/
|
||||
void unregisterListener(LPListener listener);
|
||||
EventBus getEventBus();
|
||||
|
||||
/**
|
||||
* Gets a wrapped {@link LPConfiguration} instance, with read only access
|
||||
@@ -89,16 +82,6 @@ public interface LuckPermsApi {
|
||||
*/
|
||||
Storage getStorage();
|
||||
|
||||
/**
|
||||
* Gets a wrapped Datastore instance.
|
||||
*
|
||||
* @return a datastore instance
|
||||
* @deprecated in favour of {@link #getStorage()}
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
Datastore getDatastore();
|
||||
|
||||
/**
|
||||
* Gets the messaging service in use on the platform, if present.
|
||||
*
|
||||
@@ -274,15 +257,7 @@ public interface LuckPermsApi {
|
||||
* @param contextCalculator the context calculator to register. The type MUST be the player class of the platform.
|
||||
* @throws ClassCastException if the type is not the player class of the platform.
|
||||
*/
|
||||
void registerContextCalculator(IContextCalculator<?> contextCalculator);
|
||||
|
||||
/**
|
||||
* Registers a custom context listener to the server,
|
||||
*
|
||||
* @param contextListener the context listener to register. The type MUST be the player class of the platform.
|
||||
* @throws ClassCastException if the type is not the player class of the platform.
|
||||
*/
|
||||
void registerContextListener(ContextListener<?> contextListener);
|
||||
void registerContextCalculator(ContextCalculator<?> contextCalculator);
|
||||
|
||||
/**
|
||||
* Gets a calculated context instance for the user using the rules of the platform.
|
||||
@@ -295,7 +270,7 @@ public interface LuckPermsApi {
|
||||
Optional<Contexts> getContextForUser(User user);
|
||||
|
||||
/**
|
||||
* Gets set of contexts applicable to a player using the platforms {@link IContextCalculator}s.
|
||||
* Gets set of contexts applicable to a player using the platforms {@link ContextCalculator}s.
|
||||
*
|
||||
* @param player the player to calculate for. Must be the player instance for the platform.
|
||||
* @return a set of contexts.
|
||||
|
||||
@@ -133,31 +133,6 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
*/
|
||||
boolean shouldApplyWithContext(ContextSet context);
|
||||
|
||||
/**
|
||||
* If this node should apply in the given context
|
||||
*
|
||||
* @param context the context key value pairs
|
||||
* @param worldAndServer if world and server contexts should be checked
|
||||
* @return true if the node should apply
|
||||
* @deprecated in favour of {@link #shouldApplyWithContext(ContextSet, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean shouldApplyWithContext(Map<String, String> context, boolean worldAndServer) {
|
||||
return shouldApplyWithContext(ContextSet.fromMap(context), worldAndServer);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this node should apply in the given context
|
||||
*
|
||||
* @param context the context key value pairs
|
||||
* @return true if the node should apply
|
||||
* @deprecated in favour of {@link #shouldApplyWithContext(ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean shouldApplyWithContext(Map<String, String> context) {
|
||||
return shouldApplyWithContext(ContextSet.fromMap(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #shouldApplyOnServer(String, boolean, boolean)}, except this method accepts a List
|
||||
*
|
||||
@@ -227,15 +202,6 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
*/
|
||||
boolean hasExpired();
|
||||
|
||||
/**
|
||||
* @return the extra contexts required for this node to apply
|
||||
* @deprecated in favour of {@link #getContexts()}
|
||||
*/
|
||||
@Deprecated
|
||||
default Map<String, String> getExtraContexts() {
|
||||
return getContexts().toMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the extra contexts required for this node to apply
|
||||
* @since 2.13
|
||||
|
||||
@@ -25,7 +25,6 @@ package me.lucko.luckperms.api;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
@@ -73,17 +72,6 @@ public interface PermissionHolder {
|
||||
*/
|
||||
Set<? extends Node> getTransientPermissions();
|
||||
|
||||
|
||||
/**
|
||||
* Gets an immutable set of the nodes that this object has and inherits
|
||||
*
|
||||
* @return an immutable set of permissions
|
||||
* @since 2.6
|
||||
* @deprecated in favour of {@link #getAllNodes(Contexts)}
|
||||
*/
|
||||
@Deprecated
|
||||
Set<Node> getAllNodes();
|
||||
|
||||
/**
|
||||
* Gets a mutable sorted set of the nodes that this object has and inherits, filtered by context
|
||||
* Unlike {@link #getAllNodesFiltered(Contexts)}, this method will not filter individual nodes. The context is only
|
||||
@@ -117,15 +105,6 @@ public interface PermissionHolder {
|
||||
*/
|
||||
Map<String, Boolean> exportNodes(Contexts contexts, boolean lowerCase);
|
||||
|
||||
/**
|
||||
* Gets an immutable Map of the objects permission nodes
|
||||
*
|
||||
* @return an immutable map of permissions
|
||||
* @deprecated in favour of {@link #getPermissions()}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Boolean> getNodes();
|
||||
|
||||
/**
|
||||
* Removes temporary permissions that have expired
|
||||
*/
|
||||
@@ -631,86 +610,4 @@ public interface PermissionHolder {
|
||||
*/
|
||||
Set<Node> getTemporaryPermissionNodes();
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server and world
|
||||
*
|
||||
* @param server The server to get nodes for
|
||||
* @param world The world to get nodes for
|
||||
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
|
||||
* @param possibleNodes A list of possible permission nodes for wildcard permission handling
|
||||
* @return a {@link Map} of the permissions
|
||||
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups, List<String> possibleNodes);
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server and world
|
||||
*
|
||||
* @param server The server to get nodes for
|
||||
* @param world The world to get nodes for
|
||||
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
|
||||
* @return a {@link Map} of the permissions
|
||||
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups);
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server
|
||||
*
|
||||
* @param server The server to get nodes for
|
||||
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
|
||||
* @param possibleNodes A list of possible permission nodes for wildcard permission handling
|
||||
* @return a {@link Map} of the permissions
|
||||
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups, List<String> possibleNodes);
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server
|
||||
*
|
||||
* @param server The server to get nodes for
|
||||
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
|
||||
* @return a {@link Map} of the permissions
|
||||
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups);
|
||||
|
||||
/**
|
||||
* Convert the holders nodes into a Map of permissions to be applied on the platform
|
||||
*
|
||||
* @param server the server
|
||||
* @param world the world
|
||||
* @param extraContext any extra context to filter by
|
||||
* @param includeGlobal whether to include global nodes
|
||||
* @param possibleNodes a list of possible permissions for resolving wildcards
|
||||
* @param applyGroups if inherited group permissions should be included
|
||||
* @return a map of permissions
|
||||
* @since 2.6
|
||||
* @deprecated in favour of {@link #getAllNodesFiltered(Contexts)}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Boolean> getPermissions(String server, String world, Map<String, String> extraContext, boolean includeGlobal, List<String> possibleNodes, boolean applyGroups);
|
||||
|
||||
/**
|
||||
* Processes the nodes and returns the temporary ones.
|
||||
*
|
||||
* @return a map of temporary nodes
|
||||
* @deprecated in favour of {@link #getTemporaryPermissionNodes()}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<Map.Entry<String, Boolean>, Long> getTemporaryNodes();
|
||||
|
||||
/**
|
||||
* Processes the nodes and returns the non-temporary ones.
|
||||
*
|
||||
* @return a map of permanent nodes
|
||||
* @deprecated in favour of {@link #getPermanentPermissionNodes()}
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Boolean> getPermanentNodes();
|
||||
|
||||
}
|
||||
|
||||
@@ -31,12 +31,7 @@ public enum PlatformType {
|
||||
|
||||
BUKKIT("Bukkit"),
|
||||
BUNGEE("Bungee"),
|
||||
SPONGE("Sponge"),
|
||||
|
||||
/**
|
||||
* @since 2.9
|
||||
*/
|
||||
STANDALONE("Standalone");
|
||||
SPONGE("Sponge");
|
||||
|
||||
private final String friendlyName;
|
||||
|
||||
|
||||
@@ -22,55 +22,34 @@
|
||||
|
||||
package me.lucko.luckperms.api.context;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* A simple implementation of the listener aspects of {@link IContextCalculator}
|
||||
* Calculates whether contexts are applicable to {@link T}
|
||||
*
|
||||
* @param <T> the subject type
|
||||
* <p>Somewhat inspired by the system used on Sponge.
|
||||
*
|
||||
* @param <T> the subject type. Is ALWAYS the player class of the platform.
|
||||
*/
|
||||
public abstract class ContextCalculator<T> implements IContextCalculator<T> {
|
||||
private final List<ContextListener<T>> listeners = new CopyOnWriteArrayList<>();
|
||||
public interface ContextCalculator<T> {
|
||||
|
||||
/**
|
||||
* Pushes an update to all registered {@link ContextListener}s.
|
||||
* Make sure any changes are applied internally before this method is called.
|
||||
* Gives the subject all of the applicable contexts they meet
|
||||
*
|
||||
* @param subject the subject that changed
|
||||
* @param before the context state before the change
|
||||
* @param current the context state after the change (now)
|
||||
* @throws NullPointerException if any parameters are null
|
||||
* @param subject the subject to add contexts to
|
||||
* @param accumulator a map of contexts to add to
|
||||
* @return the map
|
||||
* @since 2.13
|
||||
*/
|
||||
protected void pushUpdate(T subject, Map.Entry<String, String> before, Map.Entry<String, String> current) {
|
||||
if (subject == null) {
|
||||
throw new NullPointerException("subject");
|
||||
}
|
||||
if (before == null) {
|
||||
throw new NullPointerException("before");
|
||||
}
|
||||
if (current == null) {
|
||||
throw new NullPointerException("current");
|
||||
}
|
||||
MutableContextSet giveApplicableContext(T subject, MutableContextSet accumulator);
|
||||
|
||||
for (ContextListener<T> listener : listeners) {
|
||||
try {
|
||||
listener.onContextChange(subject, before, current);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception whilst passing context change to listener: " + listener);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(ContextListener<T> listener) {
|
||||
if (listener == null) {
|
||||
throw new NullPointerException("listener");
|
||||
}
|
||||
|
||||
listeners.add(listener);
|
||||
}
|
||||
/**
|
||||
* Checks to see if a context is applicable to a subject
|
||||
*
|
||||
* @param subject the subject to check against
|
||||
* @param context the context to check for
|
||||
* @return true if met, or false if not. If this calculator does not calculate the given context, return false.
|
||||
*/
|
||||
boolean isContextApplicable(T subject, Map.Entry<String, String> context);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.context;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Calculates whether contexts are applicable to {@link T}
|
||||
*
|
||||
* <p>Somewhat inspired by the system used on Sponge.
|
||||
*
|
||||
* @param <T> the subject type. Is ALWAYS the player class of the platform.
|
||||
*/
|
||||
public interface IContextCalculator<T> {
|
||||
|
||||
/**
|
||||
* Gives the subject all of the applicable contexts they meet
|
||||
*
|
||||
* @param subject the subject to add contexts to
|
||||
* @param accumulator a map of contexts to add to
|
||||
* @return the map
|
||||
* @since 2.13
|
||||
*/
|
||||
MutableContextSet giveApplicableContext(T subject, MutableContextSet accumulator);
|
||||
|
||||
/**
|
||||
* Checks to see if a context is applicable to a subject
|
||||
*
|
||||
* @param subject the subject to check against
|
||||
* @param context the context to check for
|
||||
* @return true if met, or false if not. If this calculator does not calculate the given context, return false.
|
||||
*/
|
||||
boolean isContextApplicable(T subject, Map.Entry<String, String> context);
|
||||
|
||||
/**
|
||||
* Adds a listener to be called whenever a context handled by this calculator changes
|
||||
*
|
||||
* @param listener the listener instance
|
||||
* @throws NullPointerException if listener is null
|
||||
*/
|
||||
void addListener(ContextListener<T> listener);
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.data;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* A callback used to wait for the completion of asynchronous operations.
|
||||
* All callbacks are ran on the main server thread.
|
||||
*
|
||||
* @param <T> the return type
|
||||
* @deprecated in favour of {@link Consumer}
|
||||
*/
|
||||
@Deprecated
|
||||
public interface Callback<T> {
|
||||
|
||||
static <T> Callback<T> empty() {
|
||||
return t -> {
|
||||
};
|
||||
}
|
||||
|
||||
static <T> Callback<T> of(Runnable runnable) {
|
||||
if (runnable == null) {
|
||||
throw new NullPointerException("runnable");
|
||||
}
|
||||
return t -> runnable.run();
|
||||
}
|
||||
|
||||
static <T> Callback<T> of(Consumer<T> consumer) {
|
||||
if (consumer == null) {
|
||||
throw new NullPointerException("consumer");
|
||||
}
|
||||
return consumer::accept;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for converting old {@link Callback}s to use the new {@link me.lucko.luckperms.api.Storage}
|
||||
* interface.
|
||||
*
|
||||
* @param callback the callback to convert
|
||||
* @param <T> the return type
|
||||
* @return a consumer instance
|
||||
* @since 2.14
|
||||
* @deprecated in favour of just using {@link Consumer}s.
|
||||
*/
|
||||
@Deprecated
|
||||
static <T> Consumer<T> convertToConsumer(Callback<T> callback) {
|
||||
return callback::onComplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the operation completes.
|
||||
*
|
||||
* @param t the return value, may be null
|
||||
*/
|
||||
void onComplete(T t);
|
||||
|
||||
}
|
||||
@@ -26,8 +26,7 @@ package me.lucko.luckperms.api.data;
|
||||
* Represents the data section of the main LuckPerms configuration.
|
||||
* All methods could return null.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public interface DatastoreConfiguration extends MySQLConfiguration {
|
||||
public interface DatastoreConfiguration {
|
||||
|
||||
String getAddress();
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event;
|
||||
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class AbstractPermissionAddEvent extends TargetedEvent<PermissionHolder> {
|
||||
|
||||
private final String server;
|
||||
private final String world;
|
||||
private final long expiry;
|
||||
|
||||
protected AbstractPermissionAddEvent(String eventName, PermissionHolder target, String server, String world, long expiry) {
|
||||
super(eventName, target);
|
||||
this.server = server;
|
||||
this.world = world;
|
||||
this.expiry = expiry;
|
||||
}
|
||||
|
||||
public Optional<String> getServer() {
|
||||
return Optional.ofNullable(server);
|
||||
}
|
||||
|
||||
public Optional<String> getWorld() {
|
||||
return Optional.ofNullable(world);
|
||||
}
|
||||
|
||||
public boolean isTemporary() {
|
||||
return expiry != 0L;
|
||||
}
|
||||
|
||||
public long getExpiry() {
|
||||
return expiry;
|
||||
}
|
||||
}
|
||||
+9
-12
@@ -22,21 +22,18 @@
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
|
||||
import me.lucko.luckperms.api.User;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Represents an event acting upon a user.
|
||||
* Represents an event that can be cancelled
|
||||
*/
|
||||
public class UserEvent extends LPEvent {
|
||||
public interface Cancellable {
|
||||
|
||||
private final User user;
|
||||
/**
|
||||
* Gets an {@link AtomicBoolean} holding the cancellation state of the event
|
||||
*
|
||||
* @return the cancellation
|
||||
*/
|
||||
AtomicBoolean getCancellationState();
|
||||
|
||||
protected UserEvent(String eventName, User user) {
|
||||
super(eventName);
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
+20
-26
@@ -22,39 +22,33 @@
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Abstract LuckPerms Event class.
|
||||
* The LuckPerms event bus. Used for subscribing (or registering listeners) to events.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public abstract class LPEvent {
|
||||
public interface EventBus {
|
||||
|
||||
/**
|
||||
* A friendly name of the event
|
||||
* Subscribe to an event
|
||||
*
|
||||
* @param eventClass the event class
|
||||
* @param handler the event handler
|
||||
* @param <T> the event class
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
private final String eventName;
|
||||
<T extends LuckPermsEvent> EventHandler<T> subscribe(Class<T> eventClass, Consumer<T> handler);
|
||||
|
||||
/**
|
||||
* A link to the API instance provided for convenience.
|
||||
* Gets a set of all registered handlers for a given event
|
||||
*
|
||||
* @param eventClass the event to find handlers for
|
||||
* @param <T> the event class
|
||||
* @return an immutable set of event handlers
|
||||
*/
|
||||
private LuckPermsApi api = null;
|
||||
|
||||
protected LPEvent(String eventName) {
|
||||
this.eventName = eventName;
|
||||
}
|
||||
|
||||
public String getEventName() {
|
||||
return eventName;
|
||||
}
|
||||
|
||||
public LuckPermsApi getApi() {
|
||||
return api;
|
||||
}
|
||||
|
||||
public void setApi(LuckPermsApi api) {
|
||||
if (this.api != null) {
|
||||
throw new IllegalStateException("API can only be set once.");
|
||||
}
|
||||
this.api = api;
|
||||
}
|
||||
<T extends LuckPermsEvent> Set<EventHandler<T>> getHandlers(Class<T> eventClass);
|
||||
|
||||
}
|
||||
+38
-31
@@ -22,41 +22,48 @@
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class AbstractPermissionRemoveEvent extends TargetedEvent<PermissionHolder> {
|
||||
|
||||
private final String server;
|
||||
private final String world;
|
||||
private final boolean temporary;
|
||||
|
||||
protected AbstractPermissionRemoveEvent(String eventName, PermissionHolder target, String server, String world, boolean temporary) {
|
||||
super(eventName, target);
|
||||
this.server = server;
|
||||
this.world = world;
|
||||
this.temporary = temporary;
|
||||
}
|
||||
|
||||
public Optional<String> getServer() {
|
||||
return Optional.ofNullable(server);
|
||||
}
|
||||
|
||||
public Optional<String> getWorld() {
|
||||
return Optional.ofNullable(world);
|
||||
}
|
||||
/**
|
||||
* Represents a handler for a LuckPerms event
|
||||
*
|
||||
* @param <T> the event class
|
||||
*/
|
||||
public interface EventHandler<T extends LuckPermsEvent> {
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #isTemporary()}
|
||||
* Gets the class this handler is listening to
|
||||
*
|
||||
* @return the event class
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getTemporary() {
|
||||
return temporary;
|
||||
}
|
||||
Class<T> getEventClass();
|
||||
|
||||
public boolean isTemporary() {
|
||||
return temporary;
|
||||
}
|
||||
/**
|
||||
* Returns true if this handler is active
|
||||
*
|
||||
* @return true if this handler is still active
|
||||
*/
|
||||
boolean isActive();
|
||||
|
||||
/**
|
||||
* Unregisters this handler from the event bus
|
||||
*
|
||||
* @return true if the handler wasn't already unregistered
|
||||
*/
|
||||
boolean unregister();
|
||||
|
||||
/**
|
||||
* Gets the event consumer responsible for handling the event
|
||||
*
|
||||
* @return the event consumer
|
||||
*/
|
||||
Consumer<T> getConsumer();
|
||||
|
||||
/**
|
||||
* Gets the number of times this handler has been called
|
||||
*
|
||||
* @return the number of times this handler has been called
|
||||
*/
|
||||
int getCallCount();
|
||||
|
||||
}
|
||||
+11
-12
@@ -22,21 +22,20 @@
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
|
||||
/**
|
||||
* Represents an event acting upon a target
|
||||
* The base event interface
|
||||
*
|
||||
* @param <T> the target type
|
||||
* @since 3.0
|
||||
*/
|
||||
public class TargetedEvent<T> extends LPEvent {
|
||||
public interface LuckPermsEvent {
|
||||
|
||||
private final T target;
|
||||
/**
|
||||
* Get the API instance this event was dispatched from
|
||||
*
|
||||
* @return the api instance
|
||||
*/
|
||||
LuckPermsApi getApi();
|
||||
|
||||
protected TargetedEvent(String eventName, T target) {
|
||||
super(eventName);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public T getTarget() {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.cause;
|
||||
|
||||
/**
|
||||
* The cause of a group/track creation
|
||||
*/
|
||||
public enum CreationCause {
|
||||
|
||||
/**
|
||||
* The creation was caused by a command
|
||||
*/
|
||||
COMMAND,
|
||||
|
||||
/**
|
||||
* The creation was caused by an API call
|
||||
*/
|
||||
API,
|
||||
|
||||
/**
|
||||
* The creation was caused by a LuckPerms internal
|
||||
*/
|
||||
INTERNAL;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.cause;
|
||||
|
||||
/**
|
||||
* The cause of a group/track deletion
|
||||
*/
|
||||
public enum DeletionCause {
|
||||
|
||||
/**
|
||||
* The deletion was caused by a command
|
||||
*/
|
||||
COMMAND,
|
||||
|
||||
/**
|
||||
* The deletion was caused by an API call
|
||||
*/
|
||||
API,
|
||||
|
||||
/**
|
||||
* The deletion was caused by a LuckPerms internal
|
||||
*/
|
||||
INTERNAL;
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.events;
|
||||
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.AbstractPermissionAddEvent;
|
||||
|
||||
/**
|
||||
* Called whenever a user or group is added to / starts to inherit another group
|
||||
*/
|
||||
public class GroupAddEvent extends AbstractPermissionAddEvent {
|
||||
|
||||
/**
|
||||
* The group being added to the target
|
||||
*/
|
||||
private final Group group;
|
||||
|
||||
public GroupAddEvent(PermissionHolder target, Group group, String server, String world, long expiry) {
|
||||
super("Group Add Event", target, server, world, expiry);
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.events;
|
||||
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.AbstractPermissionRemoveEvent;
|
||||
|
||||
/**
|
||||
* Called whenever a user or group is removed from / stops inheriting another group
|
||||
*/
|
||||
public class GroupRemoveEvent extends AbstractPermissionRemoveEvent {
|
||||
|
||||
/**
|
||||
* The name of group being removed from the target.
|
||||
* Be aware that this group may have already been deleted, and and instance may therefore not exist internally.
|
||||
*/
|
||||
private final String group;
|
||||
|
||||
public GroupRemoveEvent(PermissionHolder target, String group, String server, String world, boolean temporary) {
|
||||
super("Group Remove Event", target, server, world, temporary);
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.events;
|
||||
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.TargetedEvent;
|
||||
|
||||
/**
|
||||
* Called when a permission expires for an object.
|
||||
*
|
||||
* @deprecated in favour of {@link PermissionNodeExpireEvent}
|
||||
*/
|
||||
@Deprecated
|
||||
public class PermissionExpireEvent extends TargetedEvent<PermissionHolder> {
|
||||
|
||||
private final String node;
|
||||
|
||||
public PermissionExpireEvent(PermissionHolder target, String node) {
|
||||
super("Permission Expire Event", target);
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
public String getNode() {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.events;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.AbstractPermissionEvent;
|
||||
|
||||
/**
|
||||
* Called when a temporary permission node expires
|
||||
*
|
||||
* @since 2.6
|
||||
*/
|
||||
public class PermissionNodeExpireEvent extends AbstractPermissionEvent {
|
||||
public PermissionNodeExpireEvent(PermissionHolder target, Node node) {
|
||||
super("Permission Node Expire Event", target, node);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.events;
|
||||
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.AbstractPermissionAddEvent;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Called whenever a user or group has a permission set.
|
||||
*
|
||||
* @deprecated in favour of {@link PermissionNodeSetEvent}
|
||||
*/
|
||||
@Deprecated
|
||||
public class PermissionSetEvent extends AbstractPermissionAddEvent {
|
||||
|
||||
private final String node;
|
||||
private final boolean value;
|
||||
|
||||
public PermissionSetEvent(PermissionHolder target, String node, boolean value, String server, String world, long expiry) {
|
||||
super("Permission Set Event", target, server, world, expiry);
|
||||
this.node = node;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getNode() {
|
||||
return node;
|
||||
}
|
||||
|
||||
public boolean getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Map.Entry<String, Boolean> getEntry() {
|
||||
return new AbstractMap.SimpleEntry<>(node, value);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.events;
|
||||
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.AbstractPermissionRemoveEvent;
|
||||
|
||||
/**
|
||||
* Called whenever a user or group has a permission unset.
|
||||
*
|
||||
* @deprecated in favour of {@link PermissionNodeUnsetEvent}
|
||||
*/
|
||||
@Deprecated
|
||||
public class PermissionUnsetEvent extends AbstractPermissionRemoveEvent {
|
||||
|
||||
private final String node;
|
||||
|
||||
public PermissionUnsetEvent(PermissionHolder target, String node, String server, String world, boolean temporary) {
|
||||
super("Permission Unset Event", target, server, world, temporary);
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
public String getNode() {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
/**
|
||||
* Called when a group is created
|
||||
*/
|
||||
public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the new group
|
||||
*
|
||||
* @return the new group
|
||||
*/
|
||||
Group getGroup();
|
||||
|
||||
/**
|
||||
* Gets the cause of the creation
|
||||
*
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
CreationCause getCause();
|
||||
|
||||
}
|
||||
+29
-10
@@ -20,19 +20,38 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.AbstractPermissionEvent;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Called when a permission node is unset from a holder
|
||||
*
|
||||
* @since 2.6
|
||||
* Called when a group is deleted
|
||||
*/
|
||||
public class PermissionNodeUnsetEvent extends AbstractPermissionEvent {
|
||||
public PermissionNodeUnsetEvent(PermissionHolder target, Node node) {
|
||||
super("Permission Node Unset Event", target, node);
|
||||
}
|
||||
public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the name of the deleted group
|
||||
*
|
||||
* @return the name of the deleted group
|
||||
*/
|
||||
String getGroupName();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the groups existing data
|
||||
*
|
||||
* @return a copy of the groups existing data
|
||||
*/
|
||||
Set<Node> getExistingData();
|
||||
|
||||
/**
|
||||
* Gets the cause of the deletion
|
||||
*
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
DeletionCause getCause();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when all groups have been loaded in from storage.
|
||||
*
|
||||
* <p>Usually only called on startup and in sync tasks.</p>
|
||||
*/
|
||||
public interface GroupLoadAllEvent extends LuckPermsEvent {
|
||||
|
||||
}
|
||||
+14
-15
@@ -20,24 +20,23 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
package me.lucko.luckperms.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Event that allows listeners to set the cancelled state of an event.
|
||||
* Called when a group is loaded into memory from the storage.
|
||||
*
|
||||
* Note that this event is not the same as {@link GroupCreateEvent}
|
||||
*/
|
||||
public abstract class CancellableEvent extends LPEvent {
|
||||
public interface GroupLoadEvent extends LuckPermsEvent {
|
||||
|
||||
private boolean cancelled = false;
|
||||
/**
|
||||
* Gets the group that was loaded
|
||||
*
|
||||
* @return the group that was loaded
|
||||
*/
|
||||
Group getGroup();
|
||||
|
||||
protected CancellableEvent(String eventName) {
|
||||
super(eventName);
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when a log entry is about to be sent to notifiable players on the platform
|
||||
*/
|
||||
public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the log entry to be broadcasted
|
||||
*
|
||||
* @return the log entry to be broadcasted
|
||||
*/
|
||||
LogEntry getEntry();
|
||||
|
||||
}
|
||||
+12
-14
@@ -20,24 +20,22 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
package me.lucko.luckperms.api.event.log;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* @since 2.6
|
||||
* Called when a log is about to be published to the storage file/table
|
||||
*/
|
||||
public class AbstractPermissionEvent extends TargetedEvent<PermissionHolder> {
|
||||
public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
private final Node node;
|
||||
/**
|
||||
* Gets the log entry to be published
|
||||
*
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
LogEntry getEntry();
|
||||
|
||||
protected AbstractPermissionEvent(String eventName, PermissionHolder target, Node node) {
|
||||
super(eventName, target);
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
public Node getNode() {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
+11
-10
@@ -20,19 +20,20 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.data;
|
||||
package me.lucko.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link DatastoreConfiguration}. This is now used by multiple datastores, not just MySQL.
|
||||
* Called when a node is added to a holder
|
||||
*/
|
||||
@Deprecated
|
||||
public interface MySQLConfiguration {
|
||||
public interface NodeAddEvent extends NodeMutateEvent {
|
||||
|
||||
String getAddress();
|
||||
/**
|
||||
* Gets the node that was added
|
||||
*
|
||||
* @return the node that was added
|
||||
*/
|
||||
Node getNode();
|
||||
|
||||
String getDatabase();
|
||||
|
||||
String getUsername();
|
||||
|
||||
String getPassword();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.node;
|
||||
|
||||
/**
|
||||
* Called when a holder has their nodes cleared
|
||||
*/
|
||||
public interface NodeClearEvent extends NodeMutateEvent {
|
||||
|
||||
}
|
||||
+46
-9
@@ -20,19 +20,56 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.AbstractPermissionEvent;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Called when a permission node is set on a holder
|
||||
*
|
||||
* @since 2.6
|
||||
* Called when a node is added to/removed from a user/group
|
||||
*/
|
||||
public class PermissionNodeSetEvent extends AbstractPermissionEvent {
|
||||
public PermissionNodeSetEvent(PermissionHolder target, Node node) {
|
||||
super("Permission Node Set Event", target, node);
|
||||
}
|
||||
public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the target of the event
|
||||
*
|
||||
* @return the event target
|
||||
*/
|
||||
PermissionHolder getTarget();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the holders data before the change
|
||||
*
|
||||
* @return the data before the change
|
||||
*/
|
||||
Set<Node> getDataBefore();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the holders data after the change
|
||||
*
|
||||
* @return the data after the change
|
||||
*/
|
||||
Set<Node> getDataAfter();
|
||||
|
||||
/**
|
||||
* Gets whether the target of this event is a {@link me.lucko.luckperms.api.User}
|
||||
*
|
||||
* <p>This is equivalent to checking if getTarget() instanceof User</p>
|
||||
*
|
||||
* @return if the event is targeting a user
|
||||
*/
|
||||
boolean isUser();
|
||||
|
||||
/**
|
||||
* Gets whether the target of this event is a {@link me.lucko.luckperms.api.Group}
|
||||
*
|
||||
* <p>This is equivalent to checking if getTarget() instanceof Group</p>
|
||||
*
|
||||
* @return if the event is targeting a group
|
||||
*/
|
||||
boolean isGroup();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
|
||||
/**
|
||||
* Called when a node is removed from a holder
|
||||
*/
|
||||
public interface NodeRemoveEvent extends NodeMutateEvent {
|
||||
|
||||
/**
|
||||
* Gets the node that was removed
|
||||
*
|
||||
* @return the node that was removed
|
||||
*/
|
||||
Node getNode();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when the configuration is reloaded
|
||||
*/
|
||||
public interface ConfigReloadEvent extends LuckPermsEvent {
|
||||
|
||||
}
|
||||
+4
-8
@@ -20,17 +20,13 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.LPEvent;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called after the sync task has ran.
|
||||
* Called when an sync task has been completed
|
||||
*/
|
||||
public class PostSyncEvent extends LPEvent {
|
||||
|
||||
public PostSyncEvent() {
|
||||
super("Post Sync Event");
|
||||
}
|
||||
public interface PostSyncEvent extends LuckPermsEvent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called before a network sync task runs
|
||||
*/
|
||||
public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the ID of the sync request
|
||||
*
|
||||
* @return the id of the sync request
|
||||
*/
|
||||
UUID getSyncId();
|
||||
|
||||
}
|
||||
+5
-9
@@ -20,18 +20,14 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.CancellableEvent;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called before the sync task is about to run.
|
||||
* Set this event to cancelled to prevent the sync task from running.
|
||||
* Called before a sync task runs
|
||||
*/
|
||||
public class PreSyncEvent extends CancellableEvent {
|
||||
|
||||
public PreSyncEvent() {
|
||||
super("Pre Sync Event");
|
||||
}
|
||||
public interface PreSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.track;
|
||||
|
||||
import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
/**
|
||||
* Called when a track is created
|
||||
*/
|
||||
public interface TrackCreateEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the new track
|
||||
*
|
||||
* @return the new track
|
||||
*/
|
||||
Track getTrack();
|
||||
|
||||
/**
|
||||
* Gets the cause of the creation
|
||||
*
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
CreationCause getCause();
|
||||
|
||||
}
|
||||
+24
-11
@@ -20,24 +20,37 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.context;
|
||||
package me.lucko.luckperms.api.event.track;
|
||||
|
||||
import java.util.Map;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Listens to context changes
|
||||
*
|
||||
* @param <T> the subject type, Is ALWAYS the player class of the platform.
|
||||
* Called when a track is deleted
|
||||
*/
|
||||
public interface ContextListener<T> {
|
||||
public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Called whenever a context changes on the
|
||||
* Gets the name of the deleted track
|
||||
*
|
||||
* @param subject the subject that had context changed
|
||||
* @param before the context state before the change
|
||||
* @param current the context state after the change (now)
|
||||
* @return the name of the deleted track
|
||||
*/
|
||||
void onContextChange(T subject, Map.Entry<String, String> before, Map.Entry<String, String> current) throws Exception;
|
||||
String getTrackName();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the tracks existing data
|
||||
*
|
||||
* @return a copy of the tracks existing data
|
||||
*/
|
||||
List<String> getExistingData();
|
||||
|
||||
/**
|
||||
* Gets the cause of the deletion
|
||||
*
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
DeletionCause getCause();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.track;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when all tracks have been loaded in from storage.
|
||||
*
|
||||
* <p>Usually only called on startup and in sync tasks.</p>
|
||||
*/
|
||||
public interface TrackLoadAllEvent extends LuckPermsEvent {
|
||||
|
||||
}
|
||||
+12
-8
@@ -20,19 +20,23 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.track;
|
||||
|
||||
import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.TrackEvent;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called whenever a user is promoted up a track
|
||||
* Called when a track is loaded into memory from the storage.
|
||||
*
|
||||
* Note that this event is not the same as {@link TrackCreateEvent}
|
||||
*/
|
||||
public class UserPromoteEvent extends TrackEvent {
|
||||
public interface TrackLoadEvent extends LuckPermsEvent {
|
||||
|
||||
public UserPromoteEvent(Track track, User user, String from, String to) {
|
||||
super("User Promote Event", track, user, from, to);
|
||||
}
|
||||
/**
|
||||
* Gets the track that was loaded
|
||||
*
|
||||
* @return the track that was loaded
|
||||
*/
|
||||
Track getTrack();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.track.mutate;
|
||||
|
||||
/**
|
||||
* Called when a group is added to a track
|
||||
*/
|
||||
public interface TrackAddGroupEvent extends TrackMutateEvent {
|
||||
|
||||
/**
|
||||
* Gets the group that was added
|
||||
*
|
||||
* @return the group that was added
|
||||
*/
|
||||
String getGroup();
|
||||
|
||||
}
|
||||
+4
-3
@@ -20,10 +20,11 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
package me.lucko.luckperms.api.event.track.mutate;
|
||||
|
||||
/**
|
||||
* Used to mark a class that listens for LuckPerms events
|
||||
* Called when a track is cleared
|
||||
*/
|
||||
public interface LPListener {
|
||||
public interface TrackClearEvent extends TrackMutateEvent {
|
||||
|
||||
}
|
||||
+23
-16
@@ -20,30 +20,37 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.track.mutate;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.CancellableEvent;
|
||||
import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Called before a LogEntry is broadcasted to players only with the notify permission.
|
||||
* The log entry will still be recorded in the datastore, regardless of the cancellation state of this event.
|
||||
* Cancelling this event only stops the broadcast.
|
||||
* Called when a track is changed
|
||||
*/
|
||||
public class LogNotifyEvent extends CancellableEvent {
|
||||
public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* The log entry to be broadcasted
|
||||
* Gets the track that was mutated
|
||||
*
|
||||
* @return the track that was mutated
|
||||
*/
|
||||
private final LogEntry entry;
|
||||
Track getTrack();
|
||||
|
||||
public LogNotifyEvent(LogEntry entry) {
|
||||
super("Log Notify Event");
|
||||
this.entry = entry;
|
||||
}
|
||||
/**
|
||||
* Gets an immutable copy of the tracks data before the change
|
||||
*
|
||||
* @return the data before the change
|
||||
*/
|
||||
List<String> getDataBefore();
|
||||
|
||||
public LogEntry getEntry() {
|
||||
return entry;
|
||||
}
|
||||
/**
|
||||
* Gets an immutable copy of the tracks data after the change
|
||||
*
|
||||
* @return the data after the change
|
||||
*/
|
||||
List<String> getDataAfter();
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.track.mutate;
|
||||
|
||||
/**
|
||||
* Called when a group is removed from a track
|
||||
*/
|
||||
public interface TrackRemoveGroupEvent extends TrackMutateEvent {
|
||||
|
||||
/**
|
||||
* Gets the group that was removed
|
||||
*
|
||||
* @return the group that was removed
|
||||
*/
|
||||
String getGroup();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.user;
|
||||
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when a users {@link me.lucko.luckperms.api.caching.UserData} is loaded.
|
||||
*/
|
||||
public interface UserCacheLoadEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the user whose data was loaded
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
* Gets the data that was loaded
|
||||
*
|
||||
* @return the loaded data
|
||||
*/
|
||||
UserData getLoadedData();
|
||||
|
||||
}
|
||||
+18
-8
@@ -20,19 +20,29 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.user;
|
||||
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.UserEvent;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called after a user has their permissions refreshed. If you cache user permissions within your own plugin, it's a
|
||||
* good idea to update said cache whenever this event is called.
|
||||
* Called when a users cached data is refreshed
|
||||
*/
|
||||
public class UserPermissionRefreshEvent extends UserEvent {
|
||||
public interface UserDataRecalculateEvent extends LuckPermsEvent {
|
||||
|
||||
public UserPermissionRefreshEvent(User user) {
|
||||
super("User Permission Refresh Event", user);
|
||||
}
|
||||
/**
|
||||
* Gets the user whose data was recalculated
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
* Gets the data that was recalculated
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
UserData getData();
|
||||
|
||||
}
|
||||
+22
-20
@@ -20,35 +20,37 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.user;
|
||||
|
||||
import me.lucko.luckperms.api.event.LPEvent;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called when the user logs into the network for the first time. Particularly useful for networks with multiple
|
||||
* lobbies, who want to welcome a user when they join for the first time.
|
||||
* Called when the user logs into the network for the first time.
|
||||
*
|
||||
* <p>Particularly useful for networks with multiple
|
||||
* lobbies, who want to welcome a user when they join for the first time.</p>
|
||||
*
|
||||
* <p>This event is fired before the player has actually joined the game on the async login / auth event. If you want to
|
||||
* do something with the user, store the UUID in a set, and then check the set in the PlayerJoinEvent o.e.
|
||||
* do something with the user, store the UUID in a set, and then check the set in the PlayerJoinEvent o.e.</p>
|
||||
*
|
||||
* <p>The users data will not be loaded when this event is called.</p>
|
||||
*/
|
||||
public class UserFirstLoginEvent extends LPEvent {
|
||||
public interface UserFirstLoginEvent extends LuckPermsEvent {
|
||||
|
||||
private final UUID uuid;
|
||||
private final String username;
|
||||
/**
|
||||
* Gets the UUID of the user
|
||||
*
|
||||
* @return the uuid of the user
|
||||
*/
|
||||
UUID getUuid();
|
||||
|
||||
public UserFirstLoginEvent(UUID uuid, String username) {
|
||||
super("User First Join Event");
|
||||
this.uuid = uuid;
|
||||
this.username = username;
|
||||
}
|
||||
/**
|
||||
* Gets the username of the user
|
||||
*
|
||||
* @return the username of the user
|
||||
*/
|
||||
String getUsername();
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
+10
-8
@@ -20,19 +20,21 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.events;
|
||||
package me.lucko.luckperms.api.event.user;
|
||||
|
||||
import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.TrackEvent;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called whenever a user is demoted down a track
|
||||
* Called when a user is loaded into memory from the storage.
|
||||
*/
|
||||
public class UserDemoteEvent extends TrackEvent {
|
||||
public interface UserLoadEvent extends LuckPermsEvent {
|
||||
|
||||
public UserDemoteEvent(Track track, User user, String from, String to) {
|
||||
super("User Demote Event", track, user, from, to);
|
||||
}
|
||||
/**
|
||||
* Gets the user that was loaded
|
||||
*
|
||||
* @return the user that was loaded
|
||||
*/
|
||||
User getUser();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.user.track;
|
||||
|
||||
/**
|
||||
* Represents the type of action performed in a {@link UserTrackEvent}
|
||||
*/
|
||||
public enum TrackAction {
|
||||
|
||||
/**
|
||||
* The user was promoted up a track
|
||||
*/
|
||||
PROMOTION,
|
||||
|
||||
/**
|
||||
* The user was demoted down a track
|
||||
*/
|
||||
DEMOTION;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.user.track;
|
||||
|
||||
/**
|
||||
* Called when a user is demoted down a track.
|
||||
*
|
||||
* <p>{@link #getAction()} is always {@link TrackAction#DEMOTION}</p>
|
||||
*/
|
||||
public interface UserDemoteEvent extends UserTrackEvent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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.api.event.user.track;
|
||||
|
||||
/**
|
||||
* Called when a user is promoted up a track.
|
||||
*
|
||||
* <p>{@link #getAction()} is always {@link TrackAction#PROMOTION}</p>
|
||||
*/
|
||||
public interface UserPromoteEvent extends UserTrackEvent {
|
||||
|
||||
}
|
||||
+40
-25
@@ -20,39 +20,54 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
package me.lucko.luckperms.api.event.user.track;
|
||||
|
||||
import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
public abstract class TrackEvent extends LPEvent {
|
||||
import java.util.Optional;
|
||||
|
||||
private final Track track;
|
||||
private final User user;
|
||||
private final String fromGroup;
|
||||
private final String toGroup;
|
||||
/**
|
||||
* Called when a user interacts with a track through a promotion or demotion
|
||||
*/
|
||||
public interface UserTrackEvent extends LuckPermsEvent {
|
||||
|
||||
protected TrackEvent(String eventName, Track track, User user, String fromGroup, String toGroup) {
|
||||
super(eventName);
|
||||
this.track = track;
|
||||
this.user = user;
|
||||
this.fromGroup = fromGroup;
|
||||
this.toGroup = toGroup;
|
||||
}
|
||||
/**
|
||||
* Gets the track involved in the event
|
||||
*
|
||||
* @return the track involved in the event
|
||||
*/
|
||||
Track getTrack();
|
||||
|
||||
public Track getTrack() {
|
||||
return track;
|
||||
}
|
||||
/**
|
||||
* Gets the user who was promoted or demoted
|
||||
*
|
||||
* @return the user involved in the event
|
||||
*/
|
||||
User getUser();
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
/**
|
||||
* Gets the action performed
|
||||
*
|
||||
* @return the action performed
|
||||
*/
|
||||
TrackAction getAction();
|
||||
|
||||
public String getFromGroup() {
|
||||
return fromGroup;
|
||||
}
|
||||
/**
|
||||
* Gets the group the user was promoted/demoted from.
|
||||
*
|
||||
* <p>May be {@link Optional#empty()} if the user wasn't already placed on the track.</p>
|
||||
*
|
||||
* @return the group the user was promoted/demoted from
|
||||
*/
|
||||
Optional<String> getGroupFrom();
|
||||
|
||||
/**
|
||||
* Gets the group the user was promoted/demoted to
|
||||
*
|
||||
* @return the group the user was promoted/demoted to
|
||||
*/
|
||||
Optional<String> getGroupTo();
|
||||
|
||||
public String getToGroup() {
|
||||
return toGroup;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user