mirror of
https://github.com/funkemunky/AntiVPN.git
synced 2026-06-11 14:10:46 +00:00
Implementing commands system into antivpn [v1.1]
This commit is contained in:
@@ -2,7 +2,13 @@ package dev.brighten.antivpn.bungee;
|
||||
|
||||
import dev.brighten.antivpn.AntiVPN;
|
||||
import dev.brighten.antivpn.bungee.util.Config;
|
||||
import dev.brighten.antivpn.command.Command;
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public class BungeePlugin extends Plugin {
|
||||
@@ -20,7 +26,24 @@ public class BungeePlugin extends Plugin {
|
||||
config = new Config();
|
||||
|
||||
//Loading plugin
|
||||
AntiVPN.start(new BungeeConfig(), new BungeeListener());
|
||||
AntiVPN.start(new BungeeConfig(), new BungeeListener(), new BungeePlayerExecutor());
|
||||
|
||||
for (Command command : AntiVPN.getInstance().getCommands()) {
|
||||
BungeeCord.getInstance().getPluginManager().registerCommand(pluginInstance, new net.md_5.bungee.api.plugin
|
||||
.Command(command.parent() + " " + command.name(), command.permission(), command.aliases()) {
|
||||
@Override
|
||||
public void execute(CommandSender commandSender, String[] strings) {
|
||||
if(!commandSender.hasPermission("antivpn.command.*")
|
||||
&& !commandSender.hasPermission(command.permission())) {
|
||||
commandSender.sendMessage(new ComponentBuilder("No permission").color(ChatColor.RED)
|
||||
.create());
|
||||
return;
|
||||
}
|
||||
|
||||
command.execute(new BungeeCommandExecutor(commandSender), strings);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user