Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
fix: improve Velocity join/quit messages, close #180
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Mar 29, 2024
1 parent 174e90d commit 81c8d2f
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent;
import com.velocitypowered.api.event.connection.PostLoginEvent;
import com.velocitypowered.api.event.player.ServerConnectedEvent;
import net.william278.huskchat.HuskChat;
import net.william278.huskchat.user.VelocityUser;
Expand All @@ -35,19 +34,19 @@ public VelocityPlayerListener(@NotNull HuskChat plugin) {

@Subscribe
public void onPlayerChangeServer(ServerConnectedEvent e) {
if (e.getPreviousServer().isEmpty()) {
handlePlayerJoin(VelocityUser.adapt(e.getPlayer(), plugin));
}
final String server = e.getServer().getServerInfo().getName();
final VelocityUser player = VelocityUser.adapt(e.getPlayer(), plugin);
handlePlayerSwitchServer(player, server);
}

@Subscribe
public void onPlayerJoinNetwork(PostLoginEvent e) {
handlePlayerJoin(VelocityUser.adapt(e.getPlayer(), plugin));
}

@Subscribe
public void onPlayerQuitNetwork(DisconnectEvent e) {
handlePlayerQuit(VelocityUser.adapt(e.getPlayer(), plugin));
if (e.getLoginStatus() == DisconnectEvent.LoginStatus.SUCCESSFUL_LOGIN) {
handlePlayerQuit(VelocityUser.adapt(e.getPlayer(), plugin));
}
}

}

0 comments on commit 81c8d2f

Please sign in to comment.