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