Adding more than 1 prefix w/ PEX API

Discussion in 'Plugin Development' started by N0neoFtheLess, Oct 30, 2015.

Thread Status:
Not open for further replies.
  1. Offline



    I need some help with setting players prefixes. Currently, it works, but it replaces prefixes - doesn't add.
    For example lets say I want a player to have VIP and VIP+. At the moment, it only shows one prefix. How could I make it so it shows both prefixes?

    I'm checking if the player has permission:
        public void onChatFormat(AsyncPlayerChatEvent event){
            Player player = event.getPlayer();
            event.setFormat(ChatColor.GRAY + "%s" + " \u00BB " + "%s");
                event.setFormat(ChatColor.GREEN + "*" + ChatColor.GRAY + "%s" + " \u00BB " + "%s");
                event.setFormat(ChatColor.AQUA + "*" + ChatColor.GRAY + "%s" + " \u00BB " + "%s");
    Here is the command (quickly put together, please ignore the slack:
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
                if(args.length < 2){
                    player.sendMessage(ChatColor.RED + "No");
                if(args.length == 3){
                    Player tplayer = player.getServer().getPlayer(args[0]);
                    String set_remove = args[1];
                    String group = args[2];
                    if(set_remove.contains("+")) {
                        PermissionGroup[] groups = {PermissionsEx.getPermissionManager().getGroup(group)};
                        player.sendMessage(ChatColor.GREEN + "Ranks updated.");
                    } else if(set_remove.contains("-")){
                        PermissionGroup[] groups = {PermissionsEx.getPermissionManager().getGroup(group)};
                        player.sendMessage(ChatColor.GREEN + "Rank updated.");
    I'm using PEX API if that helps, thanks!

    Probably something silly :p
  2. Offline


    @N0neoFtheLess You want it when a player has vip+ it will show vip and vip+? Just change the prefix for vip+ to "vip - vip+" (or which format you want)
  3. Offline


    Show both, for example;

    VIP = * (green)
    VIP+ = * (Aqua)

    I want it to show:
    **Administrafer: Hello
    (two asterisks are VIP and VIP+)

    At the moment it only shows one.
  4. Offline


    Change your prefix for vip+ to **, instead of one *.
  5. Offline


    I want them to be seperate, so the ranks just keep piling up. To help, let's edit theranks;

    - mod
    - admin
    - vip

    Someone donates (VIP) and is moderator. I want them to have both prefixes present, I believe this is called the ladder system in PEX? (Correct me if I'm wrong). Then they get admin, so it replaces mod but keeps the VIP rank. I can show you screenshots of I what I want it to look like in-game (if it's easier).
    Last edited: Nov 1, 2015
  6. Offline


    I presume it's impossible, then? In that case how would I create rank ladders (I guess that also will help my situation)?
  7. Offline


    After some help from an external source I fixed my issue - solved.
Thread Status:
Not open for further replies.

Share This Page