SteamWar/BauSystem
Archiviert
13
0

Update CommandScript to new SWCommand system

Dieser Commit ist enthalten in:
yoyosource 2021-04-01 20:31:59 +02:00
Ursprung fb4fa03d5d
Commit 6744b8e0ed
3 geänderte Dateien mit 10 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -93,7 +93,7 @@ public class BauSystem extends JavaPlugin implements Listener {
new CommandDebugStick();
getCommand("watervision").setExecutor(new CommandGills());
new CommandDetonator();
getCommand("script").setExecutor(new CommandScript());
new CommandScript();
getCommand("scriptvars").setExecutor(new CommandScriptVars());
getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter());
new CommandSimulator();

Datei anzeigen

@ -22,10 +22,8 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.command.SWCommand;
import org.bukkit.Material;
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.BookMeta;
@ -33,7 +31,11 @@ import org.bukkit.inventory.meta.BookMeta;
import java.util.ArrayList;
import java.util.List;
public class CommandScript implements CommandExecutor {
public class CommandScript extends SWCommand {
public CommandScript() {
super("script");
}
public static final ItemStack BOOK = new ItemStack(Material.WRITTEN_BOOK, 1);
@ -79,13 +81,9 @@ public class CommandScript implements CommandExecutor {
BOOK.setItemMeta(bookMeta);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if (!(sender instanceof Player)) {
return false;
}
SWUtils.giveItemToPlayer((Player) sender, BOOK);
return false;
@Register
public void giveCommand(Player p) {
SWUtils.giveItemToPlayer(p, BOOK);
}
}

Datei anzeigen

@ -21,7 +21,6 @@ commands:
watervision:
aliases: wv
lockschem:
script:
scriptvars:
gui:
redstonetester: