Integrated Chat Control

Discussion in 'Spigot Plugin Development' started by LeBootifulNad, Jun 1, 2016.

  1. So I'm writing my own plugin, and I'm trying to figure out how to integrate PermissionsEx prefixes while the plugin controls the display name and suffix. Can anyone help me? Tell me what ya need to see for what I currently have.
  2. Maybe you can extend PermissionsEx (idk if it's open source) and override the methods that set name and suffix.
  3. Permissions ex has an api you can use to get the prefixes. Just look at the permissions ex plugin page on how to use the api
  4. Code (Text):
    Player p = e.getPlayer();
            String prefix = ru.tehkode.permissions.bukkit.PermissionsEx.getUser(p).getGroups()[0].getPrefix();
    There ya go
  5. Would I have to set PermissionsEx as a dependency to my plugin if I did so? And would this prefix extend if the player themself didn't have a prefix, but the group they were in did? @Timuh
  6. Getting the prefix gives you the prefix of the group unless the prefix is set for the player specific I believe. Just try.

    And yes. You will need to add it as a dependency in your ide and in your plugin.yml
  7. It is STRONGLY advised to use Vault instead of any direct hook to a specific prefix plugin.. This way the >50% of servers that use a better permissions plugin will still be able to use your plugin, too.
    • Agree Agree x 2
  8. I'm not quite sure how to do that...I'm new to plugins. And Billy, would it be troublesome for you to show me how to integrate Vault into my plugin? I don't really plan on the plugin being widely open, but it'd be nice to know for future plugins.
  9. You'll can always Google "bukkit vault" and use the documentation given by the original plugin page
  10. Look at the PEX Javadocs, this is definitely possible as I've done it in the past.
  11. Just add VaultAPI to your project then use it.

    Code (Text):

    String group = permission.getPrimaryGroup(player);
    String prefix = chat.getGroupPrefix(player.getWorld(), group);
    The permission and chat variables are vault hooks (explained here in the Linking Vault section).

    It's literally that simple. ;)
  12. I figured it out on my own. Sadly I wasn't able to find the PermissionsEx javadocs but I managed to get the plugin to do what I wanted it to do. Thank you guys for your help, so much!
  13. And what is better than pex ?
    • Useful Useful x 1