Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Phpcraft\Command\Command Class Reference

Public Member Functions

 __construct (Plugin $plugin, array $names, $required_permission, callable $function)
 
 getCanonicalName ()
 
 call (CommandSender &$sender, array $args)
 
 isUsableBy (CommandSender &$sender)
 
 getSyntax ()
 

Static Public Member Functions

static handleMessage (CommandSender &$sender, string $msg)
 
static get (string $name)
 
static getProvider ($type)
 

Public Attributes

 $plugin
 
 $names
 
 $required_sender_class
 
 $required_permission
 
 $params
 

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Command\Command::__construct ( Plugin  $plugin,
array  $names,
  $required_permission,
callable  $function 
)

@noinspection PhpDeprecationInspection

@noinspection PhpDeprecationInspection

Member Function Documentation

◆ call()

Phpcraft\Command\Command::call ( CommandSender $sender,
array  $args 
)

Calls the command using the given string arguments.

Parameters
CommandSender$sender
array<string>$args
Returns
void

◆ get()

static Phpcraft\Command\Command::get ( string  $name)
static

Returns a command using one of its names or null if not found.

Parameters
string$name
Returns
Command|null

◆ getCanonicalName()

Phpcraft\Command\Command::getCanonicalName ( )
Returns
string

◆ getProvider()

static Phpcraft\Command\Command::getProvider (   $type)
static
Parameters
ReflectionType | null$type
Returns
string

@noinspection PhpDeprecationInspection

◆ getSyntax()

Phpcraft\Command\Command::getSyntax ( )
Returns
string

◆ handleMessage()

static Phpcraft\Command\Command::handleMessage ( CommandSender $sender,
string  $msg 
)
static

Handles a message, which may be a command, in which case it will be executed.

Parameters
CommandSender$sender
string$msg
Returns
bool If the message was a command.

◆ isUsableBy()

Phpcraft\Command\Command::isUsableBy ( CommandSender $sender)

Returns true if the given CommandSender fulfils the class & permission requirements.

Parameters
CommandSender$sender
Returns
bool

Member Data Documentation

◆ $names

array< string > Phpcraft\Command\Command::$names

◆ $params

array< ReflectionParameter > Phpcraft\Command\Command::$params

◆ $plugin

Plugin Phpcraft\Command\Command::$plugin

◆ $required_permission

string null Phpcraft\Command\Command::$required_permission

◆ $required_sender_class

string null Phpcraft\Command\Command::$required_sender_class