[Unsupported] [Bungee - Bukkit rank & permissions synchronization] 2.1

Synchronize BungeeCord rank & permissions in Spigot server !

  1. dbzjp
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    BBRankManager - UNSUPPORTED
    BBRankManager is a plugin that allows you to create and manage groups that will be applied throughout all the servers that the BungeeCord has.

    Features
    - Synchronize permissions on Spigot servers throughout the BungeeCord
    - Custom rank prefix/suffix (Need a compatible chat plugin)
    - Automatic chat color for a rank (Need a compatible chat plugin)
    - Permissions can be set for a specific server and not for another
    - A player can have a rank on a server but not on another
    - Easy to use
    - Does not support reload.


    Commands
    - /bbrank → Show the main menu (With clickables commands)
    - /bbrank setrank <player> <server/*> <rank> → Set a rank for a player on a specific server OR everywhere
    - /bbrank unsetrank <player> <server/*> → Unset a player rank
    - /bbrank create <rank> → Create a rank
    - /bbrank delete <rank> → Delete a rank
    - /bbrank setprefix <rank> <prefix/remove> → Define a rank prefix OR remove it.
    - /bbrank setsuffix <rank> <suffix/remove> → Define a rank suffix OR remove it.
    - /bbrank setchatcolor <rank> <&X/remove> → Set a rank chatcolor OR remove it.
    - /bbrank setperm <rank> <server/*> <permission> → Set a permission for a rank on a specific server OR everywhere
    - /bbrank unsetperm <rank> <server/*> <permission> → Unset a permission for a rank on a specific server OR everywhere
    - /bbrank info <rank> → Shows informations about a rank

    Permissions

    - bbrankmanager.admin → Access to every command listed above
    - bbrankmanager.create → Access to the /bbrank create
    - bbrankmanager.delete → Access to the /bbrank delete
    - bbrankmanager.info → Access to the /bbrank info
    - bbrankmanager.setprefix → Access to the /bbrank setprefix(*)
    - bbrankmanager.setsuffix → Access to the /bbrank setsuffix(*)
    - bbrankmanager.setchatcolor → Access to the /bbrank setchatcolor(*)
    - bbrankmanager.unsetrank → Access to the /bbrank unsetrank(*)
    - bbrankmanager.setperm → Access to the /bbrank setperm(*)
    - bbrankmanager.unsetperm → Access to the /bbrank unsetperm(*)
    - bbrankmanager.setrank → Access to the /bbrank setrank
    - bbrankmanager.setrank.* → Access to the /bbrank setrank for every rank
    - bbrankmanager.setrank.{RANKNAME} → Access to the /bbrank setrank for {RANKNAME}

    * → These commands are dangerous, they can be executed by any rank to another, that means that you have to give access to them very carefully.

    How to / Q&A
    → How to setup the plugin ?
    → You need to put the spigot version inside EVERY spigot server that shall be linked to the permission system, and just put the bungee version inside your bungeecord plugins.
    → How to show a rank prefix in the chat ?
    → You need to use a compatible chat plugin (eg. EssentialsChat) and put the variable {PREFIX} inside the chat-format
    Code (YAML):
     format: '{PREFIX} {DISPLAYNAME} {SUFFIX}: {CHATCOLOR} {MESSAGE}'
     
    → How to show a rank suffix in the chat ?
    → You need to use a compatible chat plugin (eg. EssentialsChat) and put the variable {SUFFIX} inside the chat-format
    Code (YAML):
     format: '{PREFIX} {DISPLAYNAME} {SUFFIX}: {CHATCOLOR} {MESSAGE}'
     

    → How to show a rank suffix in the chat ?
    → You need to use a compatible chat plugin (eg. EssentialsChat) and put the variable {CHATCOLOR} inside the chat-format, just before the message starts
    Code (YAML):
     format: '{PREFIX} {DISPLAYNAME} {SUFFIX}: {CHATCOLOR} {MESSAGE}'
     
    → How to set a rank to a player on every server ?
    → Just replace the server name by *
    → How to set a permission to a rank on every server ?
    → Just replace the server name by *
    → I put a Bungee permission for a rank and it doesn't work!!
    → BBRankManager ONLY manage spigot permission through BungeeCord, and not the Bungee's permissions itself.
    → The plugin isn't working!!!!!!!! :cry::cry::cry:
    → Send me a PM.

    PlaceholderAPI
    In order to use this, you need PlaceholderAPI (https://www.spigotmc.org/resources/placeholderapi.6245/), and the variables are:
    - %BBRankManager_prefix%
    - %BBRankManager_suffix%
    - %BBRankManager_chatcolor%

    They'll return "None" if the selected player hasn't got what is called.

    API
    BBRankManager BungeeCord API
    Import the BungeeCord version of BBRankManager, and use com.dbzjp.bbrankmanager.BungeeAPI to access it.

    Code (Java):
    package com.dbzjp.bbrankmanager;

    import java.io.File;
    import java.util.ArrayList;

    import net.md_5.bungee.config.Configuration;
    import net.md_5.bungee.config.ConfigurationProvider;
    import net.md_5.bungee.config.YamlConfiguration;

    public class BungeeAPI {

        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static String getRankForServer(String player, String servername) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
            File players = new File(Main.getInstance().getDataFolder(), "players.yml");
           
            @SuppressWarnings("unused")
            Configuration cranks = null;
            Configuration cplayers = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cplayers = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(players);
                String group = "";

                if(cplayers.contains(player + ".*")) {
                    group = cplayers.getString(player + ".*");
                    return group;
                }
                else if(cplayers.contains(player + "." + servername)) {
                    group = cplayers.getString(player + "." + servername);
                    return group;
                }
                else {
                    return "null";
                }
            }
            catch(Exception ex) {
                ex.printStackTrace();
                return "null";
            }
        }
       
        @SuppressWarnings({ "rawtypes", "unchecked" })
        public static ArrayList<String> getPlayerPermissions(String player, String servername) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
            File players = new File(Main.getInstance().getDataFolder(), "players.yml");
           
            Configuration cranks = null;
            Configuration cplayers = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cplayers = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(players);
                String group = "";
                ArrayList<String> perms = new ArrayList<String>();
               
                if(cplayers.contains(player + ".*")) {
                    group = cplayers.getString(player + ".*");
                }
                else if(cplayers.contains(player + "." + servername)) {
                    group = cplayers.getString(player + "." + servername);
                }
                else {
                    return null;
                }
               
                if(cranks.contains("ranks." + group + ".permissions.servers.*")) {
                    perms.addAll(cranks.getStringList("ranks." + group + ".permissions.servers.*"));
                }
               
                if(cranks.contains("ranks." + group + ".permissions.servers." + servername)) {
                    perms.addAll(cranks.getStringList("ranks." + group + ".permissions.servers." + servername));
                }
               
                return perms;
               
            }
            catch(Exception ex) {
                ex.printStackTrace();
                return null;
            }
        }
       

        @SuppressWarnings({ "rawtypes", "unchecked" })
        public static ArrayList<String> getGroupPermissions(String group, String servername) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                ArrayList<String> perms = new ArrayList<String>();
               
                if(cranks.contains("ranks." + group)) {
                    if(cranks.contains("ranks." + group + ".permissions.servers.*")) {
                        perms.addAll(cranks.getStringList("ranks." + group + ".permissions.servers.*"));
                    }
                   
                    if(cranks.contains("ranks." + group + ".permissions.servers." + servername)) {
                        perms.addAll(cranks.getStringList("ranks." + group + ".permissions.servers." + servername));
                    }
                   
                    return perms;
                }
                else {
                    return null;
                }
               
               
            }
            catch(Exception ex) {
                ex.printStackTrace();
                return null;
            }
        }      
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static String getPrefix(String group) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
               
                if(cranks.contains("ranks." + group)) {
                    return cranks.getString("ranks." + group + ".rank-prefix");
                }
                else {
                    return "null";
                }
               
               
            }
            catch(Exception ex) {
                ex.printStackTrace();
                return null;
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static String getSuffix(String group) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
               
                if(cranks.contains("ranks." + group)) {
                    return cranks.getString("ranks." + group + ".rank-suffix");
                }
                else {
                    return "null";
                }
               
               
            }
            catch(Exception ex) {
                ex.printStackTrace();
                return null;
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static String getChatcolor(String group) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
               
                if(cranks.contains("ranks." + group)) {
                    return cranks.getString("ranks." + group + "rank-chatcolor");
                }
                else {
                    return "null";
                }
               
               
            }
            catch(Exception ex) {
                ex.printStackTrace();
                return null;
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void setRank(String player, String rank, String server) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cranks.set(player + "." + server, rank);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "players.yml"));
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void unsetRank(String player, String server) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cranks.set(player + "." + server, null);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "players.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void addPerm(String rank, String server, String perm) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                ArrayList<String> perms = new ArrayList<String>();
                perms.addAll(cranks.getStringList("ranks." + rank + ".permissions.servers." + server));
                perms.add(perm);
                cranks.set("ranks." + rank + ".permissions.servers." + server, perms);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "ranks.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void removePerm(String rank, String server, String perm) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                ArrayList<String> perms = new ArrayList<String>();
                perms.addAll(cranks.getStringList("ranks." + rank + ".permissions.servers." + server));
                perms.remove(perm);
                cranks.set("ranks." + rank + ".permissions.servers." + server, perms);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "ranks.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void setPrefix(String rank, String prefix) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cranks.set("ranks." + rank + ".rank-prefix", prefix);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "ranks.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void setSuffix(String rank, String suffix) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cranks.set("ranks." + rank + ".rank-suffix", suffix);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "ranks.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void setChatcolor(String rank, String color) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cranks.set("ranks." + rank + ".rank-chatcolor", color);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "ranks.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void createRank(String rankname) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cranks.set("ranks." + rankname + ".rank-prefix", "none");
                cranks.set("ranks." + rankname + ".rank-suffix", "none");
                cranks.set("ranks." + rankname + ".rank-chatcolor", "none");
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "ranks.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
       
       
        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static void deleteRank(String rankname) {
            File ranks = new File(Main.getInstance().getDataFolder(), "ranks.yml");
           
            Configuration cranks = null;
            try {
                cranks = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(ranks);
                cranks.set("ranks." + rankname, null);
                ConfigurationProvider.getProvider(YamlConfiguration.class).save(cranks, new File(Main.getInstance().getDataFolder(), "ranks.yml"));

               
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
    }
     

    BBRankManager Spigot API
    Import the Spigot version of BBRankManager, and use com.dbzjp.bbrankmanager.BukkitAPI to access it.

    Code (Java):
    package com.dbzjp.bbrankmanager;

    import java.util.ArrayList;

    import org.bukkit.entity.Player;

    public class BukkitAPI {

        public static String getPrefix(Player p) {
            return Main.getInstance().lprefix.get(p.getName());
        }
       
        public static String getSuffix(Player p) {
            return Main.getInstance().lsuffix.get(p.getName());
        }
       
        public static String getChatcolor(Player p) {
            return Main.getInstance().lsuffix.get(p.getName());
        }
       
        public static ArrayList<String> getPermissions(Player p) {
            return Main.getInstance().permissions.get(p.getName());
        }
       
       
    }
     

Recent Updates

  1. PlaceholderAPI support
  2. Magical update
  3. Memory leaks fixs

Recent Reviews

  1. LoJoSho
    LoJoSho
    4/5,
    Version: 2.1
    The plugin is very good. It offers much flexibility and it simply is easy for even the basics to get into. The only problem is that it does not support /reload which can be a pain when you need to fix something, having to kick the whole server for it.
  2. Alfatrick
    Alfatrick
    5/5,
    Version: 2.1
    Amazing plugin, I find it excellent, I highly recommend it to all! Thank you very much !
  3. Guozhi
    Guozhi
    5/5,
    Version: 1.0
    cool cool