Search in sources :

Example 46 with TextComponent

use of net.md_5.bungee.api.chat.TextComponent in project FireAPI by FireBlade-Serv.

the class FireAuth method getLoginTitle.

public Title getLoginTitle() {
    Title title = this.main.getProxy().createTitle();
    title.title(new TextComponent("§cVous devez vous connecter !"));
    title.subTitle(new TextComponent("§c/login <motdepasse>"));
    return title;
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) Title(net.md_5.bungee.api.Title)

Example 47 with TextComponent

use of net.md_5.bungee.api.chat.TextComponent in project FireAPI by FireBlade-Serv.

the class FriendsCommand method execute.

@Override
public void execute(CommandSender sender, String[] args) {
    if (args.length == 0) {
        if (sender instanceof ProxiedPlayer) {
            sender.sendMessage(new TextComponent(this.pre + "/amis add <pseudo>"));
            sender.sendMessage(new TextComponent(this.pre + "/amis remove <pseudo>"));
            sender.sendMessage(new TextComponent(this.pre + "/amis list"));
            sender.sendMessage(new TextComponent(this.pre + "/amis join <pseudo>"));
            sender.sendMessage(new TextComponent(this.pre + "/amis accept <pseudo>"));
            sender.sendMessage(new TextComponent(this.pre + "/amis gui"));
        }
        if (this.api.getRankSystem().hasRankAndSupOrConsole(sender, Rank.MANAGER_IG)) {
            sender.sendMessage(new TextComponent(this.pre + "/amis show <pseudo>"));
        }
    } else if (args.length == 1) {
        if (sender instanceof ProxiedPlayer) {
            ProxiedPlayer pp = (ProxiedPlayer) sender;
            if (args[0].equalsIgnoreCase("add")) {
                sender.sendMessage(new TextComponent(this.pre + "§cUsage : /amis add <pseuso>"));
            } else if (args[0].equalsIgnoreCase("remove")) {
                sender.sendMessage(new TextComponent(this.pre + "§cUsage : /amis remove <pseudo>"));
            } else if (args[0].equalsIgnoreCase("list")) {
                try {
                    this.friends.sendGeneratedList(pp);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } else if (args[0].equalsIgnoreCase("join")) {
                sender.sendMessage(new TextComponent(this.pre + "§cUsage : /amis join <pseudo>"));
            } else if (args[0].equalsIgnoreCase("accept")) {
                sender.sendMessage(new TextComponent(this.pre + "§cUsage : /amis accept <pseudo>"));
            } else if (args[0].equalsIgnoreCase("gui")) {
                List<String> names = new ArrayList<>();
                for (ProxiedPlayer pps : this.api.getBungeePlugin().getProxy().getPlayers()) {
                    names.add(pps.getName());
                }
                try {
                    c.sendPacket(new PacketFriends(new FriendsActionTransmetterGUI(pp.getName(), pp.getServer().getInfo().getName().concat("-spigot"), this.friends.getAllFriends(pp.getName()), names)));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } else {
                if (sender instanceof ProxiedPlayer) {
                    sender.sendMessage(new TextComponent(this.pre + "/amis add <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis remove <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis list"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis join <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis accept <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis gui"));
                }
                if (this.api.getRankSystem().hasRankAndSupOrConsole(sender, Rank.MANAGER_IG)) {
                    sender.sendMessage(new TextComponent(this.pre + "/amis show <pseudo>"));
                }
            }
        } else {
            if (args[0].equalsIgnoreCase("add") || args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("list") || args[0].equalsIgnoreCase("join") || args[0].equalsIgnoreCase("accept")) {
                sender.sendMessage(new TextComponent(this.pre + "§cErreur, la console ne peut avoir d'amis :'(" + " (sauf Glowstoner mdr, sauf que c'est moi qui écrit ces lignes sur Eclipse," + " serais-je skyzophrène ?) C'est probable dit quelqu'un à l'horizon ... §oC'est le début d'une" + " longue histoire"));
            }
        }
        if (args[0].equalsIgnoreCase("show")) {
            if (this.api.getRankSystem().hasRankAndSupOrConsole(sender, Rank.MANAGER_IG)) {
                sender.sendMessage(new TextComponent(this.pre + "§cUsage : /amis show <pseudo>"));
            } else {
                sender.sendMessage(new TextComponent(this.pre + "§cErreur, vous n'avez pas la permission d'utiliser cette fonctionnalité !"));
            }
        }
    } else if (args.length == 2) {
        if (sender instanceof ProxiedPlayer) {
            ProxiedPlayer pp = (ProxiedPlayer) sender;
            ProxiedPlayer target = getPlayerByName(args[1]);
            FirePlayer fp = new FirePlayer(pp, this.api);
            if (args[0].equalsIgnoreCase("add")) {
                if (target == null) {
                    pp.sendMessage(new TextComponent(this.pre + "§cErreur, aucun joueur trouvé pour \"" + args[1] + "\" !"));
                    return;
                }
                if (target.equals(pp)) {
                    pp.sendMessage(new TextComponent(this.pre + "§cVous devriez pensez à soigner votre skyzophrènie"));
                    return;
                }
                try {
                    if (!this.friends.isAlreadyFriends(pp, target)) {
                        if (this.friends.canHaveMoreFriends(fp)) {
                            pp.sendMessage(new TextComponent(this.pre + "§aVous avez bien " + "envoyé votre demande à §2" + target.getName()));
                            this.friends.sendRequest(pp, target);
                        } else {
                            pp.sendMessage(new TextComponent(this.pre + "§cErreur vous avez ateint le nombre maximum d'amis pour votre grade !"));
                        }
                    } else {
                        pp.sendMessage(new TextComponent(this.pre + "§cErreur, vous êtes déjà " + "ami avec " + target.getName() + " !"));
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } else if (args[0].equalsIgnoreCase("remove")) {
                try {
                    this.friends.removeFriend(pp, args[1]);
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            } else if (args[0].equalsIgnoreCase("join")) {
                sender.sendMessage(new TextComponent(this.pre + "§5Indisponible pour le moment !"));
            } else if (args[0].equalsIgnoreCase("accept")) {
                if (target == null) {
                    pp.sendMessage(new TextComponent(this.pre + "§cErreur, aucun joueur trouvé pour \"" + args[1] + "\" !"));
                    return;
                }
                try {
                    this.friends.acceptRequest(pp, target);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } else if (args[0].equalsIgnoreCase("show")) {
                if (this.api.getRankSystem().hasRankAndSupOrConsole(sender, Rank.MANAGER_IG)) {
                    try {
                        this.friends.sendGeneratedListOther(sender, args[1]);
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    }
                } else {
                    sender.sendMessage(new TextComponent(this.pre + "§cErreur, vous n'avez pas la permission d'utiliser cette fonctionnalité !"));
                }
            } else {
                if (sender instanceof ProxiedPlayer) {
                    sender.sendMessage(new TextComponent(this.pre + "/amis add <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis remove <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis list"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis join <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis accept <pseudo>"));
                    sender.sendMessage(new TextComponent(this.pre + "/amis gui"));
                }
                if (sender.hasPermission("fireapi.friends.showother")) {
                    sender.sendMessage(new TextComponent(this.pre + "/amis show <pseudo>"));
                }
            }
        } else {
            if (args[0].equalsIgnoreCase("add") || args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("list") || args[0].equalsIgnoreCase("join") || args[0].equalsIgnoreCase("accept")) {
                sender.sendMessage(new TextComponent(this.pre + "§cErreur, la console ne peut avoir d'amis :'(" + " (sauf Glowstoner mdr, sauf que c'est moi qui écrit ses lignes sur Eclipse," + " serais-je skyzophrène ?) C'est probable dit quelqu'un à l'horizon ... C'est le début d'une" + " longue histoire"));
            } else {
                try {
                    this.friends.sendGeneratedListOther(sender, args[1]);
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }
        }
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) FirePlayer(fr.glowstoner.fireapi.player.FirePlayer) FriendsActionTransmetterGUI(fr.glowstoner.fireapi.bungeecord.friends.packets.action.FriendsActionTransmetterGUI) ArrayList(java.util.ArrayList) IOException(java.io.IOException) PacketFriends(fr.glowstoner.fireapi.bungeecord.friends.packets.PacketFriends)

Example 48 with TextComponent

use of net.md_5.bungee.api.chat.TextComponent 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."));
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) FirePlayer(fr.glowstoner.fireapi.player.FirePlayer) LoginSuccessEvent(fr.glowstoner.fireapi.bungeecord.events.LoginSuccessEvent) UnsupportedEncodingException(java.io.UnsupportedEncodingException) NoSuchPaddingException(javax.crypto.NoSuchPaddingException) IllegalBlockSizeException(javax.crypto.IllegalBlockSizeException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) BadPaddingException(javax.crypto.BadPaddingException) InvalidKeyException(java.security.InvalidKeyException)

Example 49 with TextComponent

use of net.md_5.bungee.api.chat.TextComponent 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;
        }
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer)

Example 50 with TextComponent

use of net.md_5.bungee.api.chat.TextComponent in project FireAPI by FireBlade-Serv.

the class StaffChatCommand method send.

public void send(ProxiedPlayer p, String message) {
    String pname = this.api.getChatUtils().getStringRank(p.getName()) + " " + this.api.getChatUtils().getRankColor(p.getName()) + p.getName();
    Iterator<ProxiedPlayer> it = this.players.keySet().iterator();
    while (it.hasNext()) {
        ProxiedPlayer next = it.next();
        if (this.players.get(next)) {
            next.sendMessage(new TextComponent(this.pre + pname + "§r§o : " + message));
        }
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer)

Aggregations

TextComponent (net.md_5.bungee.api.chat.TextComponent)78 ClickEvent (net.md_5.bungee.api.chat.ClickEvent)21 HoverEvent (net.md_5.bungee.api.chat.HoverEvent)15 Player (org.bukkit.entity.Player)14 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)12 ComponentBuilder (net.md_5.bungee.api.chat.ComponentBuilder)12 ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)12 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)11 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)6 BaseComponent (net.md_5.bungee.api.chat.BaseComponent)6 Configuration (net.md_5.bungee.config.Configuration)6 YamlConfiguration (net.md_5.bungee.config.YamlConfiguration)6 ISoliniaItem (com.solinia.solinia.Interfaces.ISoliniaItem)5 ChatColor (net.md_5.bungee.api.ChatColor)5 ItemStack (org.bukkit.inventory.ItemStack)5 ISoliniaLivingEntity (com.solinia.solinia.Interfaces.ISoliniaLivingEntity)4 ISoliniaSpell (com.solinia.solinia.Interfaces.ISoliniaSpell)4 DecimalFormat (java.text.DecimalFormat)4 HashMap (java.util.HashMap)4