From c6efe8a5f45ae9ea0e55d9e9347f99b8a1e41fc6 Mon Sep 17 00:00:00 2001 From: Yaruma3341 Date: Thu, 21 Nov 2019 19:40:59 +0100 Subject: [PATCH] code cleanup --- .../commands/LockschemCommand.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java b/FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java index c69a39c..b63b6d2 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/commands/LockschemCommand.java @@ -4,6 +4,8 @@ import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.sql.SchematicType; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.UserGroup; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -13,8 +15,20 @@ 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) { + if(!(sender instanceof Player)) { + return false; + } + SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); + UserGroup userGroup = steamwarUser.getUserGroup(); + + if(userGroup != UserGroup.Admin && + userGroup != UserGroup.Developer && + userGroup != UserGroup.Moderator && + userGroup != UserGroup.Supporter) + return false; + + switch (args.length) { + case 1: String teamName = args[1]; FightTeam fightTeam = Fight.getTeamByName(teamName); @@ -24,7 +38,6 @@ public class LockschemCommand implements CommandExecutor { } fightTeam.getSchematic().setSchemType(SchematicType.Normal); player.sendMessage(FightSystem.PREFIX + "Schematic von " + fightTeam.getColoredName() + "§cgepserrt!"); - } } return false; }