From f0797c041dff6249b1fd4ba1158c7a149997b347 Mon Sep 17 00:00:00 2001 From: Yaruma3341 Date: Thu, 21 Nov 2019 16:20:57 +0100 Subject: [PATCH] added new comment to lock schematic --- .../de/steamwar/fightsystem/FightSystem.java | 1 + .../fightsystem/commands/AkCommand.java | 10 ------ .../commands/LockschemCommand.java | 31 +++++++++++++++++++ FightSystem_Main/src/plugin.yml | 3 +- 4 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java index b9c863e..51dd3a1 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java @@ -69,6 +69,7 @@ public class FightSystem extends JavaPlugin { getCommand("ready").setExecutor(new ReadyCommand()); getCommand("ak").setExecutor(new AkCommand()); getCommand("leader").setExecutor(new LeaderCommand()); + getCommand("lockschem").setExecutor(new LockschemCommand()); if(Config.event()) { new EventJoinListener(); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/commands/AkCommand.java b/FightSystem_Main/src/de/steamwar/fightsystem/commands/AkCommand.java index 709a875..d98aaf1 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/commands/AkCommand.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/commands/AkCommand.java @@ -83,16 +83,6 @@ public class AkCommand implements CommandExecutor { player.sendMessage(FightSystem.PREFIX + "§cDu musst eine Seitenzahl angeben!"); return false; } - } else if(args[0].equalsIgnoreCase("lockschem")) { - String teamName = args[1]; - FightTeam fightTeam = Fight.getTeamByName(teamName); - - if(fightTeam == null) { - player.sendMessage(FightSystem.PREFIX + "§cDieses Team existiert nicht!"); - return false; - } - fightTeam.getSchematic().setSchemType(SchematicType.Normal); - player.sendMessage(FightSystem.PREFIX + "Schematic von " + fightTeam.getColoredName() + "§cgepserrt!"); } else Commands.sendHelp(player); break; diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java b/FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java new file mode 100644 index 0000000..54b8e24 --- /dev/null +++ b/FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java @@ -0,0 +1,31 @@ +package de.steamwar.fightsystem.commands; + +import de.steamwar.fightsystem.FightSystem; +import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.fight.FightTeam; +import de.steamwar.sql.SchematicType; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class LockschemCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + Player player = (Player) sender; + if(!(sender instanceof Player)) { + if(args.length == 1) { + String teamName = args[1]; + FightTeam fightTeam = Fight.getTeamByName(teamName); + + if(fightTeam == null) { + player.sendMessage(FightSystem.PREFIX + "§cDieses Team existiert nicht!"); + return false; + } + fightTeam.getSchematic().setSchemType(SchematicType.Normal); + player.sendMessage(FightSystem.PREFIX + "Schematic von " + fightTeam.getColoredName() + "§cgepserrt!"); + } + } + return false; + } +} diff --git a/FightSystem_Main/src/plugin.yml b/FightSystem_Main/src/plugin.yml index 2064fea..3291afc 100644 --- a/FightSystem_Main/src/plugin.yml +++ b/FightSystem_Main/src/plugin.yml @@ -13,4 +13,5 @@ commands: ready: kit: remove: - leader: \ No newline at end of file + leader: + lockschem: \ No newline at end of file