Skip to content

Commit

Permalink
fix(velocity): Fixed a possible error in case someone connects with t…
Browse files Browse the repository at this point in the history
…he name of a player already connected to the server

see 4drian3d/AuthMeVelocity#63

and changed Velocity's DisconnectListener to Async
  • Loading branch information
4drian3d committed Feb 16, 2023
1 parent 5875be4 commit 07ac81e
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package me.xneox.epicguard.velocity.listener;

import com.velocitypowered.api.event.EventTask;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent;
import me.xneox.epicguard.core.EpicGuard;
Expand All @@ -26,8 +27,14 @@ public DisconnectListener(EpicGuard epicGuard) {
}

@Subscribe
public void onDisconnect(DisconnectEvent event) {
var player = event.getPlayer();
this.onDisconnect(player.getUniqueId());
public EventTask onDisconnect(DisconnectEvent event) {
if (event.getLoginStatus() == DisconnectEvent.LoginStatus.CONFLICTING_LOGIN) {
return null;
}

return EventTask.async(() -> {
var player = event.getPlayer();
this.onDisconnect(player.getUniqueId());
});
}
}

0 comments on commit 07ac81e

Please sign in to comment.