From 349e67ed5c527f6673759947bc495033af09f602 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 30 Oct 2020 19:45:16 +0100 Subject: [PATCH] Refactored Ban Command to only allow downwards bans --- src/de/steamwar/bungeecore/commands/BanCommand.java | 8 ++++++++ src/de/steamwar/bungeecore/commands/MuteCommand.java | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 9ac7ff89..355efec3 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -46,6 +46,14 @@ public class BanCommand extends BasicCommand { if(target == null) return; + SteamwarUser p = SteamwarUser.get(sender.getName()); + if(p.getUserGroup().isHigherThen(target.getUserGroup())) { + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDu kannst diesen Spieler nicht muten"); + BungeeCore.send(BungeeCore.get().getProxy().getPlayer(target.getUuid()), + BungeeCore.CHAT_PREFIX + "§c" + p.getUserName() + " hat versucht dich zu Muten!"); + return; + } + Timestamp banTime = parseTime(sender, args[1]); if(banTime == null) return; diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index dc0d681e..7ddd3034 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -42,6 +42,14 @@ public class MuteCommand extends BasicCommand { if(target == null) return; + SteamwarUser p = SteamwarUser.get(sender.getName()); + if(p.getUserGroup().isHigherThen(target.getUserGroup())) { + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDu kannst diesen Spieler nicht bannen"); + BungeeCore.send(BungeeCore.get().getProxy().getPlayer(target.getUuid()), + BungeeCore.CHAT_PREFIX + "§c" + p.getUserName() + " hat versucht dich zu Bannen!"); + return; + } + Timestamp muteTime = BanCommand.parseTime(sender, args[1]); if(muteTime == null) return;