/** * @see Server#getPluginCommand(String name) */ public static PluginCommand getPluginCommand(String name) { return server.getPluginCommand(name); }
public static boolean isFakeNijiPerms(Plugin plugin) { PluginCommand permsCommand = Bukkit.getServer().getPluginCommand("permissions"); return permsCommand == null || !(permsCommand.getPlugin().equals(plugin)); }
/** * 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; } }
/** * @see Server#getPluginCommand(String name) */ public static PluginCommand getPluginCommand(String name) { return server.getPluginCommand(name); }
/** * 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; } }
Command command = Bukkit.getServer().getPluginCommand(commandName); if(command != null)
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; } }
Command runCmd = server.getPluginCommand(args[0]); if (runCmd == null)
Command command = server.getPluginCommand(cmdName); if (command != null)
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);