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(); new CommandDebugStick();
getCommand("watervision").setExecutor(new CommandGills()); getCommand("watervision").setExecutor(new CommandGills());
new CommandDetonator(); new CommandDetonator();
getCommand("script").setExecutor(new CommandScript()); new CommandScript();
getCommand("scriptvars").setExecutor(new CommandScriptVars()); getCommand("scriptvars").setExecutor(new CommandScriptVars());
getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter()); getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter());
new CommandSimulator(); new CommandSimulator();

Datei anzeigen

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

Datei anzeigen

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