Java 类org.bukkit.permissions.PermissionDefault 实例源码

项目:Bags2    文件:CraftListener.java   
@EventHandler
public void onCraft(CraftItemEvent e)
{
    Player p = (Player) e.getWhoClicked();
    if(e.getRecipe() instanceof ShapedRecipe)
    {
        ShapedRecipe sr = (ShapedRecipe) e.getRecipe();
        if(Bukkit.getBukkitVersion().contains("1.11"))
        {
            for(BagBase  bb : Util.getBags())
            {
                if(((ShapedRecipe)bb.getRecipe()).getShape().equals(sr.getShape()))
                {
                    if(!hasPermission(new Permission("bag.craft." + bb.getName(), PermissionDefault.TRUE), p))
                    e.setCancelled(true);                   
                }
            }
        }
        else
        if(sr.getKey().getNamespace().startsWith("bag_"))
        {
            if(!hasPermission(new Permission("bag.craft." + sr.getKey().getKey(), PermissionDefault.TRUE), p))
            e.setCancelled(true);
        }
    }
}
项目:ProjectAres    文件:Lobby.java   
@Override
public void onEnable() {
    // Ensure parsing errors show in the console on Lobby servers,
    // since PGM is not around to do that.
    mapdevLogger.setUseParentHandlers(true);

    this.getServer().getPluginManager().registerEvents(new EnvironmentControlListener(), this);
    this.getServer().getPluginManager().registerEvents(new Gizmos(), this);
    this.getServer().getMessenger().registerOutgoingPluginChannel(this, BUNGEE_CHANNEL);

    this.setupScoreboard();
    this.loadConfig();

    for(Gizmo gizmo : Gizmos.gizmos) {
        Bukkit.getPluginManager().addPermission(new Permission(gizmo.getPermissionNode(), PermissionDefault.FALSE));
    }

    Settings settings = new Settings(this);
    settings.register();

    navigatorInterface.setOpenButtonSlot(Slot.Hotbar.forPosition(0));
}
项目:ProjectAres    文件:NicknameCommands.java   
@Override
public void enable() {
    final PermissionAttachment attachment = Bukkit.getConsoleSender().addAttachment(plugin);
    Stream.of(
        PERMISSION,
        PERMISSION_GET,
        PERMISSION_SET,
        PERMISSION_ANY,
        PERMISSION_ANY_GET,
        PERMISSION_ANY_SET,
        PERMISSION_IMMEDIATE
    ).forEach(name -> {
        final Permission permission = new Permission(name, PermissionDefault.FALSE);
        pluginManager.addPermission(permission);
        attachment.setPermission(permission, true);
    });
}
项目:Thermos-Bukkit    文件:DefaultPermissions.java   
public static Permission registerPermission(Permission perm, boolean withLegacy) {
    Permission result = perm;

    try {
        Bukkit.getPluginManager().addPermission(perm);
    } catch (IllegalArgumentException ex) {
        result = Bukkit.getPluginManager().getPermission(perm.getName());
    }

    if (withLegacy) {
        Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
        legacy.getChildren().put(result.getName(), true);
        registerPermission(perm, false);
    }

    return result;
}
项目:bukkit-plugin-annotations    文件:PluginAnnotationProcessor.java   
/**
 * Processes a command.
 *
 * @param permissionAnnotation The annotation.
 * @return The generated permission metadata.
 */
protected Map<String, Object> processPermission (Permission permissionAnnotation) {
        Map<String, Object> permission = new HashMap<> ();

        if (!"".equals (permissionAnnotation.description ())) {
                permission.put ("description", permissionAnnotation.description ());
        }
        if (PermissionDefault.OP != permissionAnnotation.defaultValue ()) {
                permission.put ("default", permissionAnnotation.defaultValue ().toString ().toLowerCase ());
        }

        if (permissionAnnotation.children ().length > 0) {
                Map<String, Boolean> childrenList = new HashMap<> ();
                for (ChildPermission childPermission : permissionAnnotation.children ()) {
                        childrenList.put (childPermission.value (), childPermission.inherit ());
                }
                permission.put ("children", childrenList);
        }

        return permission;
}
项目:CloudPacks    文件:CloudPackCommand.java   
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (cmd.getName().equalsIgnoreCase("cloudpacks")) {
        if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
            sendHelp(sender);
            return true;
        }

        if (args.length >= 1) {
            if (args[0].equalsIgnoreCase("list")) {
                if (args.length >= 2) {
                    if (sender.hasPermission(new Permission("cloudpacks.list.other", PermissionDefault.OP))) {
                        OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]);

                    }
                }
            } else if (args[0].equalsIgnoreCase("give")) {


            } else if (args[0].equalsIgnoreCase("givekey")) {

            }
        }

    }
    return true;
}
项目:CauldronGit    文件:DefaultPermissions.java   
public static Permission registerPermission(Permission perm, boolean withLegacy) {
    Permission result = perm;

    try {
        Bukkit.getPluginManager().addPermission(perm);
    } catch (IllegalArgumentException ex) {
        result = Bukkit.getPluginManager().getPermission(perm.getName());
    }

    if (withLegacy) {
        Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
        legacy.getChildren().put(result.getName(), true);
        registerPermission(perm, false);
    }

    return result;
}
项目:AdvancedAchievements    文件:AdvancedAchievements.java   
/**
 * Registers permissions that depend on the user's configuration file (for MultipleAchievements; for instance for
 * stone breaks, achievement.count.breaks.stone will be registered).
 */
private void registerPermissions() {
    getLogger().info("Registering permissions...");

    PluginManager pluginManager = getServer().getPluginManager();
    for (MultipleAchievements category : MultipleAchievements.values()) {
        for (String section : config.getConfigurationSection(category.toString()).getKeys(false)) {
            int startOfMetadata = section.indexOf(':');
            if (startOfMetadata > -1) {
                // Permission ignores metadata (eg. sand:1) for Breaks, Places and Crafts categories.
                section = section.substring(0, startOfMetadata);
            }
            if (category == MultipleAchievements.PLAYERCOMMANDS) {
                // Permissions don't take spaces into account for this category.
                section = StringUtils.replace(section, " ", "");
            }

            // Bukkit only allows permissions to be set once, check to ensure they were not previously set when
            // performing /aach reload.
            if (pluginManager.getPermission(category.toPermName() + "." + section) == null) {
                pluginManager.addPermission(
                        new Permission(category.toPermName() + "." + section, PermissionDefault.TRUE));
            }
        }
    }
}
项目:Craftbukkit    文件:CommandPermissions.java   
public static Permission registerPermissions(Permission parent) {
    Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla minecraft commands", parent);

    DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "tell", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands);

    commands.recalculatePermissibles();
    return commands;
}
项目:Zephyrus-II    文件:PermissionsManager.java   
public static void registerPermissions() {
    addPermission(new Permission("zephyrus.command.spelltome", "Permission to use the '/spelltome' command", PermissionDefault.OP));
    addPermission(new Permission("zephyrus.command.teach", "Permission to use the '/teach' command", PermissionDefault.OP));
    addPermission(new Permission("zephyrus.command.aspects", "Permission to use the '/aspects' command", PermissionDefault.TRUE));
    addPermission(new Permission("zephyrus.command.bind", "Permission to use the '/bind' command", PermissionDefault.TRUE));
    addPermission(new Permission("zephyrus.command.book", "Permission to use the '/book' command", PermissionDefault.TRUE));
    addPermission(new Permission("zephyrus.command.cast", "Permission to use the '/cast' command", PermissionDefault.TRUE));
    addPermission(new Permission("zephyrus.command.level", "Permission to check level with '/level'", PermissionDefault.TRUE));
    addPermission(new Permission("zephyrus.command.level.add", "Permission to increase level with '/level add'", PermissionDefault.OP));
    addPermission(new Permission("zephyrus.command.level.other", "Permission to check other player's level with '/level <player>'", PermissionDefault.OP));
    addPermission(new Permission("zephyrus.command.mana", "Permission to check mana with '/mana'", PermissionDefault.TRUE));
    addPermission(new Permission("zephyrus.command.mana.restore", "Permission to restore mana with '/mana restore'", PermissionDefault.OP));
    addPermission(new Permission("zephyrus.command.mana.other", "Permission to check other player's mana with '/mana <player>'", PermissionDefault.OP));
    addPermission(new Permission("zephyrus.command.book.bypass", "Permission to ignore the book limit of '/book'", PermissionDefault.FALSE));
    addPermission(new Permission("zephyrus.shop.create", "Allows user to create shops", PermissionDefault.OP));
    addPermission(new Permission("zephyrus.shop.use", "Allows user to use shops", PermissionDefault.TRUE));
    for (Permission permission : permissions) {
        Bukkit.getPluginManager().addPermission(permission);
    }
}
项目:Zephyrus-II    文件:CoreSpellManager.java   
@Override
public void registerSpell(Spell spell) {
    if (spellConfig.getConfig().getBoolean(spell.getDefaultName() + ".Enabled")) {
        this.spellList.add(spell);
        PermissionsManager.addPermission(new Permission("zephyrus.spell.learn." + spell.getDefaultName().toLowerCase()));
        PermissionsManager.addPermission(new Permission("zephyrus.spell.cast." + spell.getDefaultName().toLowerCase(),
                "Permission to cast the " + spell.getDefaultName() + " spell", PermissionDefault.FALSE));
        if (spell instanceof Configurable) {
            ((Configurable) spell).loadConfiguration(spellConfig.getConfig().getConfigurationSection(
                    spell.getDefaultName()));
        }
        if (spell instanceof Listener) {
            Bukkit.getPluginManager().registerEvents((Listener) spell, Zephyrus.getPlugin());
        }
    }
}
项目:Cauldron    文件:DefaultPermissions.java   
public static Permission registerPermission(Permission perm, boolean withLegacy) {
    Permission result = perm;

    try {
        Bukkit.getPluginManager().addPermission(perm);
    } catch (IllegalArgumentException ex) {
        result = Bukkit.getPluginManager().getPermission(perm.getName());
    }

    if (withLegacy) {
        Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
        legacy.getChildren().put(result.getName(), true);
        registerPermission(perm, false);
    }

    return result;
}
项目:Cauldron    文件:DefaultPermissions.java   
public static Permission registerPermission(Permission perm, boolean withLegacy) {
    Permission result = perm;

    try {
        Bukkit.getPluginManager().addPermission(perm);
    } catch (IllegalArgumentException ex) {
        result = Bukkit.getPluginManager().getPermission(perm.getName());
    }

    if (withLegacy) {
        Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
        legacy.getChildren().put(result.getName(), true);
        registerPermission(perm, false);
    }

    return result;
}
项目:Cauldron    文件:DefaultPermissions.java   
public static Permission registerPermission(Permission perm, boolean withLegacy) {
    Permission result = perm;

    try {
        Bukkit.getPluginManager().addPermission(perm);
    } catch (IllegalArgumentException ex) {
        result = Bukkit.getPluginManager().getPermission(perm.getName());
    }

    if (withLegacy) {
        Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
        legacy.getChildren().put(result.getName(), true);
        registerPermission(perm, false);
    }

    return result;
}
项目:Almura-API    文件:DefaultPermissions.java   
public static Permission registerPermission(Permission perm, boolean withLegacy) {
    Permission result = perm;

    try {
        Bukkit.getPluginManager().addPermission(perm);
    } catch (IllegalArgumentException ex) {
        result = Bukkit.getPluginManager().getPermission(perm.getName());
    }

    if (withLegacy) {
        Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
        legacy.getChildren().put(result.getName(), true);
        registerPermission(perm, false);
    }

    return result;
}
项目:uppercore    文件:UpdateChecker.java   
public UpdateChecker(Plugin plugin, String spigotFullId) {
    this.plugin = plugin;
    this.spigotId = spigotFullId;
    try {
        this.spigotUrl = new URL("https://www.spigotmc.org/resources/" + spigotId + "/");
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException("Invalid spigot id: " + spigotId);
    }
    this.logger = plugin.getLogger();
    permission = new Permission(plugin.getName() + ".update");
    permission.setDefault(PermissionDefault.OP);
    Bukkit.getPluginManager().addPermission(permission);
    setInterval(20*60*30);//30 minutes
    message = buildMessage();
}
项目:ProjectAres    文件:ChannelMatchModule.java   
@Inject ChannelMatchModule(Match match, Plugin plugin) {
    this.matchListeningPermission = new Permission("pgm.chat.all." + match.getId() + ".receive", PermissionDefault.FALSE);

    final OnlinePlayerMapAdapter<Boolean> map = new OnlinePlayerMapAdapter<>(plugin);
    map.enable();
    this.teamChatters = new DefaultMapAdapter<>(map, true, false);
}
项目:ProjectAres    文件:RaindropManifest.java   
@Override
protected void configure() {
    requestStaticInjection(RaindropUtil.class);

    new PluginFacetBinder(binder())
        .register(RaindropCommands.class);

    final PermissionBinder permissions = new PermissionBinder(binder());
    for(int i = RaindropConstants.MULTIPLIER_MAX; i > 0; i = i - RaindropConstants.MULTIPLIER_INCREMENT) {
        permissions.bindPermission().toInstance(new Permission("raindrops.multiplier." + i, PermissionDefault.FALSE));
    }
}
项目:ProjectAres    文件:PermissionGroupListener.java   
private boolean updatePermission(String name, Map<String, Boolean> before, Map<String, Boolean> after) {
    if(Objects.equals(before, after)) return false;

    final Permission perm = new Permission(name, PermissionDefault.FALSE, after);
    pluginManager.removePermission(perm);
    pluginManager.addPermission(perm);
    return true;
}
项目:Debuggery    文件:InputFormatterTest.java   
@Test
public void testValueFromEnum() throws InputException {
    Class[] inputTypes = {
            WeatherType.class,
            EquipmentSlot.class,
            MainHand.class,
            PermissionDefault.class
    };

    String[] input = {
            "downfall",
            "HeAd",
            "lEfT",
            "NOT_OP"
    };

    Object[] output = InputFormatter.getTypesFromInput(inputTypes, Arrays.asList(input), null);

    // First let's make sure we didn't lose anything, or get anything
    assertEquals(inputTypes.length, output.length);

    // Next let's make sure everything is the right type
    assertTrue(output[0] instanceof WeatherType);
    assertTrue(output[1] instanceof EquipmentSlot);
    assertTrue(output[2] instanceof MainHand);
    assertTrue(output[3] instanceof PermissionDefault);

    // Finally, let's make sure the values are correct
    assertSame(output[0], WeatherType.DOWNFALL);
    assertSame(output[1], EquipmentSlot.HEAD);
    assertSame(output[2], MainHand.LEFT);
    assertSame(output[3], PermissionDefault.NOT_OP);
}
项目:Bags    文件:PlayerJoinListener.java   
@EventHandler
public void onJoin(PlayerMoveEvent e)
{
    if(!tl.contains(e.getPlayer()))
    {
        if(e.getPlayer().hasPermission(new Permission("bag.resource",PermissionDefault.TRUE)) && Bags.cfg.getBoolean("resourcepack-enabled"))
        {
            Util.sendRequest(e.getPlayer());
        }
    }

    tl.add(e.getPlayer());
}
项目:Thermos-Bukkit    文件:SimplePluginManager.java   
private void calculatePermissionDefault(Permission perm) {
    if ((perm.getDefault() == PermissionDefault.OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
        defaultPerms.get(true).add(perm);
        dirtyPermissibles(true);
    }
    if ((perm.getDefault() == PermissionDefault.NOT_OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
        defaultPerms.get(false).add(perm);
        dirtyPermissibles(false);
    }
}
项目:Thermos-Bukkit    文件:CommandPermissions.java   
private static Permission registerWhitelist(Permission parent) {
    Permission whitelist = DefaultPermissions.registerPermission(PREFIX + "whitelist", "Allows the user to modify the server whitelist", PermissionDefault.OP, parent);

    DefaultPermissions.registerPermission(PREFIX + "whitelist.add", "Allows the user to add a player to the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.remove", "Allows the user to remove a player from the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.reload", "Allows the user to reload the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.enable", "Allows the user to enable the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.disable", "Allows the user to disable the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.list", "Allows the user to list all the users on the server whitelist", whitelist);

    whitelist.recalculatePermissibles();

    return whitelist;
}
项目:Thermos-Bukkit    文件:CommandPermissions.java   
private static Permission registerSave(Permission parent) {
    Permission save = DefaultPermissions.registerPermission(PREFIX + "save", "Allows the user to save the worlds", PermissionDefault.OP, parent);

    DefaultPermissions.registerPermission(PREFIX + "save.enable", "Allows the user to enable automatic saving", save);
    DefaultPermissions.registerPermission(PREFIX + "save.disable", "Allows the user to disable automatic saving", save);
    DefaultPermissions.registerPermission(PREFIX + "save.perform", "Allows the user to perform a manual save", save);

    save.recalculatePermissibles();

    return save;
}
项目:Thermos-Bukkit    文件:CommandPermissions.java   
public static Permission registerPermissions(Permission parent) {
    Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all CraftBukkit commands", parent);

    registerWhitelist(commands);
    registerBan(commands);
    registerUnban(commands);
    registerOp(commands);
    registerSave(commands);
    registerTime(commands);

    DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "tell", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "help", "Allows the user to view the vanilla help menu", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "plugins", "Allows the user to view the list of plugins running on this server", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "reload", "Allows the user to reload the server settings", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "version", "Allows the user to view the version of the server", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);

    commands.recalculatePermissibles();

    return commands;
}
项目:AnnihilationPro    文件:ConfigurableKit.java   
@Override
public boolean Initialize()
{
    //TODO------Change all the class instances to use this one instance instead of KitConfig.getInstance()
    instance = KitConfig.getInstance();
    int x = 0;
    ConfigurationSection sec = instance.getKitSection(getInternalName());
    if(sec == null)
    {
        sec = instance.createKitSection(getInternalName());
        x++;
    }

    x += ConfigManager.setDefaultIfNotSet(sec, "Name", getInternalName());
    x += ConfigManager.setDefaultIfNotSet(sec, "Kit Description", getDefaultDescription());
    x += ConfigManager.setDefaultIfNotSet(sec, "Disable", false);
    x += ConfigManager.setDefaultIfNotSet(sec, "Free", false);
    x += setDefaults(sec);

    if(x > 0)
        instance.saveConfig();

    this.isFree = sec.getBoolean("Free");

    if(sec.getBoolean("Disable"))
        return false;

    loadKitStuff(sec);
    if(instance.useDefaultPermissions())
    {
        Permission perm = new Permission("Anni.Kits."+getName());
        perm.setDefault(PermissionDefault.FALSE);
        Bukkit.getPluginManager().addPermission(perm);
        perm.recalculatePermissibles();
    }
    icon = getIcon();
    setUp();
    this.loadout = getFinalLoadout().addNavCompass().finalizeLoadout();
    return true;
}
项目:ExilePearl    文件:TestPluginManager.java   
private void calculatePermissionDefault(Permission perm) {
    if ((perm.getDefault() == PermissionDefault.OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
        defaultPerms.get(true).add(perm);
        dirtyPermissibles(true);
    }
    if ((perm.getDefault() == PermissionDefault.NOT_OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
        defaultPerms.get(false).add(perm);
        dirtyPermissibles(false);
    }
}
项目:Pokkit    文件:PokkitPermission.java   
private static String toNukkitPermissionDefault(PermissionDefault permissionDefault) {
    switch (permissionDefault) {
    case FALSE:
        return cn.nukkit.permission.Permission.DEFAULT_FALSE;
    case NOT_OP:
        return cn.nukkit.permission.Permission.DEFAULT_NOT_OP;
    case OP:
        return cn.nukkit.permission.Permission.DEFAULT_OP;
    case TRUE:
        return cn.nukkit.permission.Permission.DEFAULT_TRUE;
    default:
        throw new UnsupportedOperationException("Unknown permission default: " + permissionDefault);
    }
}
项目:CauldronGit    文件:SimplePluginManager.java   
private void calculatePermissionDefault(Permission perm) {
    if ((perm.getDefault() == PermissionDefault.OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
        defaultPerms.get(true).add(perm);
        dirtyPermissibles(true);
    }
    if ((perm.getDefault() == PermissionDefault.NOT_OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
        defaultPerms.get(false).add(perm);
        dirtyPermissibles(false);
    }
}
项目:CauldronGit    文件:CommandPermissions.java   
private static Permission registerWhitelist(Permission parent) {
    Permission whitelist = DefaultPermissions.registerPermission(PREFIX + "whitelist", "Allows the user to modify the server whitelist", PermissionDefault.OP, parent);

    DefaultPermissions.registerPermission(PREFIX + "whitelist.add", "Allows the user to add a player to the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.remove", "Allows the user to remove a player from the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.reload", "Allows the user to reload the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.enable", "Allows the user to enable the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.disable", "Allows the user to disable the server whitelist", whitelist);
    DefaultPermissions.registerPermission(PREFIX + "whitelist.list", "Allows the user to list all the users on the server whitelist", whitelist);

    whitelist.recalculatePermissibles();

    return whitelist;
}
项目:CauldronGit    文件:CommandPermissions.java   
private static Permission registerSave(Permission parent) {
    Permission save = DefaultPermissions.registerPermission(PREFIX + "save", "Allows the user to save the worlds", PermissionDefault.OP, parent);

    DefaultPermissions.registerPermission(PREFIX + "save.enable", "Allows the user to enable automatic saving", save);
    DefaultPermissions.registerPermission(PREFIX + "save.disable", "Allows the user to disable automatic saving", save);
    DefaultPermissions.registerPermission(PREFIX + "save.perform", "Allows the user to perform a manual save", save);

    save.recalculatePermissibles();

    return save;
}
项目:CauldronGit    文件:CommandPermissions.java   
public static Permission registerPermissions(Permission parent) {
    Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all CraftBukkit commands", parent);

    registerWhitelist(commands);
    registerBan(commands);
    registerUnban(commands);
    registerOp(commands);
    registerSave(commands);
    registerTime(commands);

    DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "tell", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "help", "Allows the user to view the vanilla help menu", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "plugins", "Allows the user to view the list of plugins running on this server", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "reload", "Allows the user to reload the server settings", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "version", "Allows the user to view the version of the server", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);

    commands.recalculatePermissibles();

    return commands;
}
项目:PlotSquared-Chinese    文件:BukkitPlayer.java   
@Override
public boolean getAttribute(String key) {
    key = "plotsquared_user_attributes." + key;
    Permission perm = Bukkit.getServer().getPluginManager().getPermission(key);
    if (perm == null) {
        perm = new Permission(key, PermissionDefault.FALSE);
        Bukkit.getServer().getPluginManager().addPermission(perm);
        Bukkit.getServer().getPluginManager().recalculatePermissionDefaults(perm);
    }
    return player.hasPermission(key);
}
项目:AlmightyNotch    文件:MoodDecreaseCommand.java   
public MoodDecreaseCommand(AlmightyNotchPlugin plugin) {
    super(plugin, "decrease");
    setDescription("Decreases Almighty Notch's mood or mood level.");
    setCommandUsage("/an mood decrease [amount]");
    setPermission(new Permission("almightynotch.mood.decrease", PermissionDefault.OP));
    setArgumentRange(0, 1);
    setPlayerOnly(false);
    this.plugin = plugin;
}
项目:AlmightyNotch    文件:MoodIncreaseCommand.java   
public MoodIncreaseCommand(AlmightyNotchPlugin plugin) {
    super(plugin, "increase");
    setDescription("Increases Almighty Notch's mood or mood level.");
    setCommandUsage("/an mood increase [amount]");
    setPermission(new Permission("almightynotch.mood.increase", PermissionDefault.OP));
    setArgumentRange(0, 1);
    setPlayerOnly(false);
    this.plugin = plugin;
}
项目:AlmightyNotch    文件:MoodInfoCommand.java   
public MoodInfoCommand(AlmightyNotchPlugin plugin) {
    super(plugin, "info");
    setDescription("Gets Almighty Notch's mood and mood level.");
    setCommandUsage("/an mood info");
    setPermission(new Permission("almightynotch.mood.info", PermissionDefault.TRUE));
    setPlayerOnly(false);
    this.plugin = plugin;
}
项目:AlmightyNotch    文件:MoodSetCommand.java   
public MoodSetCommand(AlmightyNotchPlugin plugin) {
    super(plugin, "set");
    setDescription("Sets Almighty Notch's mood.");
    setCommandUsage("/an mood set <mood>");
    setPermission(new Permission("almightynotch.mood.set", PermissionDefault.OP));
    setArgumentRange(1, 1);
    setPlayerOnly(false);
    this.plugin = plugin;
}
项目:AlmightyNotch    文件:TriggerCommand.java   
public TriggerCommand(AlmightyNotchPlugin plugin) {
    super(plugin, "trigger");
    setDescription("Triggers an event.");
    setCommandUsage("/an trigger [event]");
    setPermission(new Permission("almightynotch.trigger", PermissionDefault.OP));
    setArgumentRange(0, 1);
    setPlayerOnly(false);
    this.plugin = plugin;
}
项目:Ipsum    文件:PermissionManager.java   
/**
 * Register permission.
 *
 * @param name              the name
 * @param description       the description
 * @param parent            the parent
 * @param permissionDefault the permission default
 * @return the {@link java.lang.Boolean} true if successfully added, false if there is an error
 */
public boolean registerPermission(String name, String description, String parent, PermissionDefault permissionDefault) {

    try {
        pm.addPermission(new Permissions(name, description, permissionDefault, parent));

        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
项目:Ipsum    文件:PermissionManager.java   
/**
 * Register permission.
 *
 * @param name              the name
 * @param description       the description
 * @param permissionDefault the permission default
 * @return the {@link java.lang.Boolean} true if successfully added, false if there is an error
 */
public boolean registerPermission(String[] name, String description, PermissionDefault permissionDefault) {
    try {
        pm.addPermission(new Permissions(name, description, permissionDefault));

        return true;
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    }
    return false;
}