Update CommandRedstoneTester to new SWCommand system
Dieser Commit ist enthalten in:
Ursprung
738a88ac0a
Commit
8500fc136c
@ -97,7 +97,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
getCommand("scriptvars").setExecutor(new CommandScriptVars());
|
getCommand("scriptvars").setExecutor(new CommandScriptVars());
|
||||||
getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter());
|
getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter());
|
||||||
new CommandSimulator();
|
new CommandSimulator();
|
||||||
getCommand("redstonetester").setExecutor(new CommandRedstoneTester());
|
new CommandRedstoneTester();
|
||||||
getCommand("gui").setExecutor(new CommandGUI());
|
getCommand("gui").setExecutor(new CommandGUI());
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
Bukkit.getPluginManager().registerEvents(this, this);
|
||||||
|
@ -24,13 +24,29 @@ import de.steamwar.bausystem.Permission;
|
|||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.world.RedstoneListener;
|
import de.steamwar.bausystem.world.RedstoneListener;
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.core.VersionedRunnable;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
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 CommandRedstoneTester implements CommandExecutor {
|
public class CommandRedstoneTester extends SWCommand {
|
||||||
|
|
||||||
|
public CommandRedstoneTester() {
|
||||||
|
super("redstonetester", "rt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register
|
||||||
|
public void genericCommand(Player p) {
|
||||||
|
VersionedRunnable.call(new VersionedRunnable(() -> {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "Der RedstoneTester ist nicht in der 1.12 verfügbar");
|
||||||
|
}, 8), new VersionedRunnable(() -> {
|
||||||
|
if (!permissionCheck(p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten");
|
||||||
|
SWUtils.giveItemToPlayer(p, RedstoneListener.WAND);
|
||||||
|
}, 15));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.build)) {
|
if (Welt.noPermission(player, Permission.build)) {
|
||||||
@ -40,21 +56,4 @@ public class CommandRedstoneTester implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
|
||||||
if (!(commandSender instanceof Player))
|
|
||||||
return false;
|
|
||||||
Player player = (Player) commandSender;
|
|
||||||
VersionedRunnable.call(new VersionedRunnable(() -> {
|
|
||||||
player.sendMessage(BauSystem.PREFIX + "Der RedstoneTester ist nicht in der 1.12 verfügbar");
|
|
||||||
}, 8), new VersionedRunnable(() -> {
|
|
||||||
if (!permissionCheck(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
player.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten");
|
|
||||||
SWUtils.giveItemToPlayer(player, RedstoneListener.WAND);
|
|
||||||
}, 15));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,6 @@ import de.steamwar.bausystem.world.Welt;
|
|||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
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 java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -22,5 +22,3 @@ commands:
|
|||||||
lockschem:
|
lockschem:
|
||||||
scriptvars:
|
scriptvars:
|
||||||
gui:
|
gui:
|
||||||
redstonetester:
|
|
||||||
aliases: rt
|
|
In neuem Issue referenzieren
Einen Benutzer sperren