From c239dc780968b7a8b25e46e468ec59315a70d505 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 12 Mar 2022 13:54:23 +0100 Subject: [PATCH] Allow Fabric on Fight Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 10 +++++++++- .../bungeecore/listeners/mods/ModLoaderBlocker.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index 6a9c30ed..2f1c1bb2 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -23,11 +23,13 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Storage; import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.Mod; import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.event.EventHandler; @@ -40,6 +42,7 @@ import java.util.logging.Level; public class Fabric extends BasicListener { private final List neededMods = new LinkedList<>(); + public static final Set checkedPlayers = new HashSet(); { neededMods.add("java"); @@ -91,13 +94,18 @@ public class Fabric extends BasicListener { return; } - Utils.handleMods(player,mods); + if(Utils.handleMods(player,mods)) checkedPlayers.add(player); }catch (Exception ex) { ex.printStackTrace(); player.disconnect("ยง7Mod Verification failed! Contact a Developer"); } } + @EventHandler + public void onDisconnect(PlayerDisconnectEvent e){ + checkedPlayers.remove(e.getPlayer()); + } + private boolean isSortedAlphabetically(List mods) { boolean isSorted = true; for(int i = 0; i < mods.size() - 1; i++) { diff --git a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java index a4d54e6d..d347d421 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java +++ b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java @@ -73,7 +73,7 @@ public class ModLoaderBlocker extends BasicListener { } public static boolean isFabric(ProxiedPlayer player) { - return Storage.fabricPlayers.contains(player); + return Storage.fabricPlayers.contains(player) && !Fabric.checkedPlayers.contains(player); } public static void addServer(String server) {