use of net.md_5.bungee.api.CommandSender in project FireAPI by FireBlade-Serv.
the class RegisterCommand method execute.
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof ProxiedPlayer) {
ProxiedPlayer pp = (ProxiedPlayer) sender;
FirePlayer fp = new FirePlayer(pp, this.instance);
if (pp.getServer().getInfo().equals(this.instance.getProxy().getServerInfo("login"))) {
if (this.sql.getCryptPassword(pp.getName()).equals("§default-not-set")) {
if (args.length == 0) {
pp.sendMessage(new TextComponent(this.pre + "§cUsage : /register <mot-de-passe> <même-mot-de-passe>"));
} else if (args.length == 1) {
pp.sendMessage(new TextComponent(this.pre + "§cVeuillez confirmer votre mot de passe !"));
pp.sendMessage(new TextComponent(this.pre + "§cUsage : /register <mot-de-passe> <même-mot-de-passe>"));
} else if (args.length == 2) {
if (args[0].equals(args[1])) {
try {
auth.registerPassword(pp.getName(), args[0]);
pp.sendMessage(new TextComponent(this.pre + "§aVous vous êtes inscrit avec succès ! Bon jeu " + pp.getName() + " !"));
// register good
this.instance.getProxy().getPluginManager().callEvent(new LoginSuccessEvent(pp, LoginSourceType.REGISTRATION_SUCCESSFULL));
} catch (InvalidKeyException | UnsupportedEncodingException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) {
pp.disconnect(new TextComponent("§cUne erreur à été détectée !\n§cVeuillez réssayer plus tard !"));
e.printStackTrace();
}
} else {
pp.sendMessage(new TextComponent(this.pre + "§cErreur les deux entrées ne sont pas identiques !"));
}
}
} else {
// registered
pp.sendMessage(new TextComponent(this.pre + "§cVous êtes déjà inscrit utilisez " + "/login <mot-de-passe> §cpour vous connecter"));
}
} else {
if (fp.hasRankAndSup(Rank.MANAGER_IG)) {
if (args.length == 0) {
pp.sendMessage(new TextComponent(this.pre + "§cUsage : /register unregister <pseudo>"));
} else if (args.length == 1) {
pp.sendMessage(new TextComponent(this.pre + "§cUsage : /register unregister <pseudo>"));
} else if (args.length == 2) {
if (args[0].equalsIgnoreCase("unregister")) {
if (this.instance.getSQL().hasFireAccount(args[1])) {
if (args[1].equalsIgnoreCase("CONSOLE")) {
pp.sendMessage(new TextComponent(this.pre + "§cErreur, vous ne pouvez pas désinscrire la console !"));
return;
}
this.instance.getSQL().setCryptPassword(args[1], "§default-not-set");
pp.sendMessage(new TextComponent(this.pre + "§aLe joueur \"" + args[1] + "\" est maintenant plus inscrit !"));
} else {
pp.sendMessage(new TextComponent(this.pre + "§cErreur, le joueur spécifié ne s'est jamais connecté"));
}
} else {
pp.sendMessage(new TextComponent(this.pre + "§cUsage : /register unregister <pseudo>"));
}
} else {
pp.sendMessage(new TextComponent(this.pre + "§cUsage : /register unregister <pseudo>"));
}
}
}
} else {
sender.sendMessage(new TextComponent(this.pre + "§cErreur, vous êtes la console c'est triste," + " vous ne pouvez executer cette commande, mais bon c'est la vie."));
}
}
use of net.md_5.bungee.api.CommandSender in project FireAPI by FireBlade-Serv.
the class StaffChatCommand method execute.
// ! = all en jeu
// : = staff chat
// @ = party chat
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof ProxiedPlayer) {
ProxiedPlayer pp = (ProxiedPlayer) sender;
if (this.api.getRankSystem().hasRankAndSup(pp.getName(), Rank.GUIDE)) {
if (this.players.containsKey(pp)) {
pp.sendMessage(new TextComponent(this.pre + "§aBien, vous n'entendez plus les discutions du staff !"));
this.players.remove(pp);
} else {
pp.sendMessage(new TextComponent(this.pre + "§aBien, vous entendez maintenant les discussions du staff !"));
pp.sendMessage(new TextComponent(this.pre + "§oRappel : Utilisez ':' devant vos messages pour parler au reste du staff !"));
this.players.put(pp, true);
}
} else {
pp.sendMessage(new TextComponent(this.pre + "§cErreur vous n'avez pas la permission d'utiliser cette commande !"));
}
} else {
if (this.consoleListen) {
sender.sendMessage(new TextComponent(this.pre + "§aBien, vous n'entendez plus les discutions du staff !"));
this.consoleListen = false;
} else {
sender.sendMessage(new TextComponent(this.pre + "§aBien, vous entendez maintenant les discussions du staff !"));
this.consoleListen = true;
}
}
}
use of net.md_5.bungee.api.CommandSender in project LuckPerms by lucko.
the class BungeeCommandExecutor method execute.
@Override
public void execute(CommandSender sender, String[] args) {
Sender lpSender = this.plugin.getSenderFactory().wrap(sender);
List<String> arguments = CommandManager.stripQuotes(ARGUMENT_SPLITTER.splitToList(ARGUMENT_JOINER.join(args)));
this.manager.onCommand(lpSender, "lpb", arguments);
}
use of net.md_5.bungee.api.CommandSender in project CloudNet by Dytanic.
the class CommandCloudDev method execute.
@Override
public void execute(CommandSender commandSender, String[] args) {
if (!(commandSender instanceof ProxiedPlayer))
return;
switch(args.length) {
case 0:
for (ServerInfo serverInfo : CloudProxy.getInstance().getCachedServers().values()) {
if (serverInfo.getServerConfig().getProperties().contains(NetworkUtils.DEV_PROPERTY)) {
DevService service = serverInfo.getServerConfig().getProperties().getObject(NetworkUtils.DEV_PROPERTY, DevService.class);
if (service.getUniqueId().equals(((ProxiedPlayer) commandSender).getUniqueId())) {
((ProxiedPlayer) commandSender).connect(ProxyServer.getInstance().getServerInfo(serverInfo.getServiceId().getServerId()));
return;
}
}
}
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "/cdev forTemplate <group> <template>");
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "/cdev forTemplate <group>");
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "/cdev testServer <group>");
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "/cdev testServer <group> <template>");
break;
case 2:
{
for (ServerInfo serverInfo : CloudProxy.getInstance().getCachedServers().values()) {
if (serverInfo.getServerConfig().getProperties().contains(NetworkUtils.DEV_PROPERTY)) {
DevService service = serverInfo.getServerConfig().getProperties().getObject(NetworkUtils.DEV_PROPERTY, DevService.class);
if (service.getUniqueId().equals(((ProxiedPlayer) commandSender).getUniqueId())) {
((ProxiedPlayer) commandSender).connect(ProxyServer.getInstance().getServerInfo(serverInfo.getServiceId().getServerId()));
return;
}
}
}
if (args[0].equalsIgnoreCase("forTemplate")) {
if (!CloudAPI.getInstance().getServerGroupMap().containsKey(args[1])) {
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "The group doesn't exist");
return;
}
ServerConfig serverConfig = new ServerConfig(true, commandSender.getName(), new Document(NetworkUtils.DEV_PROPERTY, new DevService(((ProxiedPlayer) commandSender).getUniqueId(), true)), System.currentTimeMillis());
CloudAPI.getInstance().startGameServer(CloudAPI.getInstance().getServerGroupData(args[1]), serverConfig, "Dev" + args[1] + "-" + commandSender.getName());
((ProxiedPlayer) commandSender).sendMessage(CloudAPI.getInstance().getPrefix() + "The server will start up now...");
return;
}
if (args[0].equalsIgnoreCase("testServer")) {
if (!CloudAPI.getInstance().getServerGroupMap().containsKey(args[1])) {
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "The group doesn't exist");
return;
}
ServerConfig serverConfig = new ServerConfig(true, commandSender.getName(), new Document(), System.currentTimeMillis());
CloudAPI.getInstance().startCloudServer("TestServer-" + ((ProxiedPlayer) commandSender).getUniqueId(), serverConfig, 356, true);
((ProxiedPlayer) commandSender).sendMessage(CloudAPI.getInstance().getPrefix() + "The server will start up now...");
return;
}
}
case 3:
{
for (ServerInfo serverInfo : CloudProxy.getInstance().getCachedServers().values()) {
if (serverInfo.getServerConfig().getProperties().contains(NetworkUtils.DEV_PROPERTY)) {
DevService service = serverInfo.getServerConfig().getProperties().getObject(NetworkUtils.DEV_PROPERTY, DevService.class);
if (service.getUniqueId().equals(((ProxiedPlayer) commandSender).getUniqueId())) {
((ProxiedPlayer) commandSender).connect(ProxyServer.getInstance().getServerInfo(serverInfo.getServiceId().getServerId()));
return;
}
}
}
if (args[0].equalsIgnoreCase("forTemplate")) {
if (!CloudAPI.getInstance().getServerGroupMap().containsKey(args[1])) {
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "The group doesn't exist");
return;
}
ServerGroup serverGroup = CloudAPI.getInstance().getServerGroup(args[1]);
if (CollectionWrapper.filter(serverGroup.getTemplates(), new Acceptable<Template>() {
@Override
public boolean isAccepted(Template template) {
return template.getName().equalsIgnoreCase(args[2]);
}
}) == null) {
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "The template doesn't exist");
return;
}
ServerConfig serverConfig = new ServerConfig(true, commandSender.getName(), new Document(NetworkUtils.DEV_PROPERTY, new DevService(((ProxiedPlayer) commandSender).getUniqueId(), true)), System.currentTimeMillis());
CloudAPI.getInstance().startGameServer(CloudAPI.getInstance().getServerGroupData(args[1]), serverConfig, CloudAPI.getInstance().getServerGroupData(args[1]).getMemory(), true, new Properties(), CollectionWrapper.filter(serverGroup.getTemplates(), new Acceptable<Template>() {
@Override
public boolean isAccepted(Template e) {
return e.getName().equalsIgnoreCase(args[2]);
}
}), "Dev" + args[1] + "-" + commandSender.getName());
((ProxiedPlayer) commandSender).sendMessage(CloudAPI.getInstance().getPrefix() + "The server will start up now...");
return;
}
if (args[0].equalsIgnoreCase("testServer")) {
if (!CloudAPI.getInstance().getServerGroupMap().containsKey(args[1])) {
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "The group doesn't exist");
return;
}
ServerGroup serverGroup = CloudAPI.getInstance().getServerGroup(args[1]);
if (CollectionWrapper.filter(serverGroup.getTemplates(), new Acceptable<Template>() {
@Override
public boolean isAccepted(Template template) {
return template.getName().equalsIgnoreCase(args[2]);
}
}) == null) {
commandSender.sendMessage(CloudAPI.getInstance().getPrefix() + "The template doesn't exist");
return;
}
ServerConfig serverConfig = new ServerConfig(true, commandSender.getName(), new Document(), System.currentTimeMillis());
/*
CloudAPI.getInstance().startGameServer(CloudAPI.getInstance().getServerGroupData(args[1]), serverConfig,
CloudAPI.getInstance().getServerGroupData(args[1]).getMemory(),
new String[0], null, "TestServer-" + commandSender.getName(), false, true, new Properties(),
null, Arrays.asList()
, "Dev" + args[1] + "-" + commandSender.getName());
*/
CloudAPI.getInstance().startCloudServer("TestServer-" + ((ProxiedPlayer) commandSender).getUniqueId(), serverConfig, 356, true);
((ProxiedPlayer) commandSender).sendMessage(CloudAPI.getInstance().getPrefix() + "The server will start up now...");
return;
}
}
break;
}
}
use of net.md_5.bungee.api.CommandSender in project CloudNet by Dytanic.
the class CommandHub method execute.
@Override
public void execute(CommandSender commandSender, String[] args) {
if (!(commandSender instanceof ProxiedPlayer))
return;
ServerInfo serverInfo = CloudProxy.getInstance().getCachedServers().get(((ProxiedPlayer) commandSender).getServer().getInfo().getName());
if (serverInfo != null)
if (CloudProxy.getInstance().getProxyGroup().getProxyConfig().getDynamicFallback().getNamedFallbackes().contains(serverInfo.getServiceId().getGroup())) {
commandSender.sendMessage(ChatColor.translateAlternateColorCodes('&', CloudAPI.getInstance().getCloudNetwork().getMessages().getString("hub-already")));
return;
}
String fallback = CloudProxy.getInstance().fallbackOnEnabledKick((((ProxiedPlayer) commandSender)), CloudAPI.getInstance().getGroup(), ((ProxiedPlayer) commandSender).getServer().getInfo().getName());
ProxiedPlayerFallbackEvent proxiedPlayerFallbackEvent = new ProxiedPlayerFallbackEvent((ProxiedPlayer) commandSender, CloudAPI.getInstance().getOnlinePlayer(((ProxiedPlayer) commandSender).getUniqueId()), ProxiedPlayerFallbackEvent.FallbackType.HUB_COMMAND, fallback);
ProxyServer.getInstance().getPluginManager().callEvent(proxiedPlayerFallbackEvent);
fallback = proxiedPlayerFallbackEvent.getFallback();
ProxyServer.getInstance().getPluginManager().callEvent(proxiedPlayerFallbackEvent);
if (fallback == null)
commandSender.sendMessage(ChatColor.translateAlternateColorCodes('&', CloudAPI.getInstance().getCloudNetwork().getMessages().getString("hubCommandNoServerFound")));
else
((ProxiedPlayer) commandSender).connect(ProxyServer.getInstance().getServerInfo(fallback));
}
Aggregations