本文整理汇总了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());
}
}