当前位置: 首页>>代码示例>>Java>>正文


Java PluginManager.addPermission方法代码示例

本文整理汇总了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"));
		}
	}
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:22,代码来源:PermissionInterface.java

示例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;
	}
}
 
开发者ID:OverloadedCore,项目名称:behave,代码行数:23,代码来源:MainPart.java

示例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;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:26,代码来源:Permission.java

示例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));
			}
		}
	}
}
 
开发者ID:PyvesB,项目名称:AdvancedAchievements,代码行数:30,代码来源:AdvancedAchievements.java

示例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;
}
 
开发者ID:AlmuraDev,项目名称:Almura-API,代码行数:25,代码来源:Permission.java

示例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);
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:9,代码来源:NodeCommand.java

示例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);
}
 
开发者ID:OverloadedCore,项目名称:chaoticWeapons,代码行数:10,代码来源:Core.java

示例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());
		}
	}
}
 
开发者ID:NJDaeger,项目名称:EssentialCommands,代码行数:9,代码来源:Util.java

示例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);
}
 
开发者ID:OmniWorldMC,项目名称:OmniWorldMCPlugin,代码行数:13,代码来源:PermLib.java

示例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);
    }
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:10,代码来源:CommandParameter.java

示例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);
    }
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:10,代码来源:Command.java

示例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);
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:6,代码来源:Permissions.java

示例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);
}
 
开发者ID:DemigodsRPG,项目名称:Stoa,代码行数:5,代码来源:StoaServer.java


注:本文中的org.bukkit.plugin.PluginManager.addPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。