mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-02-17 14:37:43 +01:00
Extract interfaces for all events.
This is in preparation for moving to event-impl-gen.
This commit is contained in:
@@ -23,9 +23,9 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.velocitypowered.api.event.EventManager;
|
||||
import com.velocitypowered.api.event.lifecycle.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.event.lifecycle.ProxyReloadEvent;
|
||||
import com.velocitypowered.api.event.lifecycle.ProxyShutdownEvent;
|
||||
import com.velocitypowered.api.event.lifecycle.ProxyInitializeEventImpl;
|
||||
import com.velocitypowered.api.event.lifecycle.ProxyReloadEventImpl;
|
||||
import com.velocitypowered.api.event.lifecycle.ProxyShutdownEventImpl;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.plugin.PluginManager;
|
||||
@@ -214,7 +214,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
|
||||
// Go ahead and fire the proxy initialization event. We block since plugins should have a chance
|
||||
// to fully initialize before we accept any connections to the server.
|
||||
eventManager.fire(new ProxyInitializeEvent()).join();
|
||||
eventManager.fire(new ProxyInitializeEventImpl()).join();
|
||||
|
||||
// init console permissions after plugins are loaded
|
||||
console.setupPermissions();
|
||||
@@ -390,7 +390,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
|
||||
ipAttemptLimiter = Ratelimiters.createWithMilliseconds(newConfiguration.getLoginRatelimit());
|
||||
this.configuration = newConfiguration;
|
||||
eventManager.fireAndForget(new ProxyReloadEvent());
|
||||
eventManager.fireAndForget(new ProxyReloadEventImpl());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
}
|
||||
|
||||
try {
|
||||
eventManager.fire(new ProxyShutdownEvent()).get(10, TimeUnit.SECONDS);
|
||||
eventManager.fire(new ProxyShutdownEventImpl()).get(10, TimeUnit.SECONDS);
|
||||
} catch (TimeoutException e) {
|
||||
timedOut = true;
|
||||
} catch (ExecutionException e) {
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.velocitypowered.api.command.RawCommand;
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import com.velocitypowered.api.event.command.CommandExecuteEvent;
|
||||
import com.velocitypowered.api.event.command.CommandExecuteEvent.CommandResult;
|
||||
import com.velocitypowered.api.event.command.CommandExecuteEventImpl;
|
||||
import com.velocitypowered.proxy.event.VelocityEventManager;
|
||||
import com.velocitypowered.proxy.util.BrigadierUtils;
|
||||
import java.util.Iterator;
|
||||
@@ -117,7 +118,7 @@ public class VelocityCommandManager implements CommandManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires a {@link CommandExecuteEvent}.
|
||||
* Fires a {@link CommandExecuteEventImpl}.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param cmdLine the command to execute
|
||||
@@ -127,7 +128,7 @@ public class VelocityCommandManager implements CommandManager {
|
||||
final String cmdLine) {
|
||||
Preconditions.checkNotNull(source, "source");
|
||||
Preconditions.checkNotNull(cmdLine, "cmdLine");
|
||||
return eventManager.fire(new CommandExecuteEvent(source, cmdLine));
|
||||
return eventManager.fire(new CommandExecuteEventImpl(source, cmdLine));
|
||||
}
|
||||
|
||||
private boolean executeImmediately0(final CommandSource source, final String cmdLine) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.event.command.PlayerAvailableCommandsEvent;
|
||||
import com.velocitypowered.api.event.command.PlayerAvailableCommandsEventImpl;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
@@ -214,7 +214,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
|
||||
server.getEventManager().fire(
|
||||
new PlayerAvailableCommandsEvent(serverConn.getPlayer(), rootNode))
|
||||
new PlayerAvailableCommandsEventImpl(serverConn.getPlayer(), rootNode))
|
||||
.thenAcceptAsync(event -> playerConnection.write(commands), playerConnection.eventLoop())
|
||||
.exceptionally((ex) -> {
|
||||
logger.error("Exception while handling available commands for {}", playerConnection, ex);
|
||||
|
||||
@@ -20,8 +20,8 @@ package com.velocitypowered.proxy.connection.backend;
|
||||
import static com.velocitypowered.proxy.connection.backend.BackendConnectionPhases.IN_TRANSITION;
|
||||
import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeHandshakeBackendPhase.HELLO;
|
||||
|
||||
import com.velocitypowered.api.event.player.ServerConnectedEvent;
|
||||
import com.velocitypowered.api.event.player.ServerPostConnectEvent;
|
||||
import com.velocitypowered.api.event.player.ServerConnectedEventImpl;
|
||||
import com.velocitypowered.api.event.player.ServerPostConnectEventImpl;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
import com.velocitypowered.proxy.connection.ConnectionTypes;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
@@ -101,7 +101,7 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
|
||||
// The goods are in hand! We got JoinGame. Let's transition completely to the new state.
|
||||
smc.setAutoReading(false);
|
||||
server.getEventManager()
|
||||
.fire(new ServerConnectedEvent(player, serverConn.getServer(),
|
||||
.fire(new ServerConnectedEventImpl(player, serverConn.getServer(),
|
||||
existingConnection != null ? existingConnection.getServer() : null))
|
||||
.thenRunAsync(() -> {
|
||||
// Make sure we can still transition (player might have disconnected here).
|
||||
@@ -132,7 +132,7 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
|
||||
serverConn.getPlayer().setConnectedServer(serverConn);
|
||||
|
||||
// We're done! :)
|
||||
server.getEventManager().fireAndForget(new ServerPostConnectEvent(player,
|
||||
server.getEventManager().fireAndForget(new ServerPostConnectEventImpl(player,
|
||||
existingConnection == null ? null : existingConnection.getServer()));
|
||||
resultFuture.complete(ConnectionRequestResults.successful(serverConn.getServer()));
|
||||
}, smc.eventLoop())
|
||||
|
||||
@@ -25,10 +25,11 @@ import static com.velocitypowered.proxy.network.PluginMessageUtil.constructChann
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.velocitypowered.api.event.command.CommandExecuteEvent.CommandResult;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerChannelRegisterEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerChannelRegisterEventImpl;
|
||||
import com.velocitypowered.api.event.player.PlayerChatEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent;
|
||||
import com.velocitypowered.api.event.player.TabCompleteEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerChatEventImpl;
|
||||
import com.velocitypowered.api.event.player.PlayerResourcePackStatusEventImpl;
|
||||
import com.velocitypowered.api.event.player.TabCompleteEventImpl;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
@@ -173,10 +174,10 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
PlayerChatEvent event = new PlayerChatEvent(player, msg);
|
||||
PlayerChatEvent event = new PlayerChatEventImpl(player, msg);
|
||||
server.getEventManager().fire(event)
|
||||
.thenAcceptAsync(pme -> {
|
||||
PlayerChatEvent.ChatResult chatResult = pme.getResult();
|
||||
PlayerChatEventImpl.ChatResult chatResult = pme.getResult();
|
||||
if (chatResult.isAllowed()) {
|
||||
Optional<String> eventMsg = pme.getResult().getMessage();
|
||||
if (eventMsg.isPresent()) {
|
||||
@@ -224,7 +225,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
channelIdentifiers.add(new LegacyChannelIdentifier(channel));
|
||||
}
|
||||
}
|
||||
server.getEventManager().fireAndForget(new PlayerChannelRegisterEvent(player,
|
||||
server.getEventManager().fireAndForget(new PlayerChannelRegisterEventImpl(player,
|
||||
ImmutableList.copyOf(channelIdentifiers)));
|
||||
backendConn.write(packet.retain());
|
||||
} else if (PluginMessageUtil.isUnregister(packet)) {
|
||||
@@ -286,7 +287,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
@Override
|
||||
public boolean handle(ServerboundResourcePackResponsePacket packet) {
|
||||
server.getEventManager().fireAndForget(new PlayerResourcePackStatusEvent(player,
|
||||
server.getEventManager().fireAndForget(new PlayerResourcePackStatusEventImpl(player,
|
||||
packet.getStatus()));
|
||||
return false;
|
||||
}
|
||||
@@ -576,7 +577,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
for (Offer offer : response.getOffers()) {
|
||||
offers.add(offer.getText());
|
||||
}
|
||||
server.getEventManager().fire(new TabCompleteEvent(player, request.getCommand(), offers))
|
||||
server.getEventManager().fire(new TabCompleteEventImpl(player, request.getCommand(), offers))
|
||||
.thenAcceptAsync(e -> {
|
||||
response.getOffers().clear();
|
||||
for (String s : e.getSuggestions()) {
|
||||
|
||||
@@ -25,14 +25,17 @@ import com.google.common.base.Preconditions;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.velocitypowered.api.event.player.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.player.DisconnectEvent.LoginStatus;
|
||||
import com.velocitypowered.api.event.player.DisconnectEventImpl;
|
||||
import com.velocitypowered.api.event.player.KickedFromServerEvent;
|
||||
import com.velocitypowered.api.event.player.KickedFromServerEvent.DisconnectPlayer;
|
||||
import com.velocitypowered.api.event.player.KickedFromServerEvent.Notify;
|
||||
import com.velocitypowered.api.event.player.KickedFromServerEvent.RedirectPlayer;
|
||||
import com.velocitypowered.api.event.player.KickedFromServerEvent.ServerKickResult;
|
||||
import com.velocitypowered.api.event.player.PlayerModInfoEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerSettingsChangedEvent;
|
||||
import com.velocitypowered.api.event.player.KickedFromServerEventImpl;
|
||||
import com.velocitypowered.api.event.player.PlayerModInfoEventImpl;
|
||||
import com.velocitypowered.api.event.player.PlayerSettingsChangedEventImpl;
|
||||
import com.velocitypowered.api.event.player.ServerPreConnectEvent;
|
||||
import com.velocitypowered.api.event.player.ServerPreConnectEventImpl;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.permission.PermissionFunction;
|
||||
import com.velocitypowered.api.permission.PermissionProvider;
|
||||
@@ -59,7 +62,6 @@ import com.velocitypowered.proxy.network.StateRegistry;
|
||||
import com.velocitypowered.proxy.network.packet.AbstractPluginMessagePacket;
|
||||
import com.velocitypowered.proxy.network.packet.clientbound.ClientboundChatPacket;
|
||||
import com.velocitypowered.proxy.network.packet.clientbound.ClientboundDisconnectPacket;
|
||||
import com.velocitypowered.proxy.network.packet.clientbound.ClientboundHeaderAndFooterPacket;
|
||||
import com.velocitypowered.proxy.network.packet.clientbound.ClientboundKeepAlivePacket;
|
||||
import com.velocitypowered.proxy.network.packet.clientbound.ClientboundPluginMessagePacket;
|
||||
import com.velocitypowered.proxy.network.packet.clientbound.ClientboundResourcePackRequestPacket;
|
||||
@@ -212,7 +214,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
void setPlayerSettings(ServerboundClientSettingsPacket settings) {
|
||||
ClientSettingsWrapper cs = new ClientSettingsWrapper(settings);
|
||||
this.settings = cs;
|
||||
server.getEventManager().fireAndForget(new PlayerSettingsChangedEvent(this, cs));
|
||||
server.getEventManager().fireAndForget(new PlayerSettingsChangedEventImpl(this, cs));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,7 +224,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
|
||||
public void setModInfo(ModInfo modInfo) {
|
||||
this.modInfo = modInfo;
|
||||
server.getEventManager().fireAndForget(new PlayerModInfoEvent(this, modInfo));
|
||||
server.getEventManager().fireAndForget(new PlayerModInfoEventImpl(this, modInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -505,7 +507,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
}
|
||||
result = Notify.create(friendlyReason);
|
||||
}
|
||||
KickedFromServerEvent originalEvent = new KickedFromServerEvent(this, rs, kickReason,
|
||||
KickedFromServerEvent originalEvent = new KickedFromServerEventImpl(this, rs, kickReason,
|
||||
!kickedFromCurrent, result);
|
||||
handleKickEvent(originalEvent, friendlyReason, kickedFromCurrent);
|
||||
}
|
||||
@@ -669,7 +671,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
Optional<Player> connectedPlayer = server.getPlayer(this.getUniqueId());
|
||||
server.unregisterConnection(this);
|
||||
|
||||
DisconnectEvent.LoginStatus status;
|
||||
DisconnectEventImpl.LoginStatus status;
|
||||
if (connectedPlayer.isPresent()) {
|
||||
if (!connectedPlayer.get().getCurrentServer().isPresent()) {
|
||||
status = LoginStatus.PRE_SERVER_JOIN;
|
||||
@@ -682,7 +684,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
LoginStatus.CANCELLED_BY_USER;
|
||||
}
|
||||
|
||||
DisconnectEvent event = new DisconnectEvent(this, status);
|
||||
DisconnectEvent event = new DisconnectEventImpl(this, status);
|
||||
server.getEventManager().fire(event).whenComplete((val, ex) -> {
|
||||
if (ex == null) {
|
||||
this.teardownFuture.complete(null);
|
||||
@@ -852,7 +854,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
return completedFuture(plainResult(initialCheck.get(), toConnect));
|
||||
}
|
||||
|
||||
ServerPreConnectEvent event = new ServerPreConnectEvent(ConnectedPlayer.this,
|
||||
ServerPreConnectEvent event = new ServerPreConnectEventImpl(ConnectedPlayer.this,
|
||||
toConnect);
|
||||
return server.getEventManager().fire(event)
|
||||
.thenComposeAsync(newEvent -> {
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.velocitypowered.proxy.connection.client;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.connection.ConnectionHandshakeEvent;
|
||||
import com.velocitypowered.api.event.connection.ConnectionHandshakeEventImpl;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.connection.InboundConnection;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
@@ -136,7 +136,7 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
server.getEventManager().fireAndForget(new ConnectionHandshakeEvent(ic));
|
||||
server.getEventManager().fireAndForget(new ConnectionHandshakeEventImpl(ic));
|
||||
connection.setSessionHandler(new LoginSessionHandler(server, connection, ic));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,17 @@ import static com.velocitypowered.proxy.util.EncryptionUtils.decryptRsa;
|
||||
import static com.velocitypowered.proxy.util.EncryptionUtils.generateServerId;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
||||
import com.velocitypowered.api.event.player.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.permission.PermissionsSetupEventImpl;
|
||||
import com.velocitypowered.api.event.player.DisconnectEvent.LoginStatus;
|
||||
import com.velocitypowered.api.event.player.DisconnectEventImpl;
|
||||
import com.velocitypowered.api.event.player.GameProfileRequestEvent;
|
||||
import com.velocitypowered.api.event.player.LoginEvent;
|
||||
import com.velocitypowered.api.event.player.LoginEventImpl;
|
||||
import com.velocitypowered.api.event.player.PlayerChooseInitialServerEvent;
|
||||
import com.velocitypowered.api.event.player.PostLoginEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerChooseInitialServerEventImpl;
|
||||
import com.velocitypowered.api.event.player.PostLoginEventImpl;
|
||||
import com.velocitypowered.api.event.player.PreLoginEvent;
|
||||
import com.velocitypowered.api.event.player.PreLoginEvent.PreLoginComponentResult;
|
||||
import com.velocitypowered.api.event.player.PreLoginEventImpl;
|
||||
import com.velocitypowered.api.permission.PermissionFunction;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.util.GameProfile;
|
||||
@@ -176,7 +178,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
if (login == null) {
|
||||
throw new IllegalStateException("No ServerLogin packet received yet.");
|
||||
}
|
||||
PreLoginEvent event = new PreLoginEvent(inbound, login.getUsername());
|
||||
PreLoginEvent event = new PreLoginEventImpl(inbound, login.getUsername());
|
||||
server.getEventManager().fire(event)
|
||||
.thenRunAsync(() -> {
|
||||
if (mcConnection.isClosed()) {
|
||||
@@ -245,7 +247,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
logger.info("{} has connected", player);
|
||||
|
||||
return server.getEventManager()
|
||||
.fire(new PermissionsSetupEvent(player, ConnectedPlayer.DEFAULT_PERMISSIONS))
|
||||
.fire(new PermissionsSetupEventImpl(player, ConnectedPlayer.DEFAULT_PERMISSIONS))
|
||||
.thenAcceptAsync(event -> {
|
||||
if (!mcConnection.isClosed()) {
|
||||
// wait for permissions to load, then set the players permission function
|
||||
@@ -285,11 +287,11 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
mcConnection.setAssociation(player);
|
||||
mcConnection.setState(StateRegistry.PLAY);
|
||||
|
||||
server.getEventManager().fire(new LoginEvent(player))
|
||||
server.getEventManager().fire(new LoginEventImpl(player))
|
||||
.thenAcceptAsync(event -> {
|
||||
if (mcConnection.isClosed()) {
|
||||
// The player was disconnected
|
||||
server.getEventManager().fireAndForget(new DisconnectEvent(player,
|
||||
server.getEventManager().fireAndForget(new DisconnectEventImpl(player,
|
||||
LoginStatus.CANCELLED_BY_USER_BEFORE_COMPLETE));
|
||||
return;
|
||||
}
|
||||
@@ -305,7 +307,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
|
||||
mcConnection.setSessionHandler(new InitialConnectSessionHandler(player));
|
||||
server.getEventManager().fire(new PostLoginEvent(player))
|
||||
server.getEventManager().fire(new PostLoginEventImpl(player))
|
||||
.thenCompose((ignored) -> connectToInitialServer(player))
|
||||
.exceptionally((ex) -> {
|
||||
logger.error("Exception while connecting {} to initial server", player, ex);
|
||||
@@ -321,7 +323,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
private CompletableFuture<Void> connectToInitialServer(ConnectedPlayer player) {
|
||||
Optional<RegisteredServer> initialFromConfig = player.getNextServerToTry();
|
||||
PlayerChooseInitialServerEvent event = new PlayerChooseInitialServerEvent(player,
|
||||
PlayerChooseInitialServerEvent event = new PlayerChooseInitialServerEventImpl(player,
|
||||
initialFromConfig.orElse(null));
|
||||
|
||||
return server.getEventManager().fire(event)
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.velocitypowered.proxy.connection.client;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.spotify.futures.CompletableFutures;
|
||||
import com.velocitypowered.api.event.connection.ProxyPingEvent;
|
||||
import com.velocitypowered.api.event.connection.ProxyPingEventImpl;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.connection.InboundConnection;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
@@ -182,7 +182,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
this.pingReceived = true;
|
||||
getInitialPing()
|
||||
.thenCompose(ping -> server.getEventManager().fire(new ProxyPingEvent(inbound, ping)))
|
||||
.thenCompose(ping -> server.getEventManager().fire(new ProxyPingEventImpl(inbound, ping)))
|
||||
.thenAcceptAsync(event -> connection.closeWith(
|
||||
LegacyDisconnectPacket.fromServerPing(event.getPing(), packet.getVersion())),
|
||||
connection.eventLoop())
|
||||
@@ -207,7 +207,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
|
||||
this.pingReceived = true;
|
||||
|
||||
getInitialPing()
|
||||
.thenCompose(ping -> server.getEventManager().fire(new ProxyPingEvent(inbound, ping)))
|
||||
.thenCompose(ping -> server.getEventManager().fire(new ProxyPingEventImpl(inbound, ping)))
|
||||
.thenAcceptAsync(
|
||||
(event) -> {
|
||||
StringBuilder json = new StringBuilder();
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.velocitypowered.api.permission.PermissionFunction.ALWAYS_TRUE;
|
||||
|
||||
import com.velocitypowered.api.command.ConsoleCommandSource;
|
||||
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
||||
import com.velocitypowered.api.event.permission.PermissionsSetupEventImpl;
|
||||
import com.velocitypowered.api.permission.PermissionFunction;
|
||||
import com.velocitypowered.api.permission.Tristate;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
@@ -72,7 +73,7 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons
|
||||
* Sets up permissions for the console.
|
||||
*/
|
||||
public void setupPermissions() {
|
||||
PermissionsSetupEvent event = new PermissionsSetupEvent(this, s -> ALWAYS_TRUE);
|
||||
PermissionsSetupEvent event = new PermissionsSetupEventImpl(this, s -> ALWAYS_TRUE);
|
||||
// we can safely block here, this is before any listeners fire
|
||||
this.permissionFunction = this.server.getEventManager().fire(event).join().createFunction(this);
|
||||
if (this.permissionFunction == null) {
|
||||
|
||||
@@ -21,8 +21,8 @@ import static org.asynchttpclient.Dsl.asyncHttpClient;
|
||||
import static org.asynchttpclient.Dsl.config;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.lifecycle.network.ListenerBoundEvent;
|
||||
import com.velocitypowered.api.event.lifecycle.network.ListenerClosedEvent;
|
||||
import com.velocitypowered.api.event.lifecycle.network.ListenerBoundEventImpl;
|
||||
import com.velocitypowered.api.event.lifecycle.network.ListenerClosedEventImpl;
|
||||
import com.velocitypowered.api.network.ListenerType;
|
||||
import com.velocitypowered.natives.util.Natives;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
@@ -136,7 +136,7 @@ public final class ConnectionManager {
|
||||
|
||||
// Fire the proxy bound event after the socket is bound
|
||||
server.getEventManager().fireAndForget(
|
||||
new ListenerBoundEvent(address, ListenerType.MINECRAFT));
|
||||
new ListenerBoundEventImpl(address, ListenerType.MINECRAFT));
|
||||
} else {
|
||||
LOGGER.error("Can't bind to {}", address, future.cause());
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class ConnectionManager {
|
||||
|
||||
// Fire the proxy bound event after the socket is bound
|
||||
server.getEventManager().fireAndForget(
|
||||
new ListenerBoundEvent(address, ListenerType.QUERY));
|
||||
new ListenerBoundEventImpl(address, ListenerType.QUERY));
|
||||
} else {
|
||||
LOGGER.error("Can't bind to {}", bootstrap.config().localAddress(), future.cause());
|
||||
}
|
||||
@@ -203,7 +203,7 @@ public final class ConnectionManager {
|
||||
|
||||
// Fire proxy close event to notify plugins of socket close. We block since plugins
|
||||
// should have a chance to be notified before the server stops accepting connections.
|
||||
server.getEventManager().fire(new ListenerClosedEvent(oldBind, endpoint.getType())).join();
|
||||
server.getEventManager().fire(new ListenerClosedEventImpl(oldBind, endpoint.getType())).join();
|
||||
|
||||
Channel serverChannel = endpoint.getChannel();
|
||||
|
||||
@@ -222,7 +222,7 @@ public final class ConnectionManager {
|
||||
|
||||
// Fire proxy close event to notify plugins of socket close. We block since plugins
|
||||
// should have a chance to be notified before the server stops accepting connections.
|
||||
server.getEventManager().fire(new ListenerClosedEvent(address, endpoint.getType())).join();
|
||||
server.getEventManager().fire(new ListenerClosedEventImpl(address, endpoint.getType())).join();
|
||||
|
||||
try {
|
||||
LOGGER.info("Closing endpoint {}", address);
|
||||
|
||||
@@ -23,7 +23,7 @@ import static com.velocitypowered.api.event.connection.ProxyQueryEvent.QueryType
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.velocitypowered.api.event.connection.ProxyQueryEvent;
|
||||
import com.velocitypowered.api.event.connection.ProxyQueryEventImpl;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.plugin.PluginDescription;
|
||||
@@ -151,7 +151,7 @@ public class GS4QueryHandler extends SimpleChannelInboundHandler<DatagramPacket>
|
||||
|
||||
// Call event and write response
|
||||
server.getEventManager()
|
||||
.fire(new ProxyQueryEvent(isBasic ? BASIC : FULL, senderAddress, response))
|
||||
.fire(new ProxyQueryEventImpl(isBasic ? BASIC : FULL, senderAddress, response))
|
||||
.whenCompleteAsync((event, exc) -> {
|
||||
// Packet header
|
||||
ByteBuf queryResponse = ctx.alloc().buffer();
|
||||
|
||||
Reference in New Issue
Block a user