2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-24 13:08:02 +00:00

fix event double firing in velocity

This commit is contained in:
mohammed jasem alaajel 2024-09-26 19:20:15 +04:00
parent c622bc7b63
commit dab5f26e2c
Signed by: ham1255
GPG Key ID: EF343502046229F4
3 changed files with 6 additions and 18 deletions

View File

@ -54,18 +54,18 @@ public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEven
// 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());

View File

@ -34,25 +34,21 @@ public class BungeePlayerDataManager extends PlayerDataManager<ProxiedPlayer, Po
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();
@ -87,13 +83,11 @@ public class BungeePlayerDataManager extends PlayerDataManager<ProxiedPlayer, Po
}
@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());

View File

@ -33,25 +33,21 @@ public class VelocityPlayerDataManager extends PlayerDataManager<Player, PostLog
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();
@ -88,13 +84,11 @@ public class VelocityPlayerDataManager extends PlayerDataManager<Player, PostLog
}
}
@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) {