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 CommandProtect();
|
||||||
new CommandSkull();
|
new CommandSkull();
|
||||||
new CommandLoader();
|
new CommandLoader();
|
||||||
getCommand("lockschem").setExecutor(new CommandLockschem());
|
new CommandLockschem();
|
||||||
new CommandDebugStick();
|
new CommandDebugStick();
|
||||||
new CommandGills();
|
new CommandGills();
|
||||||
new CommandDetonator();
|
new CommandDetonator();
|
||||||
|
@ -20,55 +20,63 @@
|
|||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import de.steamwar.sql.SchematicType;
|
import de.steamwar.sql.SchematicType;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import de.steamwar.sql.UserGroup;
|
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;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CommandLockschem implements CommandExecutor {
|
public class CommandLockschem extends SWCommand {
|
||||||
|
|
||||||
@Override
|
public CommandLockschem() {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
super("lockschem");
|
||||||
if (!(sender instanceof Player))
|
}
|
||||||
return false;
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
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();
|
UserGroup userGroup = steamwarUser.getUserGroup();
|
||||||
|
|
||||||
if (userGroup != UserGroup.Admin &&
|
if (userGroup != UserGroup.Admin &&
|
||||||
userGroup != UserGroup.Developer &&
|
userGroup != UserGroup.Developer &&
|
||||||
userGroup != UserGroup.Moderator &&
|
userGroup != UserGroup.Moderator &&
|
||||||
userGroup != UserGroup.Supporter)
|
userGroup != UserGroup.Supporter) {
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if (args.length != 2) {
|
|
||||||
sendHelp(player);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
if (schemOwner == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], schemOwner.getUUID());
|
Schematic schematic = Schematic.getSchemFromDB(schematicName, schemOwner.getUUID());
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
||||||
return false;
|
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() +
|
SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " von " + schematic.getSchemType().toString() +
|
||||||
" auf NORMAL zurückgesetzt!");
|
" auf NORMAL zurückgesetzt!");
|
||||||
schematic.setSchemType(SchematicType.Normal);
|
schematic.setSchemType(SchematicType.Normal);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendHelp(Player player) {
|
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."
|
description: "So unseriös wie wir sind: BauSystem nur besser."
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
lockschem:
|
|
In neuem Issue referenzieren
Einen Benutzer sperren