SteamWar/BauSystem
Archiviert
13
0

Update CommandSkull to new SWCommand system

Dieser Commit ist enthalten in:
yoyosource 2021-04-01 20:23:24 +02:00
Ursprung 04ca32627d
Commit 70dc99de6f
3 geänderte Dateien mit 14 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -87,7 +87,7 @@ public class BauSystem extends JavaPlugin implements Listener {
new CommandTestblock(); new CommandTestblock();
getCommand("bauinfo").setExecutor(new CommandInfo()); getCommand("bauinfo").setExecutor(new CommandInfo());
getCommand("protect").setExecutor(new CommandProtect()); getCommand("protect").setExecutor(new CommandProtect());
getCommand("skull").setExecutor(new CommandSkull()); new CommandSkull();
getCommand("loader").setExecutor(new CommandLoader()); getCommand("loader").setExecutor(new CommandLoader());
getCommand("lockschem").setExecutor(new CommandLockschem()); getCommand("lockschem").setExecutor(new CommandLockschem());
new CommandDebugStick(); new CommandDebugStick();

Datei anzeigen

@ -21,34 +21,30 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.command.SWCommand;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
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;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
public class CommandSkull implements CommandExecutor { public class CommandSkull extends SWCommand {
@Override public CommandSkull() {
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { super("skull");
if (!(commandSender instanceof Player)) }
return false;
Player p = (Player) commandSender;
if (args.length != 1) { @Register(help = true)
p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8]"); public void genericHelp(Player p, String... args) {
return false; p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8]");
} }
ItemStack is = SWItem.getPlayerSkull(args[0]).getItemStack(); @Register
public void giveHelp(Player p, String skull) {
ItemStack is = SWItem.getPlayerSkull(skull).getItemStack();
SkullMeta sm = (SkullMeta) is.getItemMeta(); SkullMeta sm = (SkullMeta) is.getItemMeta();
assert sm != null; assert sm != null;
sm.setDisplayName("§e" + args[0] + "§8s Kopf"); sm.setDisplayName("§e" + skull + "§8s Kopf");
is.setItemMeta(sm); is.setItemMeta(sm);
SWUtils.giveItemToPlayer(p, is); SWUtils.giveItemToPlayer(p, is);
return false;
} }
} }

Datei anzeigen

@ -13,7 +13,6 @@ commands:
reset: reset:
protect: protect:
bauinfo: bauinfo:
skull:
freeze: freeze:
aliases: stoplag aliases: stoplag
loader: loader: