you can't but you can try use Server::getInstance() or add a constructor(hope you still remember oop) that need you to pass server instance the constructor will set a local var to the server like this (sorry no indention on my ipad rn) PHP: class example {private $serverpublic function __construct(Server $server){$this->server = $server;}}$this->getRegisterEvent(new example($this->getServer()),$this)
Kk, so i just merged everything, and I get this error Warning: Uncaught ClassNotFoundException: Class CustomEnchantments\Command not found in phar://C:/Users/Conner/Desktop/GensisyTestServer/Genisys.phar/src/spl/BaseClassLoader.php:144 Stack trace: #0 [internal function]: BaseClassLoader->loadClass('CustomEnchantme...') #1 C:\Users\Conner\Desktop\GensisyTestServer\plugins\CustomEnchantments\src\CustomEnchantments\Main.php(31): spl_autoload_call('CustomEnchantme...') #2 phar://C:/Users/Conner/Desktop/GensisyTestServer/Genisys.phar/src/spl/BaseClassLoader.php(128): include('C:\\Users\\Conner...') #3 [internal function]: BaseClassLoader->loadClass('CustomEnchantme...') #4 [internal function]: spl_autoload_call('CustomEnchantme...') #5 phar://C:/Users/Conner/Desktop/GensisyTestServer/plugins/DevTools_v1.10.0.phar/src/FolderPluginLoader/FolderPluginLoader.php(64): class_exists('CustomEnchantme...', true) #6 phar://C:/Users/Conner/Desktop/GensisyTestServer/Genisys.phar/src/pocketmine/plugin/PluginManager.php(152): FolderPluginLoader\FolderPluginLoader->loadPlugin('C:\\Users\\C in phar://C:/Users/Conner/Desktop/GensisyTestServer/Genisys.phar/src/spl/BaseClassLoader.php on line 144 Fatal error: Declaration of CustomEnchantments\Main:nCommand(pocketmine\command\CommandSender $sender, CustomEnchantments\Command $cmd, $label, array $args) must be compatible with pocketmine\command\CommandExecutor:nCommand(pocketmine\command\CommandSender $sender, pocketmine\command\Command $command, $label, array $args) in C:\Users\Conner\Desktop\GensisyTestServer\plugins\CustomEnchantments\src\CustomEnchantments\Main.php on line 31
For commands do, for better commands like /CE Zara buy. This would work PHP: public function onCommand(CommandSender $sender, Command $command //bla) {if (!isset($args[0])) {$sender->sendMessage("CustomEnchantments");}switch (strtolower($args[0])){case://blareturn;break;
It's dead code. Any code after return statements will not be executed, unless you have labels like `case:`, `default:` or goto labels. You don't need the break line at all. `return` already does the trick of exiting the function.