Package org.bukkit.permissions

Examples of org.bukkit.permissions.PermissionAttachment


     * @return the PermissionAttachment with all the permissions
     */
    public PermissionAttachment grantPermissions(MobArena plugin, Player p) {
        if (perms.isEmpty()) return null;
       
        PermissionAttachment pa = p.addAttachment(plugin);
        grantPerms(pa, perms, p);
        return pa;
    }
View Full Code Here


    }

    public PermissionAttachment grantLobbyPermissions(MobArena plugin, Player p) {
        if (lobbyperms.isEmpty()) return null;

        PermissionAttachment pa = p.addAttachment(plugin);
        grantPerms(pa, lobbyperms, p);
        return pa;
    }
View Full Code Here

        inventoryManager.clearInventory(p);
       
        arenaPlayer.setArenaClass(arenaClass);
        arenaClass.grantItems(p);

        PermissionAttachment pa = arenaClass.grantLobbyPermissions(plugin, p);
        replacePermissions(p, pa);

        autoReady(p);
    }
View Full Code Here

                }
            }
        }
        p.getInventory().setContents(contents);

        PermissionAttachment pa = arenaClass.grantLobbyPermissions(plugin, p);
        replacePermissions(p, pa);

        autoReady(p);
    }
View Full Code Here

        autoReady(p);
    }

    private void replacePermissions(Player p, PermissionAttachment rep) {
        PermissionAttachment old = attachments.get(p);
        if (old != null) {
            old.remove();
            p.recalculatePermissions();
        }
        if (rep != null) {
            attachments.put(p, rep);
            p.recalculatePermissions();
View Full Code Here

    }

    @Override
    public void assignClassPermissions(Player p)
    {
        PermissionAttachment pa = arenaPlayerMap.get(p).getArenaClass().grantPermissions(plugin, p);
        replacePermissions(p, pa);
    }
View Full Code Here

    }

    @Override
    public void removeClassPermissions(Player p)
    {
        PermissionAttachment pa = attachments.remove(p);
        if (pa == null) return;
       
        try {
            p.removeAttachment(pa);
        }
        catch (Exception e) {
            for (Entry<String,Boolean> entry : pa.getPermissions().entrySet()) {
                String perm = entry.getKey() + ":" + entry.getValue();
                String name = p.getName();

                Messenger.warning("[PERM01] Failed to remove permission attachment '" + perm + "' from player '" + name
                                  + "'.\nThis should not be a big issue, but please verify that the player doesn't have any permissions they shouldn't have.");
View Full Code Here

        p.recalculatePermissions();
    }

    @Override
    public void addPermission(Player p, String perm, boolean value) {
        PermissionAttachment pa = attachments.get(p);
        if (pa == null) {
            pa = p.addAttachment(plugin);
            attachments.put(p, pa);
        }
        pa.setPermission(perm, value);
        p.recalculatePermissions();
    }
View Full Code Here

    if (cache != null && permissions != null && attachments != null) {
      synchronized (permissionsLock) {
        clearPermissions();
        cache.clear();
        for (ListIterator<PermissionAttachment> it = this.attachments.listIterator(this.attachments.size()); it.hasPrevious(); ) {
          PermissionAttachment attach = it.previous();
          calculateChildPerms(attach.getPermissions(), false, attach);
        }

        for (Permission p : player.getServer().getPluginManager().getDefaultPermissions(isOp())) {
          this.permissions.put(p.getName(), new PermissionAttachmentInfo(player, p.getName(), null, true));
          calculateChildPerms(p.getChildren(), false, null);
View Full Code Here

  protected void updateAttachment(Player player) {
    updateAttachment(player, player.getWorld().getName());
  }

  protected void updateAttachment(Player player, String worldName) {
    PermissionAttachment attach = attachments.get(player.getUniqueId());
    Permission playerPerm = getCreateWrapper(player, "");
    Permission playerOptionPerm = getCreateWrapper(player, ".options");
    if (attach == null) {
      attach = player.addAttachment(plugin);
      attachments.put(player.getUniqueId(), attach);
      attach.setPermission(playerPerm, true);
      attach.setPermission(playerOptionPerm, true);
    }

    PermissionUser user = plugin.getPermissionsManager().getUser(player);
    if (user != null) {
      if (user.isDebug()) {
View Full Code Here

TOP

Related Classes of org.bukkit.permissions.PermissionAttachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.