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


Java PermissionType.getPermission方法代碼示例

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


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

示例1: isPlayerInUnpermittedBastion

import vg.civcraft.mc.namelayer.permission.PermissionType; //導入方法依賴的package包/類
@Override
public boolean isPlayerInUnpermittedBastion(Player player) {
	if (!isBastionEnabled()) {
		return false;
	}

	try {
		final BastionBlockManager manager = Bastion.getBastionManager();

		Set<BastionBlock> bastions = manager.getBlockingBastions(player.getLocation());
		PermissionType perm = PermissionType.getPermission(NameLayerPermissions.BASTION_ALLOW_EXILED);

		for (BastionBlock bastion : bastions) {
			if (!bastion.permAccess(player, perm)) {
				return true;
			}
		}
	} catch(Exception ex) {
		ex.printStackTrace();
	}

	return false;
}
 
開發者ID:DevotedMC,項目名稱:ExilePearl,代碼行數:24,代碼來源:ExilePearlCore.java

示例2: getPlayerInUnpermittedBastion

import vg.civcraft.mc.namelayer.permission.PermissionType; //導入方法依賴的package包/類
@Override
public List<BastionWrapper> getPlayerInUnpermittedBastion(Player player) {
	if (!isBastionEnabled()) {
		return new ArrayList<>();
	}

	try {
		final BastionBlockManager manager = Bastion.getBastionManager();

		Set<BastionBlock> bastions = manager.getBlockingBastions(player.getLocation());
		List<BastionWrapper> wrapper = new LinkedList<>();
		PermissionType perm = PermissionType.getPermission(NameLayerPermissions.BASTION_ALLOW_EXILED);

		for (BastionBlock bastion : bastions) {
			if (!bastion.permAccess(player, perm)) {
				wrapper.add(new BastionWrapper(bastion));
			}
		}
		return wrapper;
	} catch(Exception ex) {
		ex.printStackTrace();
	}

	return new ArrayList<>();
}
 
開發者ID:DevotedMC,項目名稱:ExilePearl,代碼行數:26,代碼來源:ExilePearlCore.java

示例3: hasBastionAccess

import vg.civcraft.mc.namelayer.permission.PermissionType; //導入方法依賴的package包/類
private boolean hasBastionAccess(List<Player> players, Block block, ICitadel citadel) {
	PermissionType perm = PermissionType.getPermission(PERMISSION_UNDRAW);
	Location loc = block.getLocation();
	Set<BastionBlock> bastions = this.blockManager.getBlockingBastions(loc);

	if (bastions == null) return true;

	ReinforcementManager reinManager = Citadel.getReinforcementManager();
	Group citadelGroup = citadel.getGroupName() != null ? GroupManager.getGroup(citadel.getGroupName()) : null;

	for(BastionBlock bastion : bastions) {
		if(bastion.getType().isOnlyDirectDestruction() || !bastion.inField(loc)) continue;

		Reinforcement rein = reinManager.getReinforcement(bastion.getLocation());
		PlayerReinforcement playerRein = rein != null && (rein instanceof PlayerReinforcement) ? (PlayerReinforcement)rein : null;

		if(playerRein == null) continue;

		if(players == null) return false;

		if(citadel.useJukeAlert() && !citadel.getGroupName().equalsIgnoreCase(playerRein.getGroup().getName())) {
			return false;
		} else if(citadelGroup == null || !this.groupManager.isAllowedGroup(playerRein.getGroup(), citadelGroup)) {
			boolean hasAccess = false;

			for (Player player : players) {
				if (bastion.permAccess(player, perm)) {
					hasAccess = true;
					break;
				}
			}

			if (!hasAccess) return false;
		}
	}

	return true;
}
 
開發者ID:Aleksey-Terzi,項目名稱:CastleGates,代碼行數:39,代碼來源:BastionManager.java


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