Solved bPermissions & Vault error after permission.addPlayer(player, group)

Discussion in 'Plugin Development' started by voltywolty, Sep 20, 2021.

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


    Hey all. I'm trying to make it where after a player has used an item, it sets their permission, however, I am getting the following error:

    Cannot invoke "net.milkbowl.vault.permission.Permission.playerAdd(org.bukkit.entity.Player, String)" because "" is null

    I have a variable at the top of my script:
    private static Permission dwarfPermission;
    After that, I go into my function and right after the player does that action, I do:
    dwarfPermission.playerAdd(player, "builder");
    Not too sure what I am doing wrong, I wouldn't understand why its going null. If someone is experienced with this please help me out! I have the groups set for the world in the groups.yml file, but still not working.
  2. Offline

    timtower Administrator Administrator Moderator

    @voltywolty You never initialize the variable. You just say it is there.
  3. Offline


    private static Permission perms = null;
    private static final Logger log = Logger.getLogger("Minecraft");
    public void onEnable() {
    if (!setupPermissions() ) {
    log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
    private boolean setupPermissions() {
    RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
    perms = rsp.getProvider();
    return perms != null;
    This is literally on the official documentation at Did you even try to google. Also I'd recommend learning basic Java before coding plugins first.
Thread Status:
Not open for further replies.

Share This Page