当前位置: 首页>>代码示例>>Java>>正文


Java PermissionDefault.FALSE属性代码示例

本文整理汇总了Java中org.bukkit.permissions.PermissionDefault.FALSE属性的典型用法代码示例。如果您正苦于以下问题:Java PermissionDefault.FALSE属性的具体用法?Java PermissionDefault.FALSE怎么用?Java PermissionDefault.FALSE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.permissions.PermissionDefault的用法示例。


在下文中一共展示了PermissionDefault.FALSE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerPermission

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;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:17,代码来源:DefaultPermissions.java

示例2: ChannelMatchModule

@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);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:ChannelMatchModule.java

示例3: updatePermission

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;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:PermissionGroupListener.java

示例4: getAttribute

@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);
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:11,代码来源:BukkitPlayer.java

示例5: createChannelPermission

protected Permission createChannelPermission(Party party) {
    Permission permission = new Permission("pgm.chat.team." + this.match.getId() + '-' + party.hashCode() + ".receive", PermissionDefault.FALSE);
    getMatch().getPluginManager().addPermission(permission);
    permission.addParent(matchListeningPermission, true);
    return permission;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:6,代码来源:ChannelMatchModule.java

示例6: setPermission

public void setPermission(String permission) {
    this.permission = permission;
    bukkitPermission = new Permission(permission, PermissionDefault.FALSE);
}
 
开发者ID:sgtcaze,项目名称:NametagEdit,代码行数:4,代码来源:GroupData.java

示例7: reSyncGroups

public static void reSyncGroups(Player player, boolean clearAssignedRoles) {
    if (player == null) return;

    DiscordSRV.debug("Synchronizing player " + player.getName());

    String discordId = DiscordSRV.getPlugin().getAccountLinkManager().getDiscordId(player.getUniqueId());
    if (discordId == null) {
        DiscordSRV.debug("Tried to sync groups for player " + player.getName() + " but their MC account is not linked to a Discord account");
        return;
    }

    // get member
    Member member = DiscordUtil.getMemberById(discordId);

    if (member == null) {
        DiscordSRV.debug("Tried to sync groups for player " + player.getName() + " but their MC account is not linked to a Discord account");
        return;
    }

    // get all the roles to synchronize from the config
    Map<Permission, Role> synchronizables = new HashMap<>();
    for (String roleId : DiscordSRV.config().getStringList("GroupRoleSynchronizationRoleIdsToSync")) {
        Role role = DiscordUtil.getRole(roleId);

        if (role == null && !roleId.equals("12345678901234567890") && !roleId.equals("DISCORDROLENAME")) {
            DiscordSRV.debug(LangUtil.InternalMessage.GROUP_SYNCHRONIZATION_COULD_NOT_FIND_ROLE.toString()
                    .replace("{rolename}", roleId)
            );
            continue;
        }

        Permission permission = new Permission("discordsrv.sync." + roleId, PermissionDefault.FALSE);

        synchronizables.put(permission, role);
    }
    if (synchronizables.size() == 0) {
        DiscordSRV.debug("Tried to sync groups but no synchronizables existed");
        return;
    }

    List<Role> rolesToAdd = new ArrayList<>();
    List<Role> rolesToRemove = new ArrayList<>();

    for (Map.Entry<Permission, Role> pair : synchronizables.entrySet()) {
        if (!clearAssignedRoles && player.hasPermission(pair.getKey())) {
            rolesToAdd.add(pair.getValue());
        } else {
            rolesToRemove.add(pair.getValue());
        }
    }

    // remove roles that the user already has from roles to add
    rolesToAdd.removeAll(member.getRoles());
    // remove roles that the user doesn't already have from roles to remove
    rolesToRemove.removeIf(role -> !member.getRoles().contains(role));

    List<String> changes = new ArrayList<>();

    if (rolesToAdd.size() > 0) {
        DiscordUtil.addRolesToMember(member, rolesToAdd);
        changes.add("+ " + String.join("", rolesToAdd.stream().map(Role::toString).collect(Collectors.toList())));
    }
    if (rolesToRemove.size() > 0) {
        DiscordUtil.removeRolesFromMember(member, rolesToRemove);
        changes.add("- " + String.join("", rolesToRemove.stream().map(Role::toString).collect(Collectors.toList())));
    }

    DiscordSRV.debug("Synced player " + player.getName() + " (" + (changes.size() > 0 ? String.join(" | ", changes) : "no changes") + ")");
}
 
开发者ID:Scarsz,项目名称:DiscordSRV,代码行数:69,代码来源:GroupSynchronizationUtil.java

示例8: refreshPermissions

public void refreshPermissions(Player player) {
    if(!this.listen.getAttachments().containsKey(player.getName())) {
        this.listen.attachTo(player);
    }

    Map<String, Boolean> permissions = this.getPermsManager().getWorld(player.getWorld().getName()).getPlayer(player.getName()).getAllPermissions();
    Permission positive = Bukkit.getServer().getPluginManager().getPermission("INTERNAL_PERMISSION." + player.getName());
    Permission negative = Bukkit.getServer().getPluginManager().getPermission("INTERNAL_PERMISSION.-" + player.getName());
    if(positive != null) {
        Bukkit.getServer().getPluginManager().removePermission(positive);
    }

    if(negative != null) {
        Bukkit.getServer().getPluginManager().removePermission(negative);
    }

    Map<String, Boolean> po = new HashMap<String, Boolean>();
    Map<String, Boolean> ne = new HashMap<String, Boolean>();
    for(String key : permissions.keySet()) {
        if(!key.startsWith("INTERNAL_PERMISSION")) {
            if(permissions.get(key)) {
                po.put(key, true);
            } else {
                ne.put(key, false);
            }
        }
    }

    positive = new Permission("INTERNAL_PERMISSION." + player.getName(), PermissionDefault.FALSE, po);
    negative = new Permission("INTERNAL_PERMISSION.-" + player.getName(), PermissionDefault.FALSE, ne);
    Bukkit.getServer().getPluginManager().addPermission(positive);
    Bukkit.getServer().getPluginManager().addPermission(negative);
    player.recalculatePermissions();
    if(this.getManager().isEnabled("Chat")) {
        PeacecraftChat chat = (PeacecraftChat) this.getManager().getModule("Chat");
        if(player.hasPermission(ChatPermissions.MOD)) {
            chat.setMod(player.getName(), true);
        } else {
            chat.setMod(player.getName(), false);
        }
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:42,代码来源:PeacecraftPerms.java

示例9: getPermissionDefault

@Override
public PermissionDefault getPermissionDefault() {
    return PermissionDefault.FALSE;
}
 
开发者ID:DemigodsRPG,项目名称:Stoa,代码行数:4,代码来源:TemplateDeity.java

示例10: hasPermission

/**
 * Checks if player has permission node, not including OP permissions
 *
 * @param player     player
 * @param permission Permission in question
 * @return true if they have the permission
 */
public static boolean hasPermission(Player player, String permission) {
    Permission perm = new Permission(permission, PermissionDefault.FALSE);

    return player.hasPermission(perm);
}
 
开发者ID:Ratismal,项目名称:MoneyThief,代码行数:12,代码来源:PermissionChecker.java

示例11: getGroupNode

/**
 * Gets the permission node that a player needs to have to be considered
 * part of a group.
 * 
 * @param groupName
 *            The name of the group.
 * @return The permission node.
 */
public static Permission getGroupNode(String groupName) {
    return new Permission(GROUP_PREFIX + groupName.toLowerCase(), PermissionDefault.FALSE);
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:11,代码来源:Permissions.java


注:本文中的org.bukkit.permissions.PermissionDefault.FALSE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。