當前位置: 首頁>>代碼示例>>Java>>正文


Java PermissionAttachmentInfo.getPermission方法代碼示例

本文整理匯總了Java中org.bukkit.permissions.PermissionAttachmentInfo.getPermission方法的典型用法代碼示例。如果您正苦於以下問題:Java PermissionAttachmentInfo.getPermission方法的具體用法?Java PermissionAttachmentInfo.getPermission怎麽用?Java PermissionAttachmentInfo.getPermission使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.permissions.PermissionAttachmentInfo的用法示例。


在下文中一共展示了PermissionAttachmentInfo.getPermission方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMaxPermission

import org.bukkit.permissions.PermissionAttachmentInfo; //導入方法依賴的package包/類
public static int getMaxPermission(Player p, String node) {
	int maxLimit = 0;
	for (PermissionAttachmentInfo perm : p.getEffectivePermissions()) {
		String permission = perm.getPermission();
		if (!permission.toLowerCase().startsWith(node.toLowerCase())) {
			continue;
		}
		String[] split = permission.split("\\.");
		try {
			int number = Integer.parseInt(split[split.length - 1]);
			if (number > maxLimit) {
				maxLimit = number;
			}
		} catch (NumberFormatException ignore) { }
	}
	return maxLimit;
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:18,代碼來源:NeverLagUtils.java

示例2: assignRanks

import org.bukkit.permissions.PermissionAttachmentInfo; //導入方法依賴的package包/類
public static void assignRanks(Player p, int tsDbId){
	
	//Permissions
	for(PermissionAttachmentInfo pai : p.getEffectivePermissions()) {
		String perms = pai.getPermission();
		if(UltimateTs.main().getConfig().get("perms."+perms) != null){
			int gTs = UltimateTs.main().getConfig().getInt("perms."+perms);
			BotManager.getBot().addClientToServerGroup(gTs, tsDbId);
		}
    }

	//Default Ranks
	int groupToAssign = UltimateTs.main().getConfig().getInt("config.assignWhenRegister");
	if(groupToAssign > 0){
		BotManager.getBot().addClientToServerGroup(groupToAssign, tsDbId);
	}
}
 
開發者ID:DiscowZombie,項目名稱:UltimateTs,代碼行數:18,代碼來源:PlayerManager.java

示例3: getVaultCapacity

import org.bukkit.permissions.PermissionAttachmentInfo; //導入方法依賴的package包/類
public int getVaultCapacity(Player p)
{
    
    int capacity = getVaultCapacity();
    if(isVaultCapacityPermissionControl())
    {
        
        for(PermissionAttachmentInfo pai : p.getEffectivePermissions())
        {
            String per = pai.getPermission();
            
            if(!per.toLowerCase().startsWith("wowsuchcleaner.vault.capacity.")) continue;
            
            String capacityString = per.split("\\.")[3];
            capacity = Integer.parseInt(capacityString);
            
            continue;
        }
        
    }
    
    return capacity;
}
 
開發者ID:Cnly,項目名稱:WowSuchCleaner,代碼行數:24,代碼來源:SharedConfigManager.java

示例4: getSuperpermsGroup

import org.bukkit.permissions.PermissionAttachmentInfo; //導入方法依賴的package包/類
/**
 * Superperms has no group support, but we fake it (this is slow and stupid
 * since it has to iterate through ALL permissions a player has). But if
 * you're attached to superperms and not using a nice plugin like bPerms
 * and Vault then this is as good as it gets.
 * 
 * @param player
 * @return the group name or null
 */
private String getSuperpermsGroup(Player player) {
    if( player == null )
        return null;
    
    String group = null;
    
    // this code shamelessly adapted from WorldEdit's WEPIF support for superperms
    Permissible perms = getPermissible(player);
    if (perms != null) {
        for (PermissionAttachmentInfo permAttach : perms.getEffectivePermissions()) {
            String perm = permAttach.getPermission();
            if (!(perm.startsWith(GROUP_PREFIX) && permAttach.getValue())) {
                continue;
            }
            
            // we just grab the first "group.X" permission we can find
            group = perm.substring(GROUP_PREFIX.length(), perm.length());
            break;
        }
    }
    
    return group;
}
 
開發者ID:andune,項目名稱:anduneCommonBukkitLib,代碼行數:33,代碼來源:Superperms.java

示例5: loadMultiplier

import org.bukkit.permissions.PermissionAttachmentInfo; //導入方法依賴的package包/類
public void loadMultiplier(Player p){
	int id=1,ip=1;
	for (PermissionAttachmentInfo perms : p.getEffectivePermissions()) {
		String perm = perms.getPermission();
		if (perm.toLowerCase().startsWith("pickupmoney.multiply.")) {
			String[] spl = perm.split("\\.");
			int num = Integer.parseInt(spl[3]);
			if(spl[2].equals("drop") && id<num) id = num;
			else if(spl[2].equals("pickup") && ip<num) ip = num;
		}
	}
	dropMulti.put(p.getUniqueId(),id);
	pickupMulti.put(p.getUniqueId(),ip);

}
 
開發者ID:KickVN,項目名稱:PickupMoney,代碼行數:16,代碼來源:PickupMoney.java


注:本文中的org.bukkit.permissions.PermissionAttachmentInfo.getPermission方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。