Is there anything wrong with this? PHP: <?phpnamespace FlamingGenius\ColorTag;use pocketmine\utils\Config;use pocketmine\plugin\PluginBase;use pocketmine\Player;use pocketmine\entity\Entity;use pocketmine\event\PlayerJoinEvent;use pocketmine\event\PlayerQuitEvent;use pocketmine\event\Listener;class ColorTag extends PluginBase implements Listener{$playerConfig = new Config($this->getDataFolder() . $player . ".yml" . Config::YAML);public function onEnable(){ $this->saveDefaultConfig(); $this->getServer()->getPluginManager()->registerEvents($this, $this);}public function onCommand(CommandSender $sender, Command $command, $label, array $args){$player = $this->getServer()->getPlayer();$cmd = $this->command->getName();$tag = $args;$config = $this->getConfig()->get("tags");if($tag == $config){ if(strtolower($cmd) == "st"){ $setTag = $this->getConfig()->get($tag); $player->setNameTag($setTag); }} else{ $sender->sendMessage("§bTag not reconized"); }}public function onJoinGame(PlayerJoinEvent $event){ $players = $event->getServer()->getOnlinePlayers(); foreach($players as $player){ $playerConfig; }}public function onQuitGame(PlayerQuitEvent $event){ $player = $this->getServer()->getPlayer()->getName(); $playerConfig->set($player , $player->getNameTag()); $playerConfig->save();}}?>
Ugh crash :/ PHP: Error: Declaration of FlamingGenius\ColoredTags\ColoredTags::onCommand() must be compatible with pocketmine\command\CommandExecutor::onCommand(pocketmine\command\CommandSender $sender, pocketmine\command\Command $command, $label, array $args)File: /phar_ColoredTags-master (1)_VHbd7_sxPG8WixV.phar/src/FlamingGenius/ColoredTags/ColoredTagsLine: 13Type: E_COMPILE_ERRORTHIS CRASH WAS CAUSED BY A PLUGINCode:[4] [5] use pocketmine\utils\Config;[6] use pocketmine\plugin\PluginBase;[7] use pocketmine\Player;[8] use pocketmine\entity\Entity;[9] use pocketmine\event\PlayerJoinEvent;[10] use pocketmine\event\PlayerQuitEvent;[11] use pocketmine\event\Listener;[12] [13] class ColoredTags extends PluginBase implements Listener{[14] [15] public function onEnable(){[16] $this->saveDefaultConfig();[17] $this->getServer()->getPluginManager()->registerEvents($this, $this);[18] }
OMG I added the imports as i added the functions i cant believe i actually missed putting the command imports in.... This is kinda embarrassing cant believe i missed something so simple as an import
I cant win :/ PHP: Error: Call to undefined method pocketmine\event\player\PlayerJoinEvent::getServer()File: /phar_ColoredTags-master_GZjq2mD9XiDJFmp.phar/src/FlamingGenius/ColoredTags/ColoredTagsLine: 39Type: E_ERRORTHIS CRASH WAS CAUSED BY A PLUGINBAD PLUGIN: ColoredTags v1.0.0Code:[30] $player->setNameTag($setTag);[31] }[32] }[33] else{[34] $sender->sendMessage("§bTag not reconized");[35] }[36] }[37] [38] public function onJoinGame(PlayerJoinEvent $event){[39] $players = $event->getServer()->getOnlinePlayers();[40] foreach($players as $player){[41] $playerConfig = new Config($this->getDataFolder() . $player . ".yml" . Config::YAML);[42] $playerConfig->save();[43] [44] }[45] }
If you are coding on your phone/tablet why not donwload the pocketmine app and test your plugins on that?