Merge branch 'sperren' of SteamWar/BauSystem into master
Dieser Commit ist enthalten in:
Commit
be6b01db5f
@ -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);
|
||||
|
@ -0,0 +1,54 @@
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.sql.Schematic;
|
||||
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;
|
||||
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) {
|
||||
sendHelp(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
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.get(schematic.getSchemOwner()).getUserName() + " von " + schematic.getSchemType().toString() +
|
||||
" auf NORMAL zurückgesetzt!");
|
||||
schematic.setSchemType(SchematicType.Normal);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendHelp(Player player) {
|
||||
player.sendMessage(BauSystem.PREFIX + "/schemlock [OWNER] [SCHEM NAME]");
|
||||
}
|
||||
}
|
@ -19,3 +19,4 @@ commands:
|
||||
loader:
|
||||
nightvision:
|
||||
aliases: nv
|
||||
lockschem:
|
In neuem Issue referenzieren
Einen Benutzer sperren