diff --git a/src/de/steamwar/bungeecore/commands/BasicCommand.java b/src/de/steamwar/bungeecore/commands/BasicCommand.java deleted file mode 100644 index d4b9c0a..0000000 --- a/src/de/steamwar/bungeecore/commands/BasicCommand.java +++ /dev/null @@ -1,69 +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 . -*/ - -package de.steamwar.bungeecore.commands; - -import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.Message; -import de.steamwar.bungeecore.sql.SteamwarUser; -import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.plugin.Command; -import net.md_5.bungee.api.plugin.TabExecutor; - -import java.util.ArrayList; -import java.util.List; - -abstract class BasicCommand extends Command implements TabExecutor { - - public BasicCommand(String name, String permission, String... aliases) { - super(name, permission, aliases); - BungeeCore.commands.put("/" + name, permission); - ProxyServer.getInstance().getPluginManager().registerCommand(BungeeCore.get(), this); - } - - Iterable allPlayers(String begin) { - List suggestions = new ArrayList<>(); - for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ - String playerName = player.getName(); - if(playerName.startsWith(begin)) - suggestions.add(playerName); - } - return suggestions; - } - - public Iterable onTabComplete(CommandSender commandSender, String[] args) { - return new ArrayList<>(); - } - - protected SteamwarUser existingUser(CommandSender sender, String arg){ - SteamwarUser target = SteamwarUser.get(arg); - if(target == null) - Message.send("UNKNOWN_PLAYER", sender); - return target; - } - - protected SteamwarUser unsafeUser(CommandSender sender, String arg){ - SteamwarUser target = SteamwarUser.getOrCreateOfflinePlayer(arg); - if(target == null) - Message.send("UNKNOWN_PLAYER", sender); - return target; - } -}