3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-24 15:20:25 +01:00

Update PostOrder names and don't use lombok in API

Dieser Commit ist enthalten in:
RednedEpic 2022-01-16 15:31:32 -06:00
Ursprung 2277b98dfd
Commit 4c297092a5
4 geänderte Dateien mit 28 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -25,10 +25,6 @@
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.Retention;
import java.lang.annotation.RetentionPolicy;
@ -58,9 +54,6 @@ public @interface Subscribe {
/**
* Represents the post order of an event.
*/
@Accessors(fluent = true)
@Getter
@AllArgsConstructor
enum PostOrder {
/**
@ -68,12 +61,12 @@ public @interface Subscribe {
* allow for other events to customize
* the outcome
*/
LOWEST(net.kyori.event.PostOrders.FIRST),
FIRST(net.kyori.event.PostOrders.FIRST),
/**
* The second lowest priority.
*/
LOW(net.kyori.event.PostOrders.EARLY),
EARLY(net.kyori.event.PostOrders.EARLY),
/**
* Normal priority. Event is neither
@ -84,14 +77,27 @@ public @interface Subscribe {
/**
* The second highest priority
*/
HIGH(net.kyori.event.PostOrders.LATE),
LATE(net.kyori.event.PostOrders.LATE),
/**
* The highest of importance! Event is called
* 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;
PostOrder(int postOrder) {
this.postOrder = postOrder;
}
/**
* The numerical post order value.
*
* @return numerical post order value
*/
public int postOrder() {
return this.postOrder;
}
}
}

Datei anzeigen

@ -25,22 +25,26 @@
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.event.Event;
/**
* An event that contains a {@link GeyserConnection}.
*/
@RequiredArgsConstructor
public abstract class ConnectionEvent implements Event {
private final GeyserConnection connection;
public ConnectionEvent(@NonNull GeyserConnection connection) {
this.connection = connection;
}
/**
* Gets the {@link GeyserConnection}.
*
* @return the connection
*/
@NonNull
public GeyserConnection connection() {
return this.connection;
}

Datei anzeigen

@ -25,6 +25,7 @@
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.event.Cancellable;
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 boolean cancelled;
public ServerDefineCommandsEvent(GeyserConnection connection, Set<? extends CommandInfo> commands) {
public ServerDefineCommandsEvent(@NonNull GeyserConnection connection, @NonNull Set<? extends CommandInfo> commands) {
super(connection);
this.commands = commands;
}
@ -48,6 +49,7 @@ public class ServerDefineCommandsEvent extends ConnectionEvent implements Cancel
*
* @return a mutable collection of the commands sent over
*/
@NonNull
public Set<? extends CommandInfo> commands() {
return this.commands;
}

Datei anzeigen

@ -25,6 +25,7 @@
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.CommandManager;
import org.geysermc.geyser.api.event.Event;
@ -38,5 +39,5 @@ import java.util.Map;
* @param commands a mutable list of the currently
* 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 {
}