Update CommandLockschem to new SWCommand system
Dieser Commit ist enthalten in:
Ursprung
22722c7e1a
Commit
49f045d817
@ -83,7 +83,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
new CommandProtect();
|
||||
new CommandSkull();
|
||||
new CommandLoader();
|
||||
getCommand("lockschem").setExecutor(new CommandLockschem());
|
||||
new CommandLockschem();
|
||||
new CommandDebugStick();
|
||||
new CommandGills();
|
||||
new CommandDetonator();
|
||||
|
@ -20,55 +20,63 @@
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.command.SWCommand;
|
||||
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 {
|
||||
public class CommandLockschem extends SWCommand {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player))
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
public CommandLockschem() {
|
||||
super("lockschem");
|
||||
}
|
||||
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||
@Register(help = true)
|
||||
public void genericHelp(Player p, String... args) {
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(p.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;
|
||||
userGroup != UserGroup.Supporter) {
|
||||
return;
|
||||
}
|
||||
|
||||
SteamwarUser schemOwner = SteamwarUser.get(args[0]);
|
||||
sendHelp(p);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Player p, String owner, String schematicName) {
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(p.getUniqueId());
|
||||
UserGroup userGroup = steamwarUser.getUserGroup();
|
||||
|
||||
if (userGroup != UserGroup.Admin &&
|
||||
userGroup != UserGroup.Developer &&
|
||||
userGroup != UserGroup.Moderator &&
|
||||
userGroup != UserGroup.Supporter) {
|
||||
return;
|
||||
}
|
||||
|
||||
SteamwarUser schemOwner = SteamwarUser.get(owner);
|
||||
if (schemOwner == null) {
|
||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
||||
return false;
|
||||
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
||||
return;
|
||||
}
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], schemOwner.getUUID());
|
||||
Schematic schematic = Schematic.getSchemFromDB(schematicName, schemOwner.getUUID());
|
||||
if (schematic == null) {
|
||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
||||
return false;
|
||||
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
||||
return;
|
||||
}
|
||||
player.sendMessage(BauSystem.PREFIX + "Schematic " + schematic.getSchemName() + " von " +
|
||||
p.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]");
|
||||
player.sendMessage("§8/§eschemlock §8[§7Owner§8] §8[§7Schematic§8] §8- §7 Sperre eine Schematic");
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,3 @@ website: "https://steamwar.de"
|
||||
description: "So unseriös wie wir sind: BauSystem nur besser."
|
||||
|
||||
commands:
|
||||
lockschem:
|
In neuem Issue referenzieren
Einen Benutzer sperren