From 6918bdaa756dd27c8028f43a3f5cc8aab6b704a4 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 22 Oct 2019 10:20:48 +0200 Subject: [PATCH] Adding unban-Befehl --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../bungeecore/commands/UnbanCommand.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/de/steamwar/bungeecore/commands/UnbanCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 7f394d4..926abe6 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -73,6 +73,7 @@ public class BungeeCore extends Plugin { new FightCommand(); new HelpCommand(); new BanCommand(); + new UnbanCommand(); new DenyCommand("watchcat", "wc"); new ChallengeCommand(); new TeamCommand(); diff --git a/src/de/steamwar/bungeecore/commands/UnbanCommand.java b/src/de/steamwar/bungeecore/commands/UnbanCommand.java new file mode 100644 index 0000000..25b8926 --- /dev/null +++ b/src/de/steamwar/bungeecore/commands/UnbanCommand.java @@ -0,0 +1,30 @@ +package de.steamwar.bungeecore.commands; + +import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.sql.SteamwarUser; +import net.md_5.bungee.api.CommandSender; + +import java.sql.Timestamp; +import java.util.Date; + +public class UnbanCommand extends BasicCommand { + + public UnbanCommand() { + super("unban", "bungeecore.ban"); + } + + @Override + public void execute(CommandSender sender, String[] args) { + if(args.length < 1){ + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/unban [Spieler]"); + return; + } + + SteamwarUser target = user(sender, args[0]); + if(target == null) + return; + + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt."); + target.ban(Timestamp.from(new Date().toInstant()), ""); + } +}