diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index c28fbf1..e06f6e1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -74,6 +74,7 @@ public class BauSystem extends JavaPlugin implements Listener { getCommand("protect").setExecutor(new CommandProtect()); getCommand("skull").setExecutor(new CommandSkull()); getCommand("loader").setExecutor(new CommandLoader()); + getCommand("lockschem").setExecutor(new CommandLockschem()); Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(new RegionListener(), this); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandLockschem.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandLockschem.java new file mode 100644 index 0000000..ddb5943 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandLockschem.java @@ -0,0 +1,52 @@ +package de.steamwar.bausystem.commands; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.sql.Schematic; +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; +import org.bukkit.entity.Player; + +public class CommandLockschem implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(!(sender instanceof Player)) { + return false; + } + Player player = (Player) sender; + + 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; + + if(args.length == 2) { + SteamwarUser schemOwner = SteamwarUser.get(args[0]); + if(schemOwner == null) { + player.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!"); + return false; + } + Schematic schematic = Schematic.getSchemFromDB(args[1], schemOwner.getUUID()); + if(schematic == null) { + player.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!"); + return false; + } + player.sendMessage(BauSystem.PREFIX + "Schematic " + schematic.getSchemName() + " von " + + steamwarUser.getUserName() + " von " + schematic.getSchemType().toString() + + " auf NORMAL zurückgesetzt!"); + return false; + } + sendHelp(player); + return false; + } + + private void sendHelp(Player player) { + player.sendMessage(BauSystem.PREFIX + "/schemlock [OWNER] [SCHEM NAME]"); + } +} diff --git a/BauSystem_Main/src/plugin.yml b/BauSystem_Main/src/plugin.yml index 06b680b..88ebac8 100644 --- a/BauSystem_Main/src/plugin.yml +++ b/BauSystem_Main/src/plugin.yml @@ -18,4 +18,5 @@ commands: freeze: loader: nightvision: - aliases: nv \ No newline at end of file + aliases: nv + lockschem: \ No newline at end of file