2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-24 21:18:01 +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 // handle network wide
// server change // 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 // 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) { protected void handleNetworkPlayerServerChange(IPlayerChangedServerNetworkEvent event) {
this.serverCache.invalidate(event.getUuid()); this.serverCache.invalidate(event.getUuid());

View File

@ -34,25 +34,21 @@ public class BungeePlayerDataManager extends PlayerDataManager<ProxiedPlayer, Po
super(plugin); super(plugin);
} }
@Override
@EventHandler @EventHandler
public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) { public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) {
super.handleNetworkPlayerServerChange(event); super.handleNetworkPlayerServerChange(event);
} }
@Override
@EventHandler @EventHandler
public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) { public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) {
super.handleNetworkPlayerQuit(event); super.handleNetworkPlayerQuit(event);
} }
@Override
@EventHandler @EventHandler
public void onPubSubMessageEvent(PubSubMessageEvent event) { public void onPubSubMessageEvent(PubSubMessageEvent event) {
super.handlePubSubMessageEvent(event); super.handlePubSubMessageEvent(event);
} }
@Override
@EventHandler @EventHandler
public void onServerConnectedEvent(ServerConnectedEvent event) { public void onServerConnectedEvent(ServerConnectedEvent event) {
final String currentServer = event.getServer().getInfo().getName(); final String currentServer = event.getServer().getInfo().getName();
@ -87,13 +83,11 @@ public class BungeePlayerDataManager extends PlayerDataManager<ProxiedPlayer, Po
} }
@Override
@EventHandler @EventHandler
public void onLoginEvent(PostLoginEvent event) { public void onLoginEvent(PostLoginEvent event) {
super.addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getName(), event.getPlayer().getAddress().getAddress()); super.addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getName(), event.getPlayer().getAddress().getAddress());
} }
@Override
@EventHandler @EventHandler
public void onDisconnectEvent(PlayerDisconnectEvent event) { public void onDisconnectEvent(PlayerDisconnectEvent event) {
super.removePlayer(event.getPlayer().getUniqueId()); super.removePlayer(event.getPlayer().getUniqueId());

View File

@ -33,25 +33,21 @@ public class VelocityPlayerDataManager extends PlayerDataManager<Player, PostLog
super(plugin); super(plugin);
} }
@Override
@Subscribe @Subscribe
public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) { public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) {
handleNetworkPlayerServerChange(event); handleNetworkPlayerServerChange(event);
} }
@Override
@Subscribe @Subscribe
public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) { public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) {
handleNetworkPlayerQuit(event); handleNetworkPlayerQuit(event);
} }
@Override
@Subscribe @Subscribe
public void onPubSubMessageEvent(PubSubMessageEvent event) { public void onPubSubMessageEvent(PubSubMessageEvent event) {
handlePubSubMessageEvent(event); handlePubSubMessageEvent(event);
} }
@Override
@Subscribe @Subscribe
public void onServerConnectedEvent(ServerConnectedEvent event) { public void onServerConnectedEvent(ServerConnectedEvent event) {
final String currentServer = event.getServer().getServerInfo().getName(); final String currentServer = event.getServer().getServerInfo().getName();
@ -88,13 +84,11 @@ public class VelocityPlayerDataManager extends PlayerDataManager<Player, PostLog
} }
} }
@Override
@Subscribe @Subscribe
public void onLoginEvent(PostLoginEvent event) { public void onLoginEvent(PostLoginEvent event) {
addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getUsername(), event.getPlayer().getRemoteAddress().getAddress()); addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getUsername(), event.getPlayer().getRemoteAddress().getAddress());
} }
@Override
@Subscribe @Subscribe
public void onDisconnectEvent(DisconnectEvent event) { public void onDisconnectEvent(DisconnectEvent event) {
if (event.getLoginStatus() == DisconnectEvent.LoginStatus.SUCCESSFUL_LOGIN || event.getLoginStatus() == DisconnectEvent.LoginStatus.PRE_SERVER_JOIN) { if (event.getLoginStatus() == DisconnectEvent.LoginStatus.SUCCESSFUL_LOGIN || event.getLoginStatus() == DisconnectEvent.LoginStatus.PRE_SERVER_JOIN) {