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;

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.