mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
and more typehints
This commit is contained in:
@ -100,7 +100,7 @@ abstract class Command{
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function generateCustomCommandData(Player $player){
|
||||
public function generateCustomCommandData(Player $player) : array{
|
||||
//TODO: fix command permission filtering on join
|
||||
/*if(!$this->testPermissionSilent($player)){
|
||||
return null;
|
||||
@ -202,7 +202,7 @@ abstract class Command{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel(string $name){
|
||||
public function setLabel(string $name) : bool{
|
||||
$this->nextLabel = $name;
|
||||
if(!$this->isRegistered()){
|
||||
if($this->timings instanceof TimingsHandler){
|
||||
|
@ -47,7 +47,7 @@ interface CommandMap{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(CommandSender $sender, $cmdLine);
|
||||
public function dispatch(CommandSender $sender, string $cmdLine) : bool;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
|
@ -31,7 +31,6 @@ use pocketmine\permission\PermissionAttachmentInfo;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\MainLogger;
|
||||
use pocketmine\utils\Terminal;
|
||||
|
||||
class ConsoleCommandSender implements CommandSender{
|
||||
|
||||
@ -49,7 +48,7 @@ class ConsoleCommandSender implements CommandSender{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPermissionSet($name){
|
||||
public function isPermissionSet($name) : bool{
|
||||
return $this->perm->isPermissionSet($name);
|
||||
}
|
||||
|
||||
@ -58,7 +57,7 @@ class ConsoleCommandSender implements CommandSender{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPermission($name){
|
||||
public function hasPermission($name) : bool{
|
||||
return $this->perm->hasPermission($name);
|
||||
}
|
||||
|
||||
@ -89,14 +88,14 @@ class ConsoleCommandSender implements CommandSender{
|
||||
/**
|
||||
* @return PermissionAttachmentInfo[]
|
||||
*/
|
||||
public function getEffectivePermissions(){
|
||||
public function getEffectivePermissions() : array{
|
||||
return $this->perm->getEffectivePermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPlayer(){
|
||||
public function isPlayer() : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -132,14 +131,14 @@ class ConsoleCommandSender implements CommandSender{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isOp(){
|
||||
public function isOp() : bool{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setOp($value){
|
||||
public function setOp(bool $value){
|
||||
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ class SimpleCommandMap implements CommandMap{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function dispatch(CommandSender $sender, $commandLine){
|
||||
public function dispatch(CommandSender $sender, string $commandLine) : bool{
|
||||
$args = explode(" ", $commandLine);
|
||||
$sentCommandLabel = "";
|
||||
$target = $this->matchCommand($sentCommandLabel, $args);
|
||||
@ -248,7 +248,7 @@ class SimpleCommandMap implements CommandMap{
|
||||
/**
|
||||
* @return Command[]
|
||||
*/
|
||||
public function getCommands(){
|
||||
public function getCommands() : array{
|
||||
return $this->knownCommands;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\ConsoleCommandSender;
|
||||
use pocketmine\event\TranslationContainer;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
|
Reference in New Issue
Block a user