Got some free time thinking of making a would you rather game plugin useful maybe? p.s: Leaving good would you rather questions in the comments would be helpful Submitted plugin Anybody wanna take a gander at weather this will be approved or not Spoiler: plugin.yml Code: name: Would You Rather author: FlamingGenius main: FlamingGenius\wyr\main description: Simple would you rather game version: 1.0.0 commands: wyr: description: Get a would you rather question usage: "/wyr" Spoiler: config.yml Code: questions[ "Would you rather Eat a jar of peanut butter or Drink a jar of maple syrup?", "Would you rather live one life that lasts 1,000 years or live 10 lives that last 100 years each?", "Would you rather use eye drops made of vinegar or toilet paper made from sandpaper?", "Would you rather be without elbows or be without knees?", "Would you rather experience a sharp pain in your side each time someone says your name or have a bell sound each time you are aroused?", "Would you rather have a large 10 inch long belly button that swayed to music or have accordions for legs?", "Would you rather have to sneeze but not be able to or have something stuck in your eye for an entire year?", "Would you rather have a dragon or be a dragon?", "Would you rather have hair nowhere on your body or be very hairy all over and not be able to shave?", "Would you rather never be able to speak again or always have to say everything that is on your mind?", "Would you rather be able to read or be able to read minds (but be illiterate)?", "Would you rather be able to speak fluently every language in the world or be the best in the world at something of your choosing?", "Would you rather be in prison for five years in solitary confinement or not ever go to prison and not ever become rich?", "Would you rather wear a snow suit in the desert or be naked in Antarctica?", "Would you rather change the past or be able to see into the future?", "Would you rather have cookies or have French fries?", "Would you rather be good at sports or get good grades?", "Would you rather help clean up after dinner or help set the table before dinner?", "Would you rather get up early or stay up late?", "Would you rather be super fast or super strong?", "Would you rather be invisible or have the ability to fly?", "Would you rather be the smartest kid in school or the most popular kid in school?", "Would you rather eat your boogers or lick your shoe?", "Would you rather have bad breath or smelly feet?", "Would you rather be a police officer or be a firefighter?" ] Spoiler: main.php PHP: <?namespace FlamingGenius\wyr;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\command\Command;use pocketmine\command\CommandSender;class main extends PluginBase implements Listener{ public function onEnable(){ $this->saveDefaultConfig(); $this->getServer()->getPluginManager()->registerEvents($this,$this); } private function getQuestion(){ $questions = $this->getConfig()->get("questions"); $draw = array_rand($questions); $question = $questions[$draw]; return $question; } public function onCommand(CommandSender $sender,Command $command,$label,array $args){ $cmd = $command->getName(); if($cmd === "wyr"){ $this->getServer()->broadcastMessage($this->getQuestion()); } }}?> Feel free to contribute https://github.com/FlamingGenius/would-you-rather/blob/master/README.md
And your use statement is not complete yet, you need to use PHP: use pocketmine\command\Command;use pocketmine\command\CommandSender;
I think it should be PHP: $this->getServer()->broadcastMessage($this->getQuestion()); // You can call getServer() directly since your class extends PluginBase
Why does everyone like using a main class name "main"? Class names should start with an uppercase letter.
Learn PHP! Where the first time this sentence has been said on the forums, it was me making the same mistake, thinking that in PHP I can call $this methods directly like in Java.
Cleaned this thread up. (Now please excuse me while I have an ironic and hypocritical off-topic rant about off-topic content: I don't know what has been happening in this section while I was gone, but I will enforce my standards on threads while I have time to moderate. This section is geared toward providing support and also facilitating discussion around key topics. In order to do this, discussions should remain focused on the original topic in order to satisfy the needs of the OP. We have a wonderful "off-topic" section and messaging system for all your random conversation needs. Discussions that stray from the topic in this section will be removed without warning. Users who repeatedly go "off-topic" will be warned formally. I will make a thread specifically about this soon, but I figured I would post here because there was an issue here.)