本文整理汇总了Java中org.bukkit.plugin.PluginManager.addPermission方法的典型用法代码示例。如果您正苦于以下问题:Java PluginManager.addPermission方法的具体用法?Java PluginManager.addPermission怎么用?Java PluginManager.addPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.plugin.PluginManager
的用法示例。
在下文中一共展示了PluginManager.addPermission方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupPermissions
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public static void setupPermissions(NavyCraft p) {
plugin = p;
PluginManager pm = NavyCraft.instance.getServer().getPluginManager();
if(pm != null) {
pm.addPermission(new Permission("navycraft.periscope.use"));
pm.addPermission(new Permission("navycraft.aa-gun.use"));
pm.addPermission(new Permission("navycraft.periscope.create"));
pm.addPermission(new Permission("navycraft.aa-gun.create"));
for (CraftType type : CraftType.craftTypes)
{
pm.addPermission(new Permission("navycraft." + type.name + ".release"));
pm.addPermission(new Permission("navycraft." + type.name + ".info"));
pm.addPermission(new Permission("navycraft." + type.name + ".takeover"));
pm.addPermission(new Permission("navycraft." + type.name + ".start"));
pm.addPermission(new Permission("navycraft." + type.name + ".create"));
pm.addPermission(new Permission("navycraft." + type.name + ".sink"));
pm.addPermission(new Permission("navycraft." + type.name + ".remove"));
}
}
}
示例2: execBeh
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
private boolean execBeh(String beh){
String[] arr = beh.split(" ");
String cmd = arr[0];
String[] args = Arrays.copyOfRange(arr, 1, arr.length);
String argsas = "";
for(String a : args){
argsas = argsas + a + " ";
}
switch(cmd){
case "print":
getLogger().info(argsas);
return true;
case "addperm":
PluginManager pm = Bukkit.getServer().getPluginManager();
pm.addPermission(new Permission(argsas));
return true;
case "//":
return true;
default:
return false;
}
}
示例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: 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));
}
}
}
}
示例5: 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;
}
示例6: registerPermissions
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void registerPermissions(PluginManager manager) {
super.registerPermissions(manager);
if (anyPerm != null)
manager.addPermission(anyPerm);
for (Command command : commands)
command.registerPermissions(manager);
}
示例7: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onEnable() {
getLogger().info("/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*");
getLogger().info("The epic swords and stuff are now available");
getLogger().info("/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*");
PluginManager pm = getServer().getPluginManager();
pm.addPermission(creator);
Bukkit.getServer().getPluginManager().registerEvents(this, this);
}
示例8: 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());
}
}
}
示例9: init
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public static void init(PluginManager pm) {
pm.addPermission(USE_ENDERBOW);
pm.addPermission(SHOW_DEATH_LOCATION);
pm.addPermission(CMD_OM);
pm.addPermission(DP_HD);
pm.addPermission(DP_CRAFT_DIAMOND_HAMMER);
pm.addPermission(DP_CRAFT_DIAMOND_EXCAVATOR);
pm.addPermission(DP_USE_DIAMOND_HAMMER);
pm.addPermission(DP_USE_DIAMOND_EXCAVATOR);
pm.addPermission(DP_ENCHANT_DIAMOND_HAMMER);
pm.addPermission(DP_ENCHANT_DIAMOND_EXCAVATOR);
}
示例10: registerPermission
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* Registers only this permission.
* May be overridden to register other permissions.
*/
public void registerPermission(PluginManager pluginManager) {
if (permission != null) {
pluginManager.addPermission(permission);
}
}
示例11: registerPermissions
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* Registers the permissions of this command.
* By default registers the only one it has, but may be overridden.
*/
public void registerPermissions(PluginManager pluginManager) {
if (permission != null) {
pluginManager.addPermission(permission);
}
}
示例12: addDynamicPermission
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
private static void addDynamicPermission(String permissionName, PermissionDefault permissionDefault, PluginManager pluginManager) {
Permission permission = new Permission(permissionName);
permission.setDefault(permissionDefault);
pluginManager.addPermission(permission);
}
示例13: registerPermission
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
void registerPermission(PluginManager register, Permission permission, boolean load) {
if (load) register.addPermission(permission);
else register.removePermission(permission);
}