當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。