Skip to content

Commit

Permalink
fix event double firing in velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
ham1255 committed Sep 26, 2024
1 parent c622bc7 commit dab5f26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ public PlayerDataManager(RedisBungeePlugin<P> plugin) {

// handle network wide
// server change
public abstract void onPlayerChangedServerNetworkEvent(SC event);
//l public abstract void onPlayerChangedServerNetworkEvent(SC event);

public abstract void onNetworkPlayerQuit(NJE event);
// public abstract void onNetworkPlayerQuit(NJE event);

// local events
public abstract void onPubSubMessageEvent(PS event);
//public abstract void onPubSubMessageEvent(PS event);

public abstract void onServerConnectedEvent(CE event);
//public abstract void onServerConnectedEvent(CE event);

public abstract void onLoginEvent(LE event);
//public abstract void onLoginEvent(LE event);

public abstract void onDisconnectEvent(DE event);
//public abstract void onDisconnectEvent(DE event);

protected void handleNetworkPlayerServerChange(IPlayerChangedServerNetworkEvent event) {
this.serverCache.invalidate(event.getUuid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,21 @@ public BungeePlayerDataManager(RedisBungeePlugin<ProxiedPlayer> plugin) {
super(plugin);
}

@Override
@EventHandler
public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) {
super.handleNetworkPlayerServerChange(event);
}

@Override
@EventHandler
public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) {
super.handleNetworkPlayerQuit(event);
}

@Override
@EventHandler
public void onPubSubMessageEvent(PubSubMessageEvent event) {
super.handlePubSubMessageEvent(event);
}

@Override
@EventHandler
public void onServerConnectedEvent(ServerConnectedEvent event) {
final String currentServer = event.getServer().getInfo().getName();
Expand Down Expand Up @@ -87,13 +83,11 @@ public void onLoginEvent(LoginEvent event) {

}

@Override
@EventHandler
public void onLoginEvent(PostLoginEvent event) {
super.addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getName(), event.getPlayer().getAddress().getAddress());
}

@Override
@EventHandler
public void onDisconnectEvent(PlayerDisconnectEvent event) {
super.removePlayer(event.getPlayer().getUniqueId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,21 @@ public VelocityPlayerDataManager(RedisBungeePlugin<Player> plugin) {
super(plugin);
}

@Override
@Subscribe
public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) {
handleNetworkPlayerServerChange(event);
}

@Override
@Subscribe
public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) {
handleNetworkPlayerQuit(event);
}

@Override
@Subscribe
public void onPubSubMessageEvent(PubSubMessageEvent event) {
handlePubSubMessageEvent(event);
}

@Override
@Subscribe
public void onServerConnectedEvent(ServerConnectedEvent event) {
final String currentServer = event.getServer().getServerInfo().getName();
Expand Down Expand Up @@ -88,13 +84,11 @@ public void onLoginEvent(LoginEvent event, Continuation continuation) {
}
}

@Override
@Subscribe
public void onLoginEvent(PostLoginEvent event) {
addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getUsername(), event.getPlayer().getRemoteAddress().getAddress());
}

@Override
@Subscribe
public void onDisconnectEvent(DisconnectEvent event) {
if (event.getLoginStatus() == DisconnectEvent.LoginStatus.SUCCESSFUL_LOGIN || event.getLoginStatus() == DisconnectEvent.LoginStatus.PRE_SERVER_JOIN) {
Expand Down

0 comments on commit dab5f26

Please sign in to comment.