Completely rework event system
* Event instances are now generated dynamically at runtime. The performance hit of creating proxies at runtime is negligible in this case. * A better EventBus implementation is now being used internally, API contracts are unaffected.
This commit is contained in:
@@ -40,6 +40,7 @@ public interface Cancellable {
|
||||
* @return the cancellation
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(-1)
|
||||
AtomicBoolean getCancellationState();
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* 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 java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Represents the position of a parameter within an event.
|
||||
*
|
||||
* <p>This is an implementation detail and should not be relied upon.</p>
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Param {
|
||||
|
||||
/**
|
||||
* Gets the index of the parameter.
|
||||
*
|
||||
* @return the index
|
||||
*/
|
||||
int value();
|
||||
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public interface Sourced {
|
||||
* @return the source
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(-1)
|
||||
Source getSource();
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ package me.lucko.luckperms.api.event.group;
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.caching.GroupData;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -44,6 +45,7 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the group
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
|
||||
/**
|
||||
@@ -52,6 +54,7 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the loaded data
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
GroupData getLoadedData();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ 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.Param;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -42,6 +43,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
* @return the new group
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
|
||||
/**
|
||||
@@ -50,6 +52,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
CreationCause getCause();
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ package me.lucko.luckperms.api.event.group;
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.caching.GroupData;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -44,6 +45,7 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the group
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
|
||||
/**
|
||||
@@ -52,6 +54,7 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the data
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
GroupData getData();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package me.lucko.luckperms.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -44,6 +45,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
* @return the name of the deleted group
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
String getGroupName();
|
||||
|
||||
/**
|
||||
@@ -52,6 +54,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
* @return a copy of the groups existing data
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
Set<Node> getExistingData();
|
||||
|
||||
/**
|
||||
@@ -60,6 +63,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
DeletionCause getCause();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ 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.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -43,6 +44,7 @@ public interface GroupLoadEvent extends LuckPermsEvent {
|
||||
* @return the group that was loaded
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -42,6 +43,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be broadcasted
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
LogEntry getEntry();
|
||||
|
||||
/**
|
||||
@@ -51,6 +53,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
Origin getOrigin();
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -46,6 +47,7 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the id of the log entry being published
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
UUID getLogId();
|
||||
|
||||
/**
|
||||
@@ -54,6 +56,7 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
LogEntry getEntry();
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import me.lucko.luckperms.api.Entity;
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -50,6 +51,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be sent
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
LogEntry getEntry();
|
||||
|
||||
/**
|
||||
@@ -58,6 +60,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the origin of the log
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
Origin getOrigin();
|
||||
|
||||
/**
|
||||
@@ -66,6 +69,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the object to notify
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
Entity getNotifiable();
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -42,6 +43,7 @@ public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
LogEntry getEntry();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package me.lucko.luckperms.api.event.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -45,6 +46,7 @@ public interface LogReceiveEvent extends LuckPermsEvent {
|
||||
* @return the id of the log entry being received
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
UUID getLogId();
|
||||
|
||||
/**
|
||||
@@ -53,6 +55,7 @@ public interface LogReceiveEvent extends LuckPermsEvent {
|
||||
* @return the log entry being received
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
LogEntry getEntry();
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package me.lucko.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -40,6 +41,7 @@ public interface NodeAddEvent extends NodeMutateEvent {
|
||||
* @return the node that was added
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(3)
|
||||
Node getNode();
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
|
||||
package me.lucko.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -44,6 +47,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
* @return the event target
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
PermissionHolder getTarget();
|
||||
|
||||
/**
|
||||
@@ -52,6 +56,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
Set<Node> getDataBefore();
|
||||
|
||||
/**
|
||||
@@ -60,6 +65,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
Set<Node> getDataAfter();
|
||||
|
||||
/**
|
||||
@@ -69,7 +75,9 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return if the event is targeting a user
|
||||
*/
|
||||
boolean isUser();
|
||||
default boolean isUser() {
|
||||
return getTarget() instanceof User;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the target of this event is a {@link me.lucko.luckperms.api.Group}
|
||||
@@ -78,6 +86,8 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return if the event is targeting a group
|
||||
*/
|
||||
boolean isGroup();
|
||||
default boolean isGroup() {
|
||||
return getTarget() instanceof Group;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package me.lucko.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -40,6 +41,7 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
|
||||
* @return the node that was removed
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(3)
|
||||
Node getNode();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package me.lucko.luckperms.api.event.player;
|
||||
|
||||
import me.lucko.luckperms.api.PlayerSaveResult;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
import me.lucko.luckperms.api.manager.UserManager;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -48,6 +49,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
|
||||
* @return the uuid
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
@@ -56,6 +58,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
|
||||
* @return the username
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
String getUsername();
|
||||
|
||||
/**
|
||||
@@ -64,6 +67,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
|
||||
* @return the result
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
PlayerSaveResult getResult();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package me.lucko.luckperms.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -43,6 +44,7 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the id of the sync request
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
UUID getSyncId();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ 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.Param;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -42,6 +43,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
|
||||
* @return the new track
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
|
||||
/**
|
||||
@@ -50,6 +52,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
CreationCause getCause();
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package me.lucko.luckperms.api.event.track;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
import java.util.List;
|
||||
@@ -43,6 +44,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
* @return the name of the deleted track
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
String getTrackName();
|
||||
|
||||
/**
|
||||
@@ -51,6 +53,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
* @return a copy of the tracks existing data
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
List<String> getExistingData();
|
||||
|
||||
/**
|
||||
@@ -59,6 +62,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
DeletionCause getCause();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ 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.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -43,6 +44,7 @@ public interface TrackLoadEvent extends LuckPermsEvent {
|
||||
* @return the track that was loaded
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api.event.track.mutate;
|
||||
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
@@ -38,6 +40,7 @@ public interface TrackAddGroupEvent extends TrackMutateEvent {
|
||||
* @return the group that was added
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(3)
|
||||
String getGroup();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package me.lucko.luckperms.api.event.track.mutate;
|
||||
|
||||
import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,6 +44,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the track that was mutated
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
|
||||
/**
|
||||
@@ -51,6 +53,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
List<String> getDataBefore();
|
||||
|
||||
/**
|
||||
@@ -59,6 +62,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
List<String> getDataAfter();
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api.event.track.mutate;
|
||||
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
@@ -38,6 +40,7 @@ public interface TrackRemoveGroupEvent extends TrackMutateEvent {
|
||||
* @return the group that was removed
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(3)
|
||||
String getGroup();
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -42,6 +43,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the user
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
@@ -50,6 +52,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the loaded data
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
UserData getLoadedData();
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -42,6 +43,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the user
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
@@ -50,6 +52,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the data
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
UserData getData();
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package me.lucko.luckperms.api.event.user;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -50,6 +51,7 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
|
||||
* @return the uuid of the user
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
@@ -58,6 +60,7 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
|
||||
* @return the username of the user
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
String getUsername();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package me.lucko.luckperms.api.event.user;
|
||||
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -41,6 +42,7 @@ public interface UserLoadEvent extends LuckPermsEvent {
|
||||
* @return the user that was loaded
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
User getUser();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package me.lucko.luckperms.api.event.user;
|
||||
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -52,6 +53,7 @@ public interface UserLoginProcessEvent extends LuckPermsEvent {
|
||||
* @return the uuid of the connection which was processed
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
@@ -60,6 +62,7 @@ public interface UserLoginProcessEvent extends LuckPermsEvent {
|
||||
* @return the username of the connection which was processed
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
String getUsername();
|
||||
|
||||
/**
|
||||
@@ -67,6 +70,8 @@ public interface UserLoginProcessEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the user instance
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
User getUser();
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api.event.user.track;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a user is demoted down a track.
|
||||
*
|
||||
@@ -32,4 +34,9 @@ package me.lucko.luckperms.api.event.user.track;
|
||||
*/
|
||||
public interface UserDemoteEvent extends UserTrackEvent {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
default TrackAction getAction() {
|
||||
return TrackAction.DEMOTION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api.event.user.track;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a user is promoted up a track.
|
||||
*
|
||||
@@ -32,4 +34,9 @@ package me.lucko.luckperms.api.event.user.track;
|
||||
*/
|
||||
public interface UserPromoteEvent extends UserTrackEvent {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
default TrackAction getAction() {
|
||||
return TrackAction.PROMOTION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
import me.lucko.luckperms.api.event.Param;
|
||||
import me.lucko.luckperms.api.event.Sourced;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -45,6 +46,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the track involved in the event
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
|
||||
/**
|
||||
@@ -53,6 +55,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the user involved in the event
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(1)
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
@@ -71,6 +74,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the group the user was promoted/demoted from
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(2)
|
||||
Optional<String> getGroupFrom();
|
||||
|
||||
/**
|
||||
@@ -79,6 +83,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the group the user was promoted/demoted to
|
||||
*/
|
||||
@Nonnull
|
||||
@Param(3)
|
||||
Optional<String> getGroupTo();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user