Solved PEX Prefix

Discussion in 'Plugin Development' started by Mudkiper202, Jan 29, 2017.

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

    Mudkiper202

    If gotten tons of chatmanager plugins but they just dont seem to work so i just started making my own so i put in the pex api and i need help so when a player says a message it will shove in the prefix and all its color codes. I dont think ive got it right so far but heres what i got with my listener
    Code:
    public void onPlayerChat(AsyncPlayerChatEvent e) {
            Player p = e.getPlayer();
            String name = p.getName();
            PermissionUser user  = PermissionsEx.getUser(p);
            String prefix = user.getPrefix();
            e.setMessage(prefix+name+e.getMessage());
        }
     
  2. Offline

    JanTuck

    If you are going to share this dont use permissionsEx but use vault instead.
     
  3. Offline

    Mudkiper202

    Its not being shared
     
  4. Offline

    Drkmaster83

    You're likely looking for the player's group prefix, which means you're going to get the PermissionsUser's groups (or at least their first one), and get the prefix of that group. The difference with user.getPrefix() as opposed to group.getPrefix() is PermissionsEx allows player-specific prefixes, something that is seldom included in most mainstream permissions plugins.
     
Thread Status:
Not open for further replies.

Share This Page