本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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());
}