register multiple commands at once
This commit is contained in:
parent
ae8dc2aed5
commit
012db8d8f4
@ -41,6 +41,15 @@ class CommandManager implements CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function registerCommandListener($commandName, CommandListener $listener, $method, $adminCommand = false) {
|
public function registerCommandListener($commandName, CommandListener $listener, $method, $adminCommand = false) {
|
||||||
|
if (is_array($commandName)) {
|
||||||
|
$success = true;
|
||||||
|
foreach ($commandName as $command) {
|
||||||
|
if (!$this->registerCommandListener($command, $listener, $method, $adminCommand)) {
|
||||||
|
$success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $success;
|
||||||
|
}
|
||||||
$command = strtolower($commandName);
|
$command = strtolower($commandName);
|
||||||
if (!method_exists($listener, $method)) {
|
if (!method_exists($listener, $method)) {
|
||||||
trigger_error("Given listener can't handle command '{$command}' (no method '{$method}')!");
|
trigger_error("Given listener can't handle command '{$command}' (no method '{$method}')!");
|
||||||
|
Loading…
Reference in New Issue
Block a user