Skip to content

ConsoleAPI

mc.getSendQueue().addToSendQueue(new Packet11PlayerPosition(Double.NaN, Double.NaN, Double.NaN, Double.NaN, true)) edited this page Aug 27, 2026 · 4 revisions

Changelog (pre-NC changes are not listed here)

  • PMMP (pre-plugin) - introduced
  • NC 1.1.0 (1.0.2dev, API 12.1) - added cmdWhitelist into ConsoleAPI
  • NC 1.1.0 (1.0.2dev, API 12.1) - added debug/info/notice/warn/error static functions This API is used to manage commands.

Functions

register(cmd, help, callback)

  • Description: Register a command
  • Return: nothing
  • Arguments:
    • mixed cmd - Name of the command. Must be a string.
    • mixed help - Command description that is displayed in /help menu. Must be a string.
    • mixed callback - callback to a function that handles a command (Command Handler Functions).
  • Examples:
    $this->register("help", "[page|command name]", array($this, "defaultCommands"));
    $this->register("status", "", array($this, "defaultCommands"));
    
    Source: ConsoleAPI::init, NostalgiaCore

alias(alias, cmd)

  • Description: Creates a command alias
  • Return: true
  • Arguments:
    • mixed alias - Name of the alias. Must be a string.
    • mixed cmd - Command alias. Must be a string.
  • Examples:

    Create a new alias for a command

    $this->server->api->console->alias("tps", "status");
    
    Source: ConsoleAPI::init, NostalgiaCore

    Create a new alias for a command with predefined argument

    $this->server->api->console->alias("ban-ip", "banip add");
    
    Source: BanAPI::init, NostalgiaCore

cmdWhitelist(cmd)

  • Description: Makes it possible to use command without op
  • Return: nothing
  • Arguments:
    • mixed cmd - Name of the command. Must be a string.

Clone this wiki locally