From d3cbf29a3f86c8024490c511eaa18676e117ea02 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 12 Oct 2020 13:15:53 +0200 Subject: [PATCH 1/2] Add Fabric Challenge --- src/de/steamwar/bungeecore/commands/ChallengeCommand.java | 6 ++++++ src/de/steamwar/bungeecore/commands/FightCommand.java | 6 ++++++ src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index b81e9c5..b511e1b 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.listeners.mods.Fabric; import de.steamwar.bungeecore.sql.IgnoreSystem; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; @@ -46,6 +47,11 @@ public class ChallengeCommand extends BasicCommand { if (!(sender instanceof ProxiedPlayer)) return; + if(Fabric.isFabric((ProxiedPlayer) sender)) { + BungeeCore.send((ProxiedPlayer) sender, BungeeCore.CHAT_PREFIX + "§cHat ich dir nicht gesagt, dass man mit Fabric nicht auf die Arenen darf?"); + return; + } + ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); if(target == null){ BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDer Herausgeforderte ist nicht online."); diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index ea00e0b..fcb4a6f 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.listeners.mods.Fabric; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; @@ -127,6 +128,11 @@ public class FightCommand extends BasicCommand { if(!(sender instanceof ProxiedPlayer)) return; + if(Fabric.isFabric((ProxiedPlayer) sender)) { + BungeeCore.send((ProxiedPlayer) sender, BungeeCore.CHAT_PREFIX + "§cHat ich dir nicht gesagt, dass man mit Fabric nicht auf die Arenen darf?"); + return; + } + ProxiedPlayer player = (ProxiedPlayer) sender; if(alreadyInArena(player)) return; diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index 1d89c30..d025b50 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -63,4 +63,8 @@ public class Fabric extends BasicListener { BungeeCore.send(event.getPlayer(), BungeeCore.CHAT_PREFIX + "§cDu kannst nicht auf die Arena mit Fabric"); } } + + public static boolean isFabric(ProxiedPlayer player) { + return Storage.fabricPlayers.contains(player); + } } From 2911721cba7a50871fd631552c3b8646433a553a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 12 Oct 2020 13:17:20 +0200 Subject: [PATCH 2/2] Add Fabric Challenge --- 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 d025b50..12ec282 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -58,7 +58,7 @@ public class Fabric extends BasicListener { public void onServerSwitch(ServerSwitchEvent event) { if(Subserver.getSubserver(event.getPlayer()) != null && Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA - && Storage.fabricPlayers.contains(event.getPlayer())) { + && isFabric(event.getPlayer())) { event.getPlayer().connect(BungeeCore.get().getProxy().getServerInfo(BungeeCore.LOBBY_SERVER)); BungeeCore.send(event.getPlayer(), BungeeCore.CHAT_PREFIX + "§cDu kannst nicht auf die Arena mit Fabric"); }