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


Java PluginCommand.setUsage方法代码示例

本文整理汇总了Java中org.bukkit.command.PluginCommand.setUsage方法的典型用法代码示例。如果您正苦于以下问题:Java PluginCommand.setUsage方法的具体用法?Java PluginCommand.setUsage怎么用?Java PluginCommand.setUsage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.command.PluginCommand的用法示例。


在下文中一共展示了PluginCommand.setUsage方法的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: register

import org.bukkit.command.PluginCommand; //导入方法依赖的package包/类
private void register() {
  for (EllyCommand command : commands) {
    try {
      Constructor constructor = Class.forName(PluginCommand.class.getName()).getDeclaredConstructor(String.class, Plugin.class);
      constructor.setAccessible(true);

      Plugin plugin = registry.getPlugin();

      PluginCommand pluginCommand = (PluginCommand) constructor.newInstance(command.getName(), plugin);
      pluginCommand.setAliases(command.getAliases());
      pluginCommand.setDescription(command.getDescription());
      pluginCommand.setExecutor(plugin);
      pluginCommand.setTabCompleter(command.getTabCompleter());
      pluginCommand.setUsage(command.getUsage(false));

      Commands.getCommandMap().register(plugin.getName(), pluginCommand);
    } catch (InstantiationException | InvocationTargetException | IllegalAccessException
        | NoSuchMethodException | ClassNotFoundException e) {
      Logger.getLogger("EllyCommand").severe("Could not register command \"" + command.getName() + "\"");
    }
  }
}
 
开发者ID:CardinalDevelopment,项目名称:EllyCommand,代码行数:23,代码来源:CommandFactory.java

示例3: 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

示例4: 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

示例5: createPluginCommand

import org.bukkit.command.PluginCommand; //导入方法依赖的package包/类
private PluginCommand createPluginCommand() {
    plugin.debug("Creating plugin command");
    try {
        Constructor<PluginCommand> c = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
        c.setAccessible(true);

        PluginCommand cmd = c.newInstance(name, plugin);
        cmd.setDescription("Manage players' shops or this plugin.");
        cmd.setUsage("/" + name);
        cmd.setExecutor(new ShopBaseCommandExecutor());
        cmd.setTabCompleter(new ShopBaseTabCompleter());

        return cmd;
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
        plugin.getLogger().severe("Failed to create command");
        plugin.debug("Failed to create plugin command");
        plugin.debug(e);
    }

    return null;
}
 
开发者ID:EpicEricEE,项目名称:ShopChest,代码行数:22,代码来源:ShopCommand.java

示例6: registerCommand

import org.bukkit.command.PluginCommand; //导入方法依赖的package包/类
/**
 * Registers a command in the server's CommandMap.
 *
 * @param ce CommandExecutor to be registered
 * @param rc ReflectCommand the command was annotated with
 */
public void registerCommand(@NotNull final BaseCommand<? extends Plugin> ce, @NotNull final ReflectCommand rc) {
    Preconditions.checkNotNull(ce, "ce was null");
    Preconditions.checkNotNull(rc, "rc was null");
    try {
        final Constructor c = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
        c.setAccessible(true);
        final PluginCommand pc = (PluginCommand) c.newInstance(rc.name(), this.plugin);
        pc.setExecutor(ce);
        pc.setAliases(Arrays.asList(rc.aliases()));
        pc.setDescription(rc.description());
        pc.setUsage(rc.usage());
        final CommandMap cm = this.getCommandMap();
        if (cm == null) {
            this.plugin.getLogger().warning("CommandMap was null. Command " + rc.name() + " not registered.");
            return;
        }
        cm.register(this.plugin.getDescription().getName(), pc);
        this.commandHandler.addCommand(new CommandCoupling(ce, pc));
    } catch (Exception e) {
        this.plugin.getLogger().warning("Could not register command \"" + rc.name() + "\" - an error occurred: " + e.getMessage() + ".");
    }
}
 
开发者ID:Chatterbox,项目名称:Chatterbox,代码行数:29,代码来源:ReflectiveCommandRegistrar.java

示例7: registerPtpCommand

import org.bukkit.command.PluginCommand; //导入方法依赖的package包/类
private static void registerPtpCommand() {
    PluginCommand command = mcMMO.p.getCommand("ptp");
    command.setDescription(LocaleLoader.getString("Commands.Description.ptp"));
    command.setPermission("mcmmo.commands.ptp"); // Only need the main one, not the individual ones for toggle/accept/acceptall
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.1", "ptp", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
    command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "ptp", "<toggle|accept|acceptall>"));
    command.setExecutor(new PtpCommand());
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:10,代码来源:CommandRegistrationManager.java

示例8: registerMobhealthCommand

import org.bukkit.command.PluginCommand; //导入方法依赖的package包/类
private static void registerMobhealthCommand() {
    PluginCommand command = mcMMO.p.getCommand("mobhealth");
    command.setDescription("Change the style of the mob healthbar"); //TODO: Localize
    command.setPermission("mcmmo.commands.mobhealth");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mobhealth", "<DISABLED | HEARTS | BAR>"));
    command.setExecutor(new MobhealthCommand());
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:9,代码来源:CommandRegistrationManager.java

示例9: registerMcgodCommand

import org.bukkit.command.PluginCommand; //导入方法依赖的package包/类
private static void registerMcgodCommand() {
    PluginCommand command = mcMMO.p.getCommand("mcgod");
    command.setDescription(LocaleLoader.getString("Commands.Description.mcgod"));
    command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others");
    command.setPermissionMessage(permissionsMessage);
    command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcgod", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
    command.setExecutor(new McgodCommand());
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:9,代码来源:CommandRegistrationManager.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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