Take a look at your uses when you're building your plugin. Head over to the docs and then specify what you need, go through class members etc and you will find it
Go make another thread. This isn't the appropriate place. use statements will not define variables and functions in your plugin. You define those. The only exception is when you extend existing classes.
Create a folder named resources. Put your config.yml inside there. Then create a value inside it. It would be in your case called BroadCast: Code: ###Config example Broadcast: <whatever you want> Then you need to call the value of broadcast, which will be PHP: $this->cfg = new Config($this->getDataFolder."config.yml", Config::YAML); PHP: this->cfg->get("Broadcast"); You will then need to define it as a variable, which I expect you already know how to do.
I should have wrote it more detailed, but this is what I meant. Let's say he had use pocketmine\entity\event\EntityDamageEvent In his uses, he would then go to the docs and specify through what he needed. When he has done this, it would provide him with his info.
Is this correct? Because it doesn't work how I want it to be: PHP: <?phpnamespace pmmp\SenderPE;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\command\CommandExecutor;use pocketmine\event\Listener;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\Server;use pocketmine\utils\TextFormat;use pocketmine\utils\Config;use pocketmine\permission\ServerOperator;use pocketmine\event\player\PlayerChatEvent;$this->yml = new Config($this->getDataFolder."config.yml", Config::YAML);class Main extends PluginBase{ public function onCommand(CommandSender $sender, Command $command, $label, array $args){ switch($command->getName()){ case "sendnews": if($sender->hasPermission("senderpe.news")){ if(isset($args[0])) { $msg = $this->yml->get("Broadcast"); $sender->sendMessage("Sent the message " . $msg); $sender->getLevel()->getServer()->broadcastMessage("§3§l[News]§r§3 " . implode(" ", $args)); return true; } else { $sender->sendMessage("§cYou cannot send an empty message!"); } } else { $sender->sendMessage("§cYou need OP to do this!"); return true; } } }}
$label is the actual command that was used to execute your code, which is especially useful when using aliases. Say you have a command '/hello <player>'. The hello command has an alias of hi. If some executes the command /hi without a player, you could make it so it says /hi <player>, instead of the default usage.
/msg and /tell are aliases for the same command. They aren't both registered separately, only one command is, but with an alias. When you do Command::getName(), that isn't always what the sender typed, $label is.
Say my command is /hello. /hello has the alias /hi. The usage of /hello is /hello <player>. A player uses /hi and does not enter a player, and thus gets to see a usage message. The usage message says /hello <player>, while the player used /hi. The label is the actual command used, AKA hi in this case, while the command is hello. This allows more detailed usage messages for example.
And I don't understand why you write CommandObject::getName() when there is something existent called Command::getName()...
Take a look at what EssentialsPE does with labels: https://github.com/LegendOfMCPE/Ess...rc/EssentialsPE/BaseFiles/BaseCommand.php#L66 https://github.com/LegendOfMCPE/Ess.../src/EssentialsPE/Commands/Extinguish.php#L30 Note that in this example the variable $alias is used, not $label.
I was trying to specify that getName() isn't a static method, but I could have done a better job. I'll edit it.
Consider calling it as Command->getName() or $Command->getName() if you don't like the wrong syntax or even $pocketmine_command_Command->getName() for FQN.
We had NO knowledge of what his code looks like, so you can't just assume his command was in a class extending PluginBase. Don't post useless posts please