本文整理汇总了Java中org.bukkit.plugin.PluginManager.getPermission方法的典型用法代码示例。如果您正苦于以下问题:Java PluginManager.getPermission方法的具体用法?Java PluginManager.getPermission怎么用?Java PluginManager.getPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.plugin.PluginManager
的用法示例。
在下文中一共展示了PluginManager.getPermission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addParent
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* 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;
}
示例2: registerPermissions
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* Registers permissions that depend on the user's configuration file (for MultipleAchievements; for instance for
* stone breaks, achievement.count.breaks.stone will be registered).
*/
private void registerPermissions() {
getLogger().info("Registering permissions...");
PluginManager pluginManager = getServer().getPluginManager();
for (MultipleAchievements category : MultipleAchievements.values()) {
for (String section : config.getConfigurationSection(category.toString()).getKeys(false)) {
int startOfMetadata = section.indexOf(':');
if (startOfMetadata > -1) {
// Permission ignores metadata (eg. sand:1) for Breaks, Places and Crafts categories.
section = section.substring(0, startOfMetadata);
}
if (category == MultipleAchievements.PLAYERCOMMANDS) {
// Permissions don't take spaces into account for this category.
section = StringUtils.replace(section, " ", "");
}
// Bukkit only allows permissions to be set once, check to ensure they were not previously set when
// performing /aach reload.
if (pluginManager.getPermission(category.toPermName() + "." + section) == null) {
pluginManager.addPermission(
new Permission(category.toPermName() + "." + section, PermissionDefault.TRUE));
}
}
}
}
示例3: addParent
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* 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;
}
示例4: generatePermissions
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public static void generatePermissions() {
PluginManager pm = Bukkit.getServer().getPluginManager();
for (Permission perm : Permission.values()) {
if (pm.getPermission(perm.getPermission()) == null) {
pm.addPermission(perm.registerPermission());
}
}
}
示例5: sendPermissionInfo
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
void sendPermissionInfo(String name, CommandSender sender) {
PluginManager pm = sender.getServer().getPluginManager();
Permission permission = pm.getPermission(name);
if(permission == null) {
sender.sendMessage(ChatColor.RED + "Permission " + name + " is unregistered");
} else {
sender.sendMessage(ChatColor.GOLD + "Permission " + ChatColor.WHITE + permission.getName());
sender.sendMessage(ChatColor.WHITE.toString() + ChatColor.ITALIC + permission.getDescription());
sender.sendMessage(ChatColor.GOLD + "Default: " + ChatColor.WHITE + permission.getDefault());
boolean first = true;
for(Permission parent : pm.getPermissions()) {
Boolean value = parent.getChildren().get(permission.getName());
if(value != null) {
if(first) {
first = false;
sender.sendMessage(ChatColor.GOLD + "Parents:");
}
if(value) {
sender.sendMessage(ChatColor.GREEN + " +" + parent.getName());
} else {
sender.sendMessage(ChatColor.RED + " -" + parent.getName());
}
}
}
first = true;
for(Map.Entry<String, Boolean> child : permission.getChildren().entrySet()) {
if(first) {
first = false;
sender.sendMessage(ChatColor.GOLD + "Children:");
}
if(child.getValue()) {
sender.sendMessage(ChatColor.GREEN + " +" + child.getKey());
} else {
sender.sendMessage(ChatColor.RED + " -" + child.getKey());
}
}
}
}