Gets the command with the given name, specific to this plugin. Commands need to be registered in the PluginDescriptionFile#getCommands() PluginDescriptionFile to exist at runtime. @param name name or alias of the command @return the plugin command if found, otherwise null
(@NotNull String name)
| 305 | * @return the plugin command if found, otherwise null |
| 306 | */ |
| 307 | @Nullable |
| 308 | public PluginCommand getCommand(@NotNull String name) { |
| 309 | String alias = name.toLowerCase(java.util.Locale.ENGLISH); |
| 310 | PluginCommand command = getServer().getPluginCommand(alias); |
| 311 | |
| 312 | if (command == null || command.getPlugin() != this) { |
| 313 | command = getServer().getPluginCommand(description.getName().toLowerCase(java.util.Locale.ENGLISH) + ":" + alias); |
| 314 | } |
| 315 | |
| 316 | if (command != null && command.getPlugin() == this) { |
| 317 | return command; |
| 318 | } else { |
| 319 | return null; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | @Override |
| 324 | public void onLoad() {} |
nothing calls this directly
no test coverage detected