當前位置: 首頁>>代碼示例>>Java>>正文


Java PluginCommand.setPermission方法代碼示例

本文整理匯總了Java中org.bukkit.command.PluginCommand.setPermission方法的典型用法代碼示例。如果您正苦於以下問題:Java PluginCommand.setPermission方法的具體用法?Java PluginCommand.setPermission怎麽用?Java PluginCommand.setPermission使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.command.PluginCommand的用法示例。


在下文中一共展示了PluginCommand.setPermission方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupBukkitCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private PluginCommand setupBukkitCommand() {
	try {
		final Constructor<PluginCommand> c = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
		c.setAccessible(true);
		final PluginCommand bukkitCommand = c.newInstance(name, Skript.getInstance());
		bukkitCommand.setAliases(aliases);
		bukkitCommand.setDescription(description);
		bukkitCommand.setLabel(label);
		bukkitCommand.setPermission(permission);
		bukkitCommand.setPermissionMessage(permissionMessage);
		bukkitCommand.setUsage(usage);
		bukkitCommand.setExecutor(this);
		return bukkitCommand;
	} catch (final Exception e) {
		Skript.outdatedError(e);
		throw new EmptyStacktraceException();
	}
}
 
開發者ID:nfell2009,項目名稱:Skript,代碼行數:19,代碼來源:ScriptCommand.java

示例2: createNewBukkitCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
/**
 * Creates a new Bukkit command.
 *
 * @param nukkitCommand
 *            The Nukkit command.
 * @return The plugin command.
 * @throws ClassCastException
 *             If the nukkitCommand is not provided by a Bukkit plugin.
 */
private PluginCommand createNewBukkitCommand(cn.nukkit.command.PluginCommand<?> nukkitCommand) {
	Plugin bukkitPlugin = PokkitPlugin.toBukkit(nukkitCommand.getPlugin());
	try {
		Constructor<PluginCommand> constructor = PluginCommand.class.getDeclaredConstructor(String.class,
				Plugin.class);
		constructor.setAccessible(true);
		PluginCommand bukkitCommand = constructor.newInstance(nukkitCommand.getName(), bukkitPlugin);

		bukkitCommand.setAliases(Arrays.asList(nukkitCommand.getAliases()));
		bukkitCommand.setDescription(nukkitCommand.getDescription());
		bukkitCommand.setLabel(nukkitCommand.getLabel());
		bukkitCommand.setPermission(nukkitCommand.getPermission());
		bukkitCommand.setPermissionMessage(nukkitCommand.getPermissionMessage());
		bukkitCommand.setUsage(nukkitCommand.getUsage());

		return bukkitCommand;
	} catch (ReflectiveOperationException e) {
		throw new RuntimeException(e);
	}
}
 
開發者ID:rutgerkok,項目名稱:Pokkit,代碼行數:30,代碼來源:PokkitCommandFetcher.java

示例3: addExecutor

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
@SneakyThrows
public static void addExecutor(Plugin plugin, Command command) {
    Field f = SimplePluginManager.class.getDeclaredField("commandMap");
    f.setAccessible(true);
    CommandMap map = (CommandMap) f.get(plugin.getServer().getPluginManager());
    Constructor<PluginCommand> init = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
    init.setAccessible(true);
    PluginCommand inject = init.newInstance(command.getName(), plugin);
    inject.setExecutor((who, __, label, input) -> command.execute(who, label, input));
    inject.setAliases(command.getAliases());
    inject.setDescription(command.getDescription());
    inject.setLabel(command.getLabel());
    inject.setName(command.getName());
    inject.setPermission(command.getPermission());
    inject.setPermissionMessage(command.getPermissionMessage());
    inject.setUsage(command.getUsage());
    map.register(plugin.getName().toLowerCase(), inject);
}
 
開發者ID:caoli5288,項目名稱:EnderChest,代碼行數:19,代碼來源:PluginHelper.java

示例4: register

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
public static void register(String prefix, Plugin plugin, InjectableCommand... commands) {
  for (InjectableCommand command : commands) {
    if (command.getName() == null || command.getExecutor() == null) {
      Bukkit.getServer().getLogger().severe("Could not register command " + command.getName() + " for plugin " + plugin.getName() + ": CommandName or CommandExecutor cannot be null");
      continue;
    }
    if (command.getName().contains(":")) {
      Bukkit.getServer().getLogger().severe("Could not register command " + command.getName() + " for plugin " + plugin.getName() + ": CommandName cannot contain \":\"");
      continue;
    }
    PluginCommand _command = getPluginCommand(command.getName(), plugin);
    _command.setExecutor(command.getExecutor());
    if (command.getDescription() != null) {
      _command.setDescription(command.getDescription());
    }
    if (!(command.getAliases() == null || command.getAliases().isEmpty())) {
      _command.setAliases(command.getAliases());
    }
    if (command.getPermission() != null) {
      _command.setPermission(command.getPermission());
    }
    if (command.getPermissionMessage() != null) {
      _command.setPermissionMessage(command.getPermissionMessage());
    }
    if (command.getTabCompleter() != null) {
      _command.setTabCompleter(command.getTabCompleter());
    }
    getCommandMap().register(prefix, _command);
  }
}
 
開發者ID:Rires-Magica,項目名稱:Bukkit-Utilities,代碼行數:31,代碼來源:CommandManager.java

示例5: registerPartyChatCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerPartyChatCommand() {
    PluginCommand command = mcMMO.p.getCommand("partychat");
    command.setDescription(LocaleLoader.getString("Commands.Description.partychat"));
    command.setPermission("mcmmo.chat.partychat;mcmmo.commands.party");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.0", "partychat"));
    command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<on|off>"));
    command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
    command.setExecutor(new PartyChatCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:11,代碼來源:CommandRegistrationManager.java

示例6: registerAddlevelsCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerAddlevelsCommand() {
    PluginCommand command = mcMMO.p.getCommand("addlevels");
    command.setDescription(LocaleLoader.getString("Commands.Description.addlevels"));
    command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addlevels", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
    command.setExecutor(new AddlevelsCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java

示例7: registerMcnotifyCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerMcnotifyCommand() {
    PluginCommand command = mcMMO.p.getCommand("mcnotify");
    command.setDescription(LocaleLoader.getString("Commands.Description.mcnotify"));
    command.setPermission("mcmmo.commands.mcnotify");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcnotify"));
    command.setExecutor(new McnotifyCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java

示例8: registerHardcoreCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerHardcoreCommand() {
    PluginCommand command = mcMMO.p.getCommand("hardcore");
    command.setDescription(LocaleLoader.getString("Commands.Description.hardcore"));
    command.setPermission("mcmmo.commands.hardcore;mcmmo.commands.hardcore.toggle;mcmmo.commands.hardcore.modify");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.1", "hardcore", "[on|off]"));
    command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "hardcore", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
    command.setExecutor(new HardcoreCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:10,代碼來源:CommandRegistrationManager.java

示例9: registerMcrefreshCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerMcrefreshCommand() {
    PluginCommand command = mcMMO.p.getCommand("mcrefresh");
    command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh"));
    command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrefresh", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
    command.setExecutor(new McrefreshCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java

示例10: registerMmoeditCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerMmoeditCommand() {
    PluginCommand command = mcMMO.p.getCommand("mmoedit");
    command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit"));
    command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.3", "mmoedit", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
    command.setExecutor(new MmoeditCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java

示例11: registerSkillresetCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerSkillresetCommand() {
    PluginCommand command = mcMMO.p.getCommand("skillreset");
    command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
    command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.2", "skillreset", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
    command.setExecutor(new SkillresetCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java

示例12: registerXprateCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerXprateCommand() {
    List<String> aliasList = new ArrayList<String>();
    aliasList.add("mcxprate");

    PluginCommand command = mcMMO.p.getCommand("xprate");
    command.setDescription(LocaleLoader.getString("Commands.Description.xprate"));
    command.setPermission("mcmmo.commands.xprate;mcmmo.commands.xprate.reset;mcmmo.commands.xprate.set");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.2", "xprate", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">", "<true|false>"));
    command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xprate", "reset"));
    command.setAliases(aliasList);
    command.setExecutor(new XprateCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:14,代碼來源:CommandRegistrationManager.java

示例13: registerInspectCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerInspectCommand() {
    PluginCommand command = mcMMO.p.getCommand("inspect");
    command.setDescription(LocaleLoader.getString("Commands.Description.inspect"));
    command.setPermission("mcmmo.commands.inspect;mcmmo.commands.inspect.far;mcmmo.commands.inspect.offline");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.1", "inspect", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
    command.setExecutor(new InspectCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java

示例14: registerMccooldownCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerMccooldownCommand() {
    PluginCommand command = mcMMO.p.getCommand("mccooldown");
    command.setDescription(LocaleLoader.getString("Commands.Description.mccooldown"));
    command.setPermission("mcmmo.commands.mccooldown");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mccooldowns"));
    command.setExecutor(new MccooldownCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java

示例15: registerMcabilityCommand

import org.bukkit.command.PluginCommand; //導入方法依賴的package包/類
private static void registerMcabilityCommand() {
    PluginCommand command = mcMMO.p.getCommand("mcability");
    command.setDescription(LocaleLoader.getString("Commands.Description.mcability"));
    command.setPermission("mcmmo.commands.mcability;mcmmo.commands.mcability.others");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcability", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
    command.setExecutor(new McabilityCommand());
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:9,代碼來源:CommandRegistrationManager.java


注:本文中的org.bukkit.command.PluginCommand.setPermission方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。