From cb52e0bc38cb02996d3f25394fab9add37ecd0b1 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:12:51 +0200 Subject: [PATCH 1/4] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 5 +++++ .../steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java | 1 + 2 files changed, 6 insertions(+) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index 90365cd..1e0b675 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -42,6 +42,8 @@ public class Fabric extends BasicListener { private final Set neededMods = new HashSet<>(); + public static List checkedPlayers = new LinkedList<>(); + { neededMods.add("java"); neededMods.add("minecraft"); @@ -61,6 +63,8 @@ public class Fabric extends BasicListener { ProxiedPlayer player = (ProxiedPlayer) e.getSender(); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + if(checkedPlayers.contains(player)) return; + List mods = new LinkedList<>(); byte[] data = e.getData(); @@ -108,6 +112,7 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { + checkedPlayers.add(player); Storage.fabricPlayers.remove(player); Message.send("MODIFICATION_CHECK_SUCCESS", player); } diff --git a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java index a4d54e6..134c7f8 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java +++ b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java @@ -58,6 +58,7 @@ public class ModLoaderBlocker extends BasicListener { @EventHandler public void onDisconnect(PlayerDisconnectEvent e){ + Fabric.checkedPlayers.remove(e.getPlayer()); Storage.fabricPlayers.remove(e.getPlayer()); } From 9ef4062d4a2a2b0a147de6c11f3be4fa5f5165e9 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:24:23 +0200 Subject: [PATCH 2/4] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index 1e0b675..e9e1f52 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -42,7 +42,7 @@ public class Fabric extends BasicListener { private final Set neededMods = new HashSet<>(); - public static List checkedPlayers = new LinkedList<>(); + public static final Set checkedPlayers = new HashSet<>(); { neededMods.add("java"); @@ -63,8 +63,6 @@ public class Fabric extends BasicListener { ProxiedPlayer player = (ProxiedPlayer) e.getSender(); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); - if(checkedPlayers.contains(player)) return; - List mods = new LinkedList<>(); byte[] data = e.getData(); @@ -112,9 +110,9 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { + if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); checkedPlayers.add(player); Storage.fabricPlayers.remove(player); - Message.send("MODIFICATION_CHECK_SUCCESS", player); } } From 5a9b79e98042646ac7f845038a1265acd200fd99 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:24:41 +0200 Subject: [PATCH 3/4] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index e9e1f52..ae3024a 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -110,8 +110,8 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { - if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); checkedPlayers.add(player); + if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); Storage.fabricPlayers.remove(player); } } From e4268efd8b36c4e3d44fa2266124c0bcd32a999a Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:25:17 +0200 Subject: [PATCH 4/4] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index ae3024a..eff649e 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -110,8 +110,10 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { - checkedPlayers.add(player); - if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); + if(!checkedPlayers.contains(player)) { + Message.send("MODIFICATION_CHECK_SUCCESS", player); + checkedPlayers.add(player); + } Storage.fabricPlayers.remove(player); } }