From 0b220645b8fcde66ac4542a2d97db142b382d52d Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel Date: Thu, 26 Sep 2024 19:20:15 +0400 Subject: [PATCH] fix event double firing in velocity --- .../minecraft/redisbungee/api/PlayerDataManager.java | 12 ++++++------ .../redisbungee/BungeePlayerDataManager.java | 6 ------ .../redisbungee/VelocityPlayerDataManager.java | 7 +------ 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java index 71a9196d..653ffcc2 100644 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java +++ b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java @@ -54,18 +54,18 @@ public PlayerDataManager(RedisBungeePlugin

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()); diff --git a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java index 3c2f5e50..8b7ff2f3 100644 --- a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java +++ b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java @@ -34,25 +34,21 @@ public BungeePlayerDataManager(RedisBungeePlugin 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(); @@ -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()); diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java index b98bdee7..73177fc0 100644 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java +++ b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java @@ -33,25 +33,22 @@ public VelocityPlayerDataManager(RedisBungeePlugin 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) { + System.out.println("test #1" + event.getChannel()); handlePubSubMessageEvent(event); } - @Override @Subscribe public void onServerConnectedEvent(ServerConnectedEvent event) { final String currentServer = event.getServer().getServerInfo().getName(); @@ -88,13 +85,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) {