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();
getCommand("bauinfo").setExecutor(new CommandInfo());
getCommand("protect").setExecutor(new CommandProtect());
getCommand("skull").setExecutor(new CommandSkull());
new CommandSkull();
getCommand("loader").setExecutor(new CommandLoader());
getCommand("lockschem").setExecutor(new CommandLockschem());
new CommandDebugStick();

Datei anzeigen

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

Datei anzeigen

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