From 51e8b2e85e6d8852f57a9cbb2f843c1b1eeb6e62 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 4 May 2020 14:02:59 +0200 Subject: [PATCH] feat: add dummy start subcommand --- .../cliffbreak/varo/commands/VaroCommand.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/varo/src/main/java/de/cliffbreak/varo/commands/VaroCommand.java b/varo/src/main/java/de/cliffbreak/varo/commands/VaroCommand.java index 9358084..474a9c4 100644 --- a/varo/src/main/java/de/cliffbreak/varo/commands/VaroCommand.java +++ b/varo/src/main/java/de/cliffbreak/varo/commands/VaroCommand.java @@ -7,9 +7,16 @@ import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; +import com.destroystokyo.paper.Title; + +import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryCloseEvent.Reason; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.json.simple.JSONObject; import org.json.simple.JSONValue; import org.json.simple.parser.ParseException; @@ -26,6 +33,10 @@ public class VaroCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!sender.hasPermission("varo.admin")) { + sender.sendMessage("§c§lFehler: §r§cNicht genügend Rechte für dieses Kommando."); + return true; + } if (args.length == 2 && args[0].equals("unban")) { @SuppressWarnings("unchecked") final ArrayList bans = (ArrayList) this.plugin.config.get("Varo.Bans"); @@ -59,8 +70,21 @@ public class VaroCommand implements CommandExecutor { "§c§lFehler:§r§c beim Verbinden mit der Mojang-API ist ein Fehler aufgetreten. Eventuell sind die Mojang Server down."); e.printStackTrace(); } + + } else if (args.length == 1 && args[0].equals("start")) { + sender.sendMessage("§aStarting..."); + for (Player p : Bukkit.getServer().getOnlinePlayers()) { + // p.getInventory().clear(); //TODO: uncomment after debuging + p.closeInventory(Reason.CANT_USE); + for (PotionEffect potion : p.getActivePotionEffects()) + p.removePotionEffect(potion.getType()); + + p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60 * 20, 1, false, false, false)); + p.sendTitle(new Title("TODO: Title, etc")); + } } else { sender.sendMessage("\n§6========== §b§lCliffbreak.de VARO §r§6============\n "); + sender.sendMessage("§a/varo start: §rStarte das Varo Projekt!"); sender.sendMessage("§a/varo unban [Spieler]: §rSpieler wieder auf den Server lassen"); sender.sendMessage("\n§6=========================================="); }