本文整理了Java中org.bukkit.permissions.Permission.addParent()
方法的一些代码示例,展示了Permission.addParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Permission.addParent()
方法的具体详情如下:
包路径:org.bukkit.permissions.Permission
类名称:Permission
方法名:addParent
[英]Adds this permission to the specified parent permission.
If the parent permission does not exist, it will be created and registered.
[中]将此权限添加到指定的父权限。
如果父权限不存在,将创建并注册它。
代码示例来源:origin: Bukkit/Bukkit
/**
* Adds this permission to the specified parent permission.
* <p>
* If the parent permission does not exist, it will be created and
* registered.
*
* @param name Name of the parent permission
* @param value The value to set this permission to
* @return Parent permission it created or loaded
*/
public Permission addParent(String name, boolean value) {
PluginManager pm = Bukkit.getServer().getPluginManager();
String lname = name.toLowerCase();
Permission perm = pm.getPermission(lname);
if (perm == null) {
perm = new Permission(lname);
pm.addPermission(perm);
}
addParent(perm, value);
return perm;
}
代码示例来源:origin: SpigotMC/Spigot-API
/**
* Adds this permission to the specified parent permission.
* <p>
* If the parent permission does not exist, it will be created and
* registered.
*
* @param name Name of the parent permission
* @param value The value to set this permission to
* @return Parent permission it created or loaded
*/
public Permission addParent(String name, boolean value) {
PluginManager pm = Bukkit.getServer().getPluginManager();
String lname = name.toLowerCase();
Permission perm = pm.getPermission(lname);
if (perm == null) {
perm = new Permission(lname);
pm.addPermission(perm);
}
addParent(perm, value);
return perm;
}
代码示例来源:origin: NoCheatPlus/NoCheatPlus
childPermission.addParent(permission, childValue);
代码示例来源:origin: NoCheatPlus/NoCheatPlus
if (!cmdHadPerm) {
cmdPerm.addParent(rootPerm, true);
代码示例来源:origin: NoCheatPlus/NoCheatPlus
childPermission.addParent(permission, true);
代码示例来源:origin: Multiverse/Multiverse-Core
/**
* Initializes permissions.
*/
private void initPerms() {
this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.OP);
// This guy is special. He shouldn't be added to any parent perms.
this.ignoreperm = new Permission("mv.bypass.gamemode." + this.getName(),
"Allows players with this permission to ignore gamemode changes.", PermissionDefault.FALSE);
this.exempt = new Permission("multiverse.exempt." + this.getName(),
"A player who has this does not pay to enter this world, or use any MV portals in it " + this.getName(), PermissionDefault.OP);
this.limitbypassperm = new Permission("mv.bypass.playerlimit." + this.getName(),
"A player who can enter this world regardless of wether its full", PermissionDefault.OP);
try {
this.plugin.getServer().getPluginManager().addPermission(this.permission);
this.plugin.getServer().getPluginManager().addPermission(this.exempt);
this.plugin.getServer().getPluginManager().addPermission(this.ignoreperm);
this.plugin.getServer().getPluginManager().addPermission(this.limitbypassperm);
// Add the permission and exempt to parents.
this.addToUpperLists(this.permission);
// Add ignore to it's parent:
this.ignoreperm.addParent("mv.bypass.gamemode.*", true);
// Add limit bypass to it's parent
this.limitbypassperm.addParent("mv.bypass.playerlimit.*", true);
} catch (IllegalArgumentException e) {
this.plugin.log(Level.FINER, "Permissions nodes were already added for " + this.name);
}
}
内容来源于网络,如有侵权,请联系作者删除!