SteamWar/BauSystem
Archiviert
13
0

Remove CommandRedstoneTesterTabCompleter.java

Dieser Commit ist enthalten in:
yoyosource 2021-03-08 20:21:10 +01:00
Ursprung f14b135cd9
Commit 6e18ba218f
4 geänderte Dateien mit 4 neuen und 70 gelöschten Zeilen

Datei anzeigen

@ -100,7 +100,6 @@ public class BauSystem extends JavaPlugin implements Listener {
getCommand("simulator").setExecutor(new CommandSimulator()); getCommand("simulator").setExecutor(new CommandSimulator());
getCommand("simulator").setTabCompleter(new CommandSimulatorTabCompleter()); getCommand("simulator").setTabCompleter(new CommandSimulatorTabCompleter());
getCommand("redstonetester").setExecutor(new CommandRedstoneTester()); getCommand("redstonetester").setExecutor(new CommandRedstoneTester());
getCommand("redstonetester").setTabCompleter(new CommandRedstoneTesterTabCompleter());
getCommand("gui").setExecutor(new CommandGUI()); getCommand("gui").setExecutor(new CommandGUI());
Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(this, this);

Datei anzeigen

@ -76,12 +76,12 @@ public class CommandGUI implements CommandExecutor, Listener {
player.performCommand("sim wand"); player.performCommand("sim wand");
}); });
ItemStack redstoneWand = wand(player, RedstoneListener.WAND, "§8/§7redstonetester wand", Permission.build, "Du hast keine Buildrechte"); ItemStack redstoneWand = wand(player, RedstoneListener.WAND, "§8/§7redstonetester", Permission.build, "Du hast keine Buildrechte");
inv.setItem(37, redstoneWand, clickType -> { inv.setItem(37, redstoneWand, clickType -> {
if (Welt.noPermission(player, Permission.build)) if (Welt.noPermission(player, Permission.build))
return; return;
player.closeInventory(); player.closeInventory();
player.performCommand("redstonetester wand"); player.performCommand("redstonetester");
}); });
inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> { inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> {

Datei anzeigen

@ -31,11 +31,6 @@ import org.bukkit.entity.Player;
public class CommandRedstoneTester implements CommandExecutor { public class CommandRedstoneTester implements CommandExecutor {
private void help(Player player) {
player.sendMessage("§7Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten");
player.sendMessage("§8/§eredstonetester wand §8- §7Legt dir den Testerstab ins Inventar");
}
private boolean permissionCheck(Player player) { private boolean permissionCheck(Player player) {
if (Welt.noPermission(player, Permission.build)) { if (Welt.noPermission(player, Permission.build)) {
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Redstonetester nutzen"); player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Redstonetester nutzen");
@ -49,23 +44,13 @@ public class CommandRedstoneTester implements CommandExecutor {
if (!(commandSender instanceof Player)) if (!(commandSender instanceof Player))
return false; return false;
Player player = (Player) commandSender; Player player = (Player) commandSender;
if (args.length == 0) {
help(player);
return false;
}
if (!permissionCheck(player)) { if (!permissionCheck(player)) {
return false; return false;
} }
switch (args[0].toLowerCase()) { player.sendMessage("§7Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten");
case "wand":
SWUtils.giveItemToPlayer(player, RedstoneListener.WAND); SWUtils.giveItemToPlayer(player, RedstoneListener.WAND);
break;
default:
help(player);
break;
}
return false; return false;
} }

Datei anzeigen

@ -1,50 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.SWUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class CommandRedstoneTesterTabCompleter implements TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) return new ArrayList<>();
return commandTabComplete((Player) sender, args);
}
private List<String> commandTabComplete(Player player, String[] args) {
List<String> tabComplete = new ArrayList<>();
tabComplete.add("help");
tabComplete.add("wand");
if (args.length >= 2) {
return new ArrayList<>();
}
return SWUtils.manageList(tabComplete, args, 0);
}
}