The Error: Main.php: PHP: <?phpdeclare(strict_types=1);namespace ghax\lobby;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); }} EventListener.php: PHP: <?use pocketmine\event\Listener;use pocketmine\event\player\PlayerJoinEvent;class EventListener implements Listener { private $plugin; public function __construct(Main $plugin) { $this->plugin = $plugin; } public function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); $name = $player->getName(); $event->setJoinMessage($name." §8[§a+§8]"); }}
Spoiler: Plugin folder -lobby ---src ------ghax ---------lobby ------------Main.php ------------EventListener.php ---plugin.yml Spoiler: Main.php PHP: <?phpdeclare(strict_types=1);namespace ghax\lobby;use pocketmine\plugin\PluginBase;class Main extends PluginBase { public function onEnable() { $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); }} Spoiler: EventListener.php PHP: <?phpnamespace ghax\lobby;use pocketmine\event\Listener;use pocketmine\event\player\PlayerJoinEvent;class EventListener implements Listener { private $plugin; public function __construct(Main $plugin) { $this->plugin = $plugin; } public function onJoin(PlayerJoinEvent $event): void { $player = $event->getPlayer(); $name = $player->getName(); $event->setJoinMessage($name." §8[§a+§8]"); }}
Because i dont unser stand but my code was 1 to 1 tue same i have Experiment 2 houers After I poste die ich lok die code i say to me its the same or not ? And i lok 3 Times was exactlie the same code but dont work and than i copy and pasted and than it work but why I dont unser stand this
I trie in the function PHP: $player->sendMessage("myMessage"); Dont work i got every when i join internal server error but what i do wrong i PHP: use pocketmine/Player; in the Main and the eventlistener
In the Logg is not a error but when i join the server instand kick and than come internal server error
If I understand correctly, then your namespace is not specified correctly in the EventListener class.