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


Java PermissionUser.has方法代码示例

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


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

示例1: playerHas

import ru.tehkode.permissions.PermissionUser; //导入方法依赖的package包/类
@Override
public boolean playerHas(String worldName, String playerName, String permission) {
    PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
    if (user != null) {
        return user.has(permission, worldName);
    } else {
        return false;
    }
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:10,代码来源:Permission_PermissionsEx.java

示例2: hasOfflinePermissions

import ru.tehkode.permissions.PermissionUser; //导入方法依赖的package包/类
@Override
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
    HashSet<String> hasperms = new HashSet<String>();
    PermissionUser pu = pm.getUser(player);
    if(pu != null) {
        for (String pp : perms) {
            if (pu.has(PREFIX + pp)) {
                hasperms.add(pp);
            }
        }
    }
    return hasperms;
}
 
开发者ID:webbukkit,项目名称:DynmapCBBridge,代码行数:14,代码来源:PEXPermissions.java

示例3: hasOfflinePermission

import ru.tehkode.permissions.PermissionUser; //导入方法依赖的package包/类
@Override
public boolean hasOfflinePermission(String player, String perm) {
    PermissionUser pu = pm.getUser(player);
    boolean rslt = false;
    if(pu != null) {
        rslt = pu.has(PREFIX + perm);
    }
    return rslt;
}
 
开发者ID:webbukkit,项目名称:DynmapCBBridge,代码行数:10,代码来源:PEXPermissions.java

示例4: hasPermission

import ru.tehkode.permissions.PermissionUser; //导入方法依赖的package包/类
/**
 * Check if a player has permission
 * @param player player
 * @param permissionNode permission node
 * @param def default if no permissions system is used
 * @return true if the player is permitted
 */
public boolean hasPermission(Player p, String permsNode, boolean def) {
	if(!isEnabled()) {
		// No permissions system is used, return default
		return def;
	}
	
	switch (this.permsType) {
	case PERMISSIONS_EX:
		// Permissions Ex
		PermissionUser user  = PermissionsEx.getUser(p);
		return user.has(permsNode);
		
	case PERMISSIONS_BUKKIT:
		// Permissions Bukkit
		return p.hasPermission(permsNode);
		
	case B_PERMISSIONS:
		// bPermissions
		return ApiLayer.hasPermission(p.getWorld().getName(), CalculableType.USER, p.getName(), permsNode);
		
	case ESSENTIALS_GROUP_MANAGER:
		// Essentials Group Manager
		final AnjoPermissionsHandler handler = groupManagerPerms.getWorldsHolder().getWorldPermissions(p);
		if (handler == null)
			return false;
		return handler.has(p, permsNode);
	case Z_PERMISSIONS:
		// zPermissions
		Map<String, Boolean> perms = zPermissionsService.getPlayerPermissions(p.getWorld().getName(), null, p.getName());
		if(perms.containsKey(permsNode)){
			return perms.get(permsNode);
		} else {
			return def;
		}
	case VAULT:
		// Vault
		return vaultPerms.has(p, permsNode);
		
	case PERMISSIONS:
		// Permissions by nijiko
		return this.defaultPerms.has(p, permsNode);
		
	case NONE:
		// Not hooked into any permissions system, return default
		return def;
		
	default:
		// Something went wrong, return false to prevent problems
		return false;
	}
}
 
开发者ID:timvisee,项目名称:simple-survival-games,代码行数:59,代码来源:PermissionsManager.java

示例5: hasPermission

import ru.tehkode.permissions.PermissionUser; //导入方法依赖的package包/类
/**
 * Check if a player has permission.
 *
 * @param player    The player.
 * @param permsNode The permission node.
 * @param def       Default returned if no permissions system is used.
 * @return True if the player has permission.
 */
public boolean hasPermission(Player player, String permsNode, boolean def) {
    // Make sure the manager is enabled and is hooked into a permissions system
    if(!isEnabled() || !isHooked())
        return def;

    // Use the proper API
    switch (this.permsType) {
        case PERMISSIONS_EX:
            // Permissions Ex
            PermissionUser user = PermissionsEx.getUser(player);
            return user.has(permsNode);

        case PERMISSIONS_BUKKIT:
            // Permissions Bukkit
            return player.hasPermission(permsNode);

        case B_PERMISSIONS:
            // bPermissions
            return ApiLayer.hasPermission(player.getWorld().getName(), CalculableType.USER, player.getName(), permsNode);

        case ESSENTIALS_GROUP_MANAGER:
            // Essentials Group Manager
            final AnjoPermissionsHandler handler = groupManagerPerms.getWorldsHolder().getWorldPermissions(player);
            return handler != null && handler.has(player, permsNode);

        case Z_PERMISSIONS:
            // zPermissions
            @SuppressWarnings("deprecation")
            Map<String, Boolean> perms = zPermissionsService.getPlayerPermissions(player.getWorld().getName(), null, player.getName());
            return perms.containsKey(permsNode) ? perms.get(permsNode) : def;

        case VAULT:
            // Vault
            return vaultPerms.has(player, permsNode);

        case PERMISSIONS:
            // Permissions
            return this.defaultPerms.has(player, permsNode);
    }

    // Failed, return the default
    return def;
}
 
开发者ID:timvisee,项目名称:GlowstoneLanterns,代码行数:52,代码来源:PermissionsManager.java

示例6: hasPermissionOffline

import ru.tehkode.permissions.PermissionUser; //导入方法依赖的package包/类
@Override
public boolean hasPermissionOffline(String name, PermissionNode node) {
    PermissionUser user = permissionManager.getUser(name);
    return user.has(node.getNode());
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:6,代码来源:PermissionsExHandler.java


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