diff --git a/src/de/steamwar/bungeecore/listeners/NonFabricFabricCheck.java b/src/de/steamwar/bungeecore/listeners/NonFabricFabricCheck.java index b903b9c2..0f825ab4 100644 --- a/src/de/steamwar/bungeecore/listeners/NonFabricFabricCheck.java +++ b/src/de/steamwar/bungeecore/listeners/NonFabricFabricCheck.java @@ -41,6 +41,7 @@ public class NonFabricFabricCheck extends BasicListener { private final Set usingFabric = new HashSet<>(); private final Set checking = new HashSet<>(); + private final Set vanilla = new HashSet<>(); { BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), usingFabric::clear, 0, 15, TimeUnit.MINUTES); @@ -52,14 +53,23 @@ public class NonFabricFabricCheck extends BasicListener { if(!(sender instanceof ProxiedPlayer)) return; - if(!e.getTag().equals("minecraft:brand")) - return; - - if(!new String(e.getData()).equals("vanilla")){ + ProxiedPlayer p = (ProxiedPlayer) sender; + if (e.getTag().equals("minecraft:register") && new String(e.getData()).contains("fabric-screen-handler-api-v1:open_screen")) { + BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { + if (!sender.isConnected()) return; + if (!vanilla.remove(p)) return; + if (Storage.fabricCheckedPlayers.containsKey(p)) return; + p.disconnect(Message.parse("MOD_USE_MODSENDER", p)); + }, 25, TimeUnit.SECONDS); return; } - ProxiedPlayer p = (ProxiedPlayer) sender; + if(!e.getTag().equals("minecraft:brand")) + return; + + if(!new String(e.getData()).equals("vanilla")) + return; + vanilla.add(p); BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { if (!p.isConnected()) return; @@ -82,5 +92,6 @@ public class NonFabricFabricCheck extends BasicListener { if (checking.remove(e.getPlayer())) { usingFabric.add(e.getPlayer().getUniqueId()); } + vanilla.remove(e.getPlayer()); } }