onCommand is one of the most commonly used methods when writing a new plugin. When used it cause the server to run a certain function when a specific command is entered. Normally plugin developers will use equalsIgnoreCase() with this method so that commands are not case-specific. For example, the following code still send the user the message Hello World! when they issue the command /test.


public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  if(cmd.getName().equalsIgnoreCase("test")) {
    sender.SendMessage("Hello World!");
    return true;