mirror of
https://github.com/funkemunky/AntiVPN.git
synced 2026-06-01 09:51:55 +00:00
Completing 1.1 update
This commit is contained in:
@@ -15,6 +15,8 @@ public abstract class Command {
|
||||
public abstract String usage();
|
||||
|
||||
public abstract String parent();
|
||||
|
||||
public abstract Command[] children();
|
||||
|
||||
public abstract String execute(CommandExecutor executor, String[] args);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import dev.brighten.antivpn.AntiVPN;
|
||||
import dev.brighten.antivpn.command.Command;
|
||||
import dev.brighten.antivpn.command.CommandExecutor;
|
||||
import dev.brighten.antivpn.utils.StringUtil;
|
||||
import jdk.nashorn.internal.lookup.Lookup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -39,6 +40,11 @@ public class AntiVPNCommand extends Command {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command[] children() {
|
||||
return new Command[] {new LookupCommand()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute(CommandExecutor uuid, String[] args) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
@@ -47,8 +53,9 @@ public class AntiVPNCommand extends Command {
|
||||
messages.add("&6&lAntiVPN Help Page");
|
||||
messages.add("");
|
||||
for (Command child : AntiVPN.getInstance().getCommands()) {
|
||||
messages.add(String.format("&8/&f%s &8- &7&o%s", "&7antivpn &f" + child.name() + " &7" + child.usage(),
|
||||
description()));
|
||||
messages.add(String.format("&8/&f%s &8- &7&o%s", "&7" + child.parent()
|
||||
+ (child.parent().length() > 0 ? " " : "") + "&f" + child.name() + " &7"
|
||||
+ child.usage(), description()));
|
||||
}
|
||||
messages.add(StringUtil.line("&8"));
|
||||
|
||||
|
||||
@@ -39,10 +39,15 @@ public class LookupCommand extends Command {
|
||||
return "antivpn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command[] children() {
|
||||
return new Command[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute(CommandExecutor executor, String[] args) {
|
||||
if(args.length == 0) {
|
||||
return "&cPlease supply a player to check the VPN information of";
|
||||
return "&cPlease supply a player to check.";
|
||||
}
|
||||
|
||||
Optional<APIPlayer> player = AntiVPN.getInstance().getPlayerExecutor().getPlayer(args[0]);
|
||||
@@ -57,7 +62,7 @@ public class LookupCommand extends Command {
|
||||
executor.sendMessage("&cThere was an error trying to find the information of this player.");
|
||||
} else {
|
||||
executor.sendMessage(StringUtil.line("&8"));
|
||||
executor.sendMessage("&6&l" + player.get().getName() + "s &7&lConnection Information");
|
||||
executor.sendMessage("&6&l" + player.get().getName() + "&7&l's Connection Information");
|
||||
executor.sendMessage("");
|
||||
executor.sendMessage(String.format("&e%s&8: &f%s", "Proxy", result.isProxy()
|
||||
? "&a" + result.getMethod() : "&cNo"));
|
||||
|
||||
Reference in New Issue
Block a user