pocketmine\command\CommandSender::getName PHP Méthode

getName() public méthode

public getName ( ) : string
Résultat string
    public function getName();

Usage Example

 public function execute(CommandSender $sender, array $args)
 {
     if (count($args) !== 1) {
         return false;
     }
     $helper = $args[0];
     $player = $sender->getServer()->getPlayer($sender->getName());
     $plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
     if ($plot === null) {
         $sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
         return true;
     }
     if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.removehelper")) {
         $sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
         return true;
     }
     if (!$plot->removeHelper($helper)) {
         $sender->sendMessage(TextFormat::RED . $this->translateString("removehelper.notone", [$helper]));
         return true;
     }
     if ($this->getPlugin()->getProvider()->savePlot($plot)) {
         $sender->sendMessage($this->translateString("removehelper.success", [$helper]));
     } else {
         $sender->sendMessage(TextFormat::RED . $this->translateString("error"));
     }
     return true;
 }
All Usage Examples Of pocketmine\command\CommandSender::getName