org.bukkit.Server.getPluginCommand()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.bukkit.Server.getPluginCommand()方法的一些代码示例,展示了Server.getPluginCommand()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getPluginCommand()方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:getPluginCommand

Server.getPluginCommand介绍

[英]Gets a PluginCommand with the given name or alias.
[中]获取具有给定名称或别名的PluginCommand。

代码示例

代码示例来源:origin: Bukkit/Bukkit

/**
 * @see Server#getPluginCommand(String name)
 */
public static PluginCommand getPluginCommand(String name) {
  return server.getPluginCommand(name);
}

代码示例来源:origin: EngineHub/WorldEdit

public static boolean isFakeNijiPerms(Plugin plugin) {
  PluginCommand permsCommand = Bukkit.getServer().getPluginCommand("permissions");
  return permsCommand == null || !(permsCommand.getPlugin().equals(plugin));
}

代码示例来源:origin: Bukkit/Bukkit

/**
 * Gets the command with the given name, specific to this plugin. Commands
 * need to be registered in the {@link PluginDescriptionFile#getCommands()
 * PluginDescriptionFile} to exist at runtime.
 *
 * @param name name or alias of the command
 * @return the plugin command if found, otherwise null
 */
public PluginCommand getCommand(String name) {
  String alias = name.toLowerCase();
  PluginCommand command = getServer().getPluginCommand(alias);
  if (command == null || command.getPlugin() != this) {
    command = getServer().getPluginCommand(description.getName().toLowerCase() + ":" + alias);
  }
  if (command != null && command.getPlugin() == this) {
    return command;
  } else {
    return null;
  }
}

代码示例来源:origin: SpigotMC/Spigot-API

/**
 * @see Server#getPluginCommand(String name)
 */
public static PluginCommand getPluginCommand(String name) {
  return server.getPluginCommand(name);
}

代码示例来源:origin: SpigotMC/Spigot-API

/**
 * Gets the command with the given name, specific to this plugin. Commands
 * need to be registered in the {@link PluginDescriptionFile#getCommands()
 * PluginDescriptionFile} to exist at runtime.
 *
 * @param name name or alias of the command
 * @return the plugin command if found, otherwise null
 */
public PluginCommand getCommand(String name) {
  String alias = name.toLowerCase();
  PluginCommand command = getServer().getPluginCommand(alias);
  if (command == null || command.getPlugin() != this) {
    command = getServer().getPluginCommand(description.getName().toLowerCase() + ":" + alias);
  }
  if (command != null && command.getPlugin() == this) {
    return command;
  } else {
    return null;
  }
}

代码示例来源:origin: BigScary/GriefPrevention

Command command = Bukkit.getServer().getPluginCommand(commandName);
if(command != null)

代码示例来源:origin: Rsl1122/Plan-PlayerAnalytics

private Command getBukkitCommand(String commandName) {
    Command command = plugin.getServer().getPluginCommand(commandName);
    if (command == null) {
      try {
        command = plugin.getServer().getCommandMap().getCommand(commandName);
      } catch (NoSuchMethodError ignored) {
        /* Ignored, Bukkit 1.8 has no such method */
      }
    }
    return command;
  }
}

代码示例来源:origin: TotalFreedom/TotalFreedomMod

Command runCmd = server.getPluginCommand(args[0]);
if (runCmd == null)

代码示例来源:origin: TotalFreedom/TotalFreedomMod

Command command = server.getPluginCommand(cmdName);
if (command != null)

代码示例来源:origin: marcelo-mason/SimpleClans

if (!plugin.getServer().getPluginCommand(plugin.getSettingsManager().getCommandAlly()).equals(plugin.getCommand(plugin.getSettingsManager().getCommandAlly()))) {
  new AllyCommandExecutor().onCommand(player, null, null, Helper.removeFirst(split));
  event.setCancelled(true);
if (!plugin.getServer().getPluginCommand(plugin.getSettingsManager().getCommandGlobal()).equals(plugin.getCommand(plugin.getSettingsManager().getCommandGlobal()))) {
  new GlobalCommandExecutor().onCommand(player, null, null, Helper.removeFirst(split));
  event.setCancelled(true);
if (!plugin.getServer().getPluginCommand(plugin.getSettingsManager().getCommandClan()).equals(plugin.getCommand(plugin.getSettingsManager().getCommandClan()))) {
  new ClanCommandExecutor().onCommand(player, null, null, Helper.removeFirst(split));
  event.setCancelled(true);
if (!plugin.getServer().getPluginCommand(plugin.getSettingsManager().getCommandAccept()).equals(plugin.getCommand(plugin.getSettingsManager().getCommandAccept()))) {
  new AcceptCommandExecutor().onCommand(player, null, null, Helper.removeFirst(split));
  event.setCancelled(true);
if (!plugin.getServer().getPluginCommand(plugin.getSettingsManager().getCommandDeny()).equals(plugin.getCommand(plugin.getSettingsManager().getCommandDeny()))) {
  new DenyCommandExecutor().onCommand(player, null, null, Helper.removeFirst(split));
  event.setCancelled(true);
if (!plugin.getServer().getPluginCommand(plugin.getSettingsManager().getCommandMore()).equals(plugin.getCommand(plugin.getSettingsManager().getCommandMore()))) {
  new MoreCommandExecutor().onCommand(player, null, null, Helper.removeFirst(split));
  event.setCancelled(true);

相关文章

微信公众号

最新文章

更多

Server类方法