當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。