Move command timings to Timings::

this avoids duplicate timings entries when command labels are changed and changed back, or if multiple command maps are in use.
In addition, it also solves some PHPStan issues :)
This commit is contained in:
Dylan K. Taylor
2022-10-16 16:57:10 +01:00
parent 53cae8911d
commit bd01a919e5
5 changed files with 20 additions and 29 deletions

View File

@ -31,8 +31,6 @@ use pocketmine\lang\KnownTranslationFactory;
use pocketmine\lang\Translatable;
use pocketmine\permission\PermissionManager;
use pocketmine\Server;
use pocketmine\timings\Timings;
use pocketmine\timings\TimingsHandler;
use pocketmine\utils\BroadcastLoggerForwarder;
use pocketmine\utils\TextFormat;
use function explode;
@ -60,8 +58,6 @@ abstract class Command{
private ?string $permission = null;
private ?string $permissionMessage = null;
public ?TimingsHandler $timings = null;
/**
* @param string[] $aliases
*/
@ -136,7 +132,6 @@ abstract class Command{
public function setLabel(string $name) : bool{
$this->nextLabel = $name;
if(!$this->isRegistered()){
$this->timings = new TimingsHandler(Timings::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Command: " . $name);
$this->label = $name;
return true;