I have been having trouble with that function cause I'm new to the pocketmine api and could use your help. this is what I have done so far: public function onCommand(CommandSender $sender, Command $command, $label, array $args){ switch($command->getName()){ case "set-welcometitle": $this->getConfig()->get("title-message") = $sender->getPlayer()->message(); return true; } } this just crashes the server. the plugin is meant to be a welcome message that sends a title to the player, i want to use that command to update the config with the message. How do I do it
how do i know? you didnt even give us any logs.. it's not like the helping users here can hack into other pc just to read the log and help you out
I just need to know how to use: onCommand() so the user can set a welcome message, how can that be achieved?
you do get the config and set a value say "welcome-message" and set it to what they player want then save the config(important) when a player join, you get the welcome message by getting the config then you tell the player the welcome message
I have done that already, i want to be able to set the message with a command using the public function onCommand() {}
I still don't understand it so, can you game me some example code so i can study it? that is how I understand most things.
Is it so hard to look at the source code of other plugins? Is it so hard to look at PMMP's config class?
actually what you did is good! now onjoin just $player->send($this->getConfig()->get("title-message")) then you are done also you havent even show us logs