Skip to content

Commit

Permalink
feat: use continuation on ServerPreConnect listener
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed Feb 10, 2023
1 parent bcd43d8 commit e00c564
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -39,7 +39,7 @@ public final class ServerPermissions {
private Configuration configuration;

@Subscribe
void onProxyInitialize(ProxyInitializeEvent event) {
void onProxyInitialize(final ProxyInitializeEvent event) {
try {
configuration = Configuration.loadConfig(path);
} catch (IOException e) {
Expand Down
@@ -1,6 +1,7 @@
package io.github._4drian3d.serverpermissions.listener;

import com.google.inject.Inject;
import com.velocitypowered.api.event.Continuation;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.player.ServerPreConnectEvent;
import com.velocitypowered.api.proxy.Player;
Expand All @@ -14,7 +15,7 @@ public final class ServerListener {
private ServerPermissions plugin;

@Subscribe
void onServerSwitch(ServerPreConnectEvent event) {
void onServerSwitch(final ServerPreConnectEvent event, final Continuation continuation) {
event.getResult().getServer().ifPresent(server -> {
final Player player = event.getPlayer();
final String serverName = server.getServerInfo().getName();
Expand All @@ -27,5 +28,6 @@ void onServerSwitch(ServerPreConnectEvent event) {
player.sendMessage(message);
}
});
continuation.resume();
}
}

0 comments on commit e00c564

Please sign in to comment.