I currently have this code but when I try and call the onPlayerDeath() listener it wont work. Their are very few documentations for problems like this. Please Help me. Tell me what is wrong with my code?!?!? Code: <?php namespace CyberTech; use pocketmine\Player; use pocketmine\Server; use pocketmine\event\Listener; use pocketmine\event\player\PlayerEvent; use pocketmine\event\player\PlayerJoinEvent; use pocketmine\event\player\PlayerQuitEvent; use pocketmine\event\player\PlayerDeathEvent; use pocketmine\event\entity\EntityDeathEvent; use pocketmine\event\entity\EntityLevelChangeEvent; use pocketmine\level\Position; use pocketmine\math\Vector3; use pocketmine\permission\Permission; use pocketmine\plugin\PluginBase; use pocketmine\utils\Config; use pocketmine\utils\TextFormat; class Functions extends PluginBase implements Listener{ public function __construct(Main $plugin){ $this->plugin = $plugin; } public function onPlayerDeath(PlayerDeathEvent $event){ $player = $event->getEntity(); $this->getLogger()->info("Arena[1]:".$player); return $this->getLogger()->info("Arena[1]:".$player);; } public function startfight1($sender, $arena, array $args){ $this->getLogger()->info("Sender:".$sender); $this->getLogger()->info("Arena:".$arena); $this->getLogger()->info("Args:".$args[0]); $this->getLogger()->info("StartFight has been called!"); return true; } } ?>
Nope No Luck... I get the OnEnabled And onDisabled to work but not OnPlayerDeath or onPlayerJoin. Could someone type out a basic Main.php plugin that said Hi when you join for me? So I can try and have a reference to go off of.
I know you dont have yo have the OnEnable and OnDisable but i just want the onPlayerJoin to happen...
What is this file? Is this the main class of something else? Why did you require a Main parameter in the constructor if it is the main class? Why does it extend PluginBase otherwise?
The listenter (then functions class) wasn't registered. Please check the documentation for how to do that in the onenable function.