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


Java PermissionAttachmentInfo.getAttachment方法代码示例

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


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

示例1: givePermissionOperation

import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
@Operation(aliases = {"giveperm"})
public static Parameter givePermissionOperation(org.bukkit.entity.Player pent, Context ctx, StringParameter v) {
	if ( v == null ) fizzle("What permission where you lookin for ?");
	PermissionAttachment target = null;
	for ( PermissionAttachmentInfo pi : pent.getEffectivePermissions() ) {
		if ( pi.getPermissible() == pent && pi.getAttachment() != null && pi.getAttachment().getPlugin() == ParchmentPluginLite.instance() ) {
			target = pi.getAttachment();
			break;
		}
	}
	if ( target == null ) target = new PermissionAttachment(ParchmentPluginLite.instance(), pent);
	target.setPermission(v.asString(ctx), true);
	return Parameter.from(pent.hasPermission(v.asString(ctx)));
}
 
开发者ID:basicer,项目名称:parchment,代码行数:15,代码来源:Player.java

示例2: removePermissionOperation

import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
@Operation(aliases = {"takeperm", "delperm"})
public static Parameter removePermissionOperation(org.bukkit.entity.Player pent, Context ctx, StringParameter v) {
	if ( v == null ) fizzle("What permission where you lookin for ?");
	PermissionAttachment target = null;
	for ( PermissionAttachmentInfo pi : pent.getEffectivePermissions() ) {
		if ( pi.getPermissible() == pent.getPlayer() && pi.getAttachment().getPlugin() == ParchmentPluginLite.instance() ) {
			target = pi.getAttachment();
			break;
		}
	}
	if ( target == null ) target = new PermissionAttachment(ParchmentPluginLite.instance(), pent);
	target.setPermission(v.asString(ctx), false);
	return Parameter.from(pent.hasPermission(v.asString(ctx)));
}
 
开发者ID:basicer,项目名称:parchment,代码行数:15,代码来源:Player.java

示例3: playerAddTransient

import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
/**
   * Add transient permission to a player.
   * This operation adds a permission onto the player object in bukkit via Bukkit's permission interface.
   * 
   * @param player Player Object
   * @param permission Permission node
   * @return Success or Failure
   */
  public boolean playerAddTransient(Player player, String permission) {
for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) {
	if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
		paInfo.getAttachment().setPermission(permission, true);
		return true;
	}
}

PermissionAttachment attach = player.addAttachment(plugin);
attach.setPermission(permission, true);

return true;
  }
 
开发者ID:MilkBowl,项目名称:VaultAPI,代码行数:22,代码来源:Permission.java

示例4: playerRemoveTransient

import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
/**
   * Remove transient permission from a player.
   * 
   * @param player Player Object
   * @param permission Permission node
   * @return Success or Failure
   */
  public boolean playerRemoveTransient(Player player, String permission) {
for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) {
	if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
		paInfo.getAttachment().unsetPermission(permission);
		return true;
	}
}
return false;
  }
 
开发者ID:MilkBowl,项目名称:VaultAPI,代码行数:17,代码来源:Permission.java

示例5: playerAddTransient

import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
/**
   * Add transient permission to a player.
   * This operation adds a world-unspecific permission onto the player object in bukkit via Bukkit's permission interface.
   * 
   * @param player Player Object
   * @param permission Permission node
   * @return Success or Failure
   */
  public boolean playerAddTransient(Player player, String permission) {
for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) {
	if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
		paInfo.getAttachment().setPermission(permission, true);
		return true;
	}
}

PermissionAttachment attach = player.addAttachment(plugin);
attach.setPermission(permission, true);

return true;
  }
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:22,代码来源:Permission.java

示例6: clearPermissions

import org.bukkit.permissions.PermissionAttachmentInfo; //导入方法依赖的package包/类
public void clearPermissions() {
	for(PermissionAttachmentInfo a: this.pl.getServer().getPlayerExact(this.p).getEffectivePermissions()) {
		if(a.getAttachment() == null)
			return;
		this.pl.getServer().getPlayerExact(this.p).removeAttachment(a.getAttachment());
	}
}
 
开发者ID:lightniinja,项目名称:KPerms,代码行数:8,代码来源:KPlayer.java


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