Last active
December 23, 2017 23:43
-
-
Save TheNewHEROBRINEX/cea6eea9720d9b7fdfd4e03f4b56492b to your computer and use it in GitHub Desktop.
Get plugin commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array_unique(array_map(function ($command) { | |
/** @var Command $command */ | |
return $command->getName(); | |
}, array_filter($cmds = $this->getServer()->getCommandMap()->getCommands(), function ($command) use($plugin, $cmds) { | |
/** @var Command $command */ | |
return $command instanceof PluginIdentifiableCommand and $command->getPlugin() === $plugin or isset($cmds[strtolower($plugin->getName() . ":" . $command->getName())]); | |
}))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment