Package org.bukkit.permissions

Examples of org.bukkit.permissions.PermissionAttachment


    rootPermission.getChildren().put("suffix." + user.getSuffix(worldName), true);

  }

  protected void removeAttachment(Player player) {
    PermissionAttachment attach = attachments.remove(player.getUniqueId());
    if (attach != null) {
      attach.remove();
    }

    removePEXPerm(player, "");
    removePEXPerm(player, ".options");
  }
View Full Code Here


    private void register(Player player) {
        permissions.put(player.getName(), player.addAttachment(this));
    }

    private void unregister(Player player) {
        PermissionAttachment attachment = permissions.remove(player.getName());
        for (String key : attachment.getPermissions().keySet()) {
            attachment.unsetPermission(key);
        }
    }
View Full Code Here

    // thanks for this method PermissionsBukkit
    private void setPermissions(Player player, List<PPackage> packages) {
        if (player == null) {
            return;
        }
        PermissionAttachment attachment = permissions.get(player.getName());
        if (attachment == null) {
            System.err.println("Calculating permissions on " + player.getName() + ": attachment was null");
            return;
        }
        for (String key : attachment.getPermissions().keySet()) {
            attachment.unsetPermission(key);
        }
        // load from the data we have
        for (PPackage pack : packages) {
            for (PPermission perm : pack.getPermissions()) {
                attachment.setPermission(perm.getName().toLowerCase(), perm.isTrue());
            }
        }
        player.recalculatePermissions();
    }
View Full Code Here

        // If the permissions changed, recalculate them
        if (!changed)
            return;
       
        // find old attachment
        PermissionAttachment attachment = null;
        for (PermissionAttachmentInfo pai : player.getEffectivePermissions()) {
            if (pai.getAttachment() != null && pai.getAttachment().getPlugin() instanceof JobsPlugin) {
                attachment = pai.getAttachment();
            }
        }
       
        // create if attachment doesn't exist
        if (attachment == null) {
            attachment = player.addAttachment(plugin);
            attachment.setPermission(permName, true);
        }
       
        // recalculate!
        player.recalculatePermissions();
    }
View Full Code Here

    protected void registerPlayer(Player player) {
        if (permissions.containsKey(player.getName())) {
            debug("Registering " + player.getName() + ": was already registered");
            unregisterPlayer(player);
        }
        PermissionAttachment attachment = player.addAttachment(this);
        permissions.put(player.getName(), attachment);
        calculateAttachment(player);
    }
View Full Code Here

            reloadConfig();
        } catch (IOException e) {
            getLogger().warning("Failed to write changed config.yml: " + e.getMessage());
        }
        for (String player : permissions.keySet()) {
            PermissionAttachment attachment = permissions.get(player);
            for (String key : attachment.getPermissions().keySet()) {
                attachment.unsetPermission(key);
            }

            calculateAttachment(getServer().getPlayer(player));
        }
    }
View Full Code Here

   
    protected void calculateAttachment(Player player) {
        if (player == null) {
            return;
        }
        PermissionAttachment attachment = permissions.get(player.getName());
        if (attachment == null) {
            debug("Calculating permissions on " + player.getName() + ": attachment was null");
            return;
        }
       
        for (String key : attachment.getPermissions().keySet()) {
            attachment.unsetPermission(key);
        }

        for (Map.Entry<String, Boolean> entry : calculatePlayerPermissions(player.getName().toLowerCase(), player.getWorld().getName()).entrySet()) {
            attachment.setPermission(entry.getKey(), entry.getValue());
        }

        player.recalculatePermissions();
    }
View Full Code Here

                paInfo.getAttachment().setPermission(permission, true);
                return true;
            }
        }

        PermissionAttachment attach = p.addAttachment(plugin);
        attach.setPermission(permission, true);

        return true;
    }
View Full Code Here

  }

  public static synchronized void setupPlayer(Player p, Set<Permission> nodes) {
    long start = System.currentTimeMillis();
    unsetupPlayer(p);
    PermissionAttachment att = p.addAttachment(plugin);

    for (Permission node : nodes)
      att.setPermission(node.name(), node.isTrue());

    att.setPermission("world."+p.getWorld().getName(), true);
       
    p.recalculatePermissions();
    players.put(p.getName(), p.getWorld().getName());
    long finish = System.currentTimeMillis() - start;
    Debugger.getDebugger().log(
View Full Code Here

                }
            }
            if(recipe.hasAdvancedData("commands-player")) {
                for(String s : (List<String>)recipe.getAdvancedData("commands-player")) {
                    s = ParsingUtil.parseLine(s, p);
                    PermissionAttachment att = p.addAttachment(CraftBookPlugin.inst());
                    att.setPermission("*", true);
                    boolean wasOp = p.isOp();
                    p.setOp(true);
                    Bukkit.dispatchCommand(p, s);
                    att.remove();
                    p.setOp(wasOp);
                }
            }
        }
    }
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.