mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Update PostOrder names and don't use lombok in API
This commit is contained in:
parent
2277b98dfd
commit
4c297092a5
4 changed files with 28 additions and 15 deletions
|
@ -25,10 +25,6 @@
|
||||||
|
|
||||||
package org.geysermc.geyser.api.event;
|
package org.geysermc.geyser.api.event;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
@ -58,9 +54,6 @@ public @interface Subscribe {
|
||||||
/**
|
/**
|
||||||
* Represents the post order of an event.
|
* Represents the post order of an event.
|
||||||
*/
|
*/
|
||||||
@Accessors(fluent = true)
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
enum PostOrder {
|
enum PostOrder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,12 +61,12 @@ public @interface Subscribe {
|
||||||
* allow for other events to customize
|
* allow for other events to customize
|
||||||
* the outcome
|
* the outcome
|
||||||
*/
|
*/
|
||||||
LOWEST(net.kyori.event.PostOrders.FIRST),
|
FIRST(net.kyori.event.PostOrders.FIRST),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The second lowest priority.
|
* The second lowest priority.
|
||||||
*/
|
*/
|
||||||
LOW(net.kyori.event.PostOrders.EARLY),
|
EARLY(net.kyori.event.PostOrders.EARLY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normal priority. Event is neither
|
* Normal priority. Event is neither
|
||||||
|
@ -84,14 +77,27 @@ public @interface Subscribe {
|
||||||
/**
|
/**
|
||||||
* The second highest priority
|
* The second highest priority
|
||||||
*/
|
*/
|
||||||
HIGH(net.kyori.event.PostOrders.LATE),
|
LATE(net.kyori.event.PostOrders.LATE),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The highest of importance! Event is called
|
* The highest of importance! Event is called
|
||||||
* last and has the final say in the outcome
|
* last and has the final say in the outcome
|
||||||
*/
|
*/
|
||||||
HIGHEST(net.kyori.event.PostOrders.LAST);
|
LAST(net.kyori.event.PostOrders.LAST);
|
||||||
|
|
||||||
private final int postOrder;
|
private final int postOrder;
|
||||||
|
|
||||||
|
PostOrder(int postOrder) {
|
||||||
|
this.postOrder = postOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The numerical post order value.
|
||||||
|
*
|
||||||
|
* @return numerical post order value
|
||||||
|
*/
|
||||||
|
public int postOrder() {
|
||||||
|
return this.postOrder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,22 +25,26 @@
|
||||||
|
|
||||||
package org.geysermc.geyser.api.event.connection;
|
package org.geysermc.geyser.api.event.connection;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.geysermc.geyser.api.connection.GeyserConnection;
|
import org.geysermc.geyser.api.connection.GeyserConnection;
|
||||||
import org.geysermc.geyser.api.event.Event;
|
import org.geysermc.geyser.api.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event that contains a {@link GeyserConnection}.
|
* An event that contains a {@link GeyserConnection}.
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
|
||||||
public abstract class ConnectionEvent implements Event {
|
public abstract class ConnectionEvent implements Event {
|
||||||
private final GeyserConnection connection;
|
private final GeyserConnection connection;
|
||||||
|
|
||||||
|
public ConnectionEvent(@NonNull GeyserConnection connection) {
|
||||||
|
this.connection = connection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link GeyserConnection}.
|
* Gets the {@link GeyserConnection}.
|
||||||
*
|
*
|
||||||
* @return the connection
|
* @return the connection
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
public GeyserConnection connection() {
|
public GeyserConnection connection() {
|
||||||
return this.connection;
|
return this.connection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.geysermc.geyser.api.event.downstream;
|
package org.geysermc.geyser.api.event.downstream;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.geysermc.geyser.api.connection.GeyserConnection;
|
import org.geysermc.geyser.api.connection.GeyserConnection;
|
||||||
import org.geysermc.geyser.api.event.Cancellable;
|
import org.geysermc.geyser.api.event.Cancellable;
|
||||||
import org.geysermc.geyser.api.event.connection.ConnectionEvent;
|
import org.geysermc.geyser.api.event.connection.ConnectionEvent;
|
||||||
|
@ -38,7 +39,7 @@ public class ServerDefineCommandsEvent extends ConnectionEvent implements Cancel
|
||||||
private final Set<? extends CommandInfo> commands;
|
private final Set<? extends CommandInfo> commands;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public ServerDefineCommandsEvent(GeyserConnection connection, Set<? extends CommandInfo> commands) {
|
public ServerDefineCommandsEvent(@NonNull GeyserConnection connection, @NonNull Set<? extends CommandInfo> commands) {
|
||||||
super(connection);
|
super(connection);
|
||||||
this.commands = commands;
|
this.commands = commands;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +49,7 @@ public class ServerDefineCommandsEvent extends ConnectionEvent implements Cancel
|
||||||
*
|
*
|
||||||
* @return a mutable collection of the commands sent over
|
* @return a mutable collection of the commands sent over
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
public Set<? extends CommandInfo> commands() {
|
public Set<? extends CommandInfo> commands() {
|
||||||
return this.commands;
|
return this.commands;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.geysermc.geyser.api.event.lifecycle;
|
package org.geysermc.geyser.api.event.lifecycle;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.geysermc.geyser.api.command.Command;
|
import org.geysermc.geyser.api.command.Command;
|
||||||
import org.geysermc.geyser.api.command.CommandManager;
|
import org.geysermc.geyser.api.command.CommandManager;
|
||||||
import org.geysermc.geyser.api.event.Event;
|
import org.geysermc.geyser.api.event.Event;
|
||||||
|
@ -38,5 +39,5 @@ import java.util.Map;
|
||||||
* @param commands a mutable list of the currently
|
* @param commands a mutable list of the currently
|
||||||
* registered default commands
|
* registered default commands
|
||||||
*/
|
*/
|
||||||
public record GeyserDefineCommandsEvent(CommandManager commandManager, Map<String, Command> commands) implements Event {
|
public record GeyserDefineCommandsEvent(@NonNull CommandManager commandManager, @NonNull Map<String, Command> commands) implements Event {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue