Skip to content

Instantly share code, notes, and snippets.

@TheNewHEROBRINEX
Last active December 23, 2017 23:43
Show Gist options
  • Save TheNewHEROBRINEX/cea6eea9720d9b7fdfd4e03f4b56492b to your computer and use it in GitHub Desktop.
Save TheNewHEROBRINEX/cea6eea9720d9b7fdfd4e03f4b56492b to your computer and use it in GitHub Desktop.
Get plugin commands
<?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