diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java index 35cfb36..e4f4b8e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java @@ -21,7 +21,10 @@ package de.steamwar.bausystem.commands; +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.canonsimulator.TNTSimulator; +import de.steamwar.bausystem.world.Welt; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -29,11 +32,23 @@ import org.bukkit.entity.Player; public class CommandSimulator implements CommandExecutor { + private boolean permissionCheck(Player player) { + if (Welt.noPermission(player, Permission.build)) { + player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen"); + return false; + } + return true; + } + @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { - if(!(commandSender instanceof Player)) + if (!(commandSender instanceof Player)) return false; Player player = (Player) commandSender; + if (permissionCheck(player)) { + return false; + } + if (args.length == 1 && args[0].equalsIgnoreCase("wand")) { player.getInventory().setItemInMainHand(TNTSimulator.WAND); player.updateInventory();