K, I asked this question before, but how do you make multiple src files? I want to have a commands one, main one, and a listener one. Any idea?
Ohh I see what you mean yeah like I said above just make a new file in in the same directory as your main
You don't make multiple files just because you want to. You ask yourself why you want to do so before you do something. And why, in this situation?
And are you sure you know the impacts of separating them? You don't simply put them into different files. You make each command its own class, and this is not as simple as "This paragraph is too long; let me start a new paragraph".
Oh dude I'm so sorry for the wait 0.0 I fell asleep but here hey.php(non main) PHP: <?phpnamespace big;use pocketmine\event\Listener;use pocketmine\event\block\BlockBreakEvent;class hey implements Listener{ public function onBreak(BlockBreakEvent $event){ $event->setCancelled(); }} then my main Loader.php PHP: <?phpnamespace big;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\utils\TextFormat;use pocketmine\event\entity\EntitySpawnEvent;class Loader extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getPluginManager()->registerEvents(new hey($this), $this); $this->getLogger()->info(TextFormat::GREEN."big enabled."); } public function onDisable(){ $this->getLogger()->info(TextFormat::RED."big disabled."); } public function onSpawn(EntitySpawnEvent $event){ $event->getEntity()->setHealth(1); }}
K well i tried to implement commands: all it says is usage:test, and my plugin.yml is correct Loader.PHP PHP: <?phpnamespace CustomItems;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\utils\TextFormat;use pocketmine\event\entity\EntitySpawnEvent;class Loader extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getPluginManager()->registerEvents(new ZaRocDamageEvent($this), $this); $this->getServer()->getPluginManager()->registerEvents(new Commands($this), $this); $this->getLogger()->info(TextFormat::GREEN."CustomItemsRewrite Enabled!"); $this->getLogger()->info(TextFormat::GREEN."CustomItemsRewrite Enabled!"); } public function onDisable(){ $this->getLogger()->info(TextFormat::RED."CustomItemsRewrite Disabled!"); }} Commands.PHP PHP: <?phpnamespace CustomItems;use pocketmine\command\CommandSender;use pocketmine\command\Command;use pocketmine\event\Listener;use pocketmine\Player;class Commands implements Listener{ public function __construct(Loader $plugin){ $this->plugin = $plugin;} public function onCommand(CommandSender $sender,Command $cmd,$label,array $args){ if($cmd->getName() == "test"){ $sender->sendPopup("TEST"); } }}