From 8f553a663b4a83a0634464183ec13723322aaf07 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 31 Dec 2019 08:53:43 +0100 Subject: [PATCH] Removing Forgeblocker-Toggeling and adding kick delay --- src/de/steamwar/bungeecore/BungeeCore.java | 1 - .../bungeecore/commands/ForgeCommand.java | 16 ---------------- .../bungeecore/listeners/mods/Forge.java | 18 +++--------------- 3 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 src/de/steamwar/bungeecore/commands/ForgeCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 157048b..16d857a 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -81,7 +81,6 @@ public class BungeeCore extends Plugin { new ChallengeCommand(); new TeamCommand(); new ServerTeamchatCommand(); - new ForgeCommand(); new EventCommand(); new EventreloadCommand(); new EventRescheduleCommand(); diff --git a/src/de/steamwar/bungeecore/commands/ForgeCommand.java b/src/de/steamwar/bungeecore/commands/ForgeCommand.java deleted file mode 100644 index b5a9abe..0000000 --- a/src/de/steamwar/bungeecore/commands/ForgeCommand.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.steamwar.bungeecore.commands; - -import de.steamwar.bungeecore.listeners.mods.Forge; -import net.md_5.bungee.api.CommandSender; - -public class ForgeCommand extends BasicCommand { - - public ForgeCommand() { - super("forge", "bungeecore.softreload"); - } - - @Override - public void execute(CommandSender sender, String[] args) { - Forge.toggleEnabled(); - } -} diff --git a/src/de/steamwar/bungeecore/listeners/mods/Forge.java b/src/de/steamwar/bungeecore/listeners/mods/Forge.java index 3454a93..0f366e6 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Forge.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Forge.java @@ -23,11 +23,6 @@ public class Forge extends BasicListener { private static final byte[] REGISTER; private static final byte[] HELLO = new byte[]{0, 2, 0, 0, 0, 0}; private static final Set unlocked = new HashSet<>(); - private static boolean enabled = false; - - public static void toggleEnabled(){ - enabled = !enabled; - } static{ ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.directBuffer(7); @@ -41,9 +36,6 @@ public class Forge extends BasicListener { public void onPostLogin(PostLoginEvent event) { ProxiedPlayer player = event.getPlayer(); - if(!enabled) - return; - synchronized (unlocked) { if(unlocked.contains(player.getUniqueId())){ unlocked.remove(player.getUniqueId()); @@ -61,11 +53,6 @@ public class Forge extends BasicListener { @EventHandler public void onPluginMessageEvent(PluginMessageEvent e){ - if(!enabled) - return; - - BungeeCore.log(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData())); - if(!e.getTag().equals(FMLHS)) return; @@ -90,14 +77,15 @@ public class Forge extends BasicListener { bytePos += 1 + data[bytePos]; mods.add(Mod.get(new String(name), Mod.Platform.FORGE)); - BungeeCore.log(new String(name) + " " + new String(version)); } if(Utils.handleMods(p, mods)){ synchronized (unlocked){ unlocked.add(p.getUniqueId()); } - p.disconnect(BungeeCore.stringToText("§7Deine installierten Mods wurden überprüft\n\n§aDu kannst nun §eSteam§8War §abetreten")); + ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), + () -> p.disconnect(BungeeCore.stringToText("§7Deine installierten Mods wurden überprüft\n§aDu kannst nun §eSteam§8War §abetreten")), + 2, TimeUnit.SECONDS); ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { synchronized (unlocked) { unlocked.remove(p.getUniqueId());