mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Modernize property type declarations
This commit is contained in:
@ -27,8 +27,7 @@ use pocketmine\block\Block;
|
||||
use pocketmine\entity\Entity;
|
||||
|
||||
class EntityCombustByBlockEvent extends EntityCombustEvent{
|
||||
/** @var Block */
|
||||
protected $combuster;
|
||||
protected Block $combuster;
|
||||
|
||||
public function __construct(Block $combuster, Entity $combustee, int $duration){
|
||||
parent::__construct($combustee, $duration);
|
||||
|
@ -26,8 +26,7 @@ namespace pocketmine\event\entity;
|
||||
use pocketmine\entity\Entity;
|
||||
|
||||
class EntityCombustByEntityEvent extends EntityCombustEvent{
|
||||
/** @var Entity */
|
||||
protected $combuster;
|
||||
protected Entity $combuster;
|
||||
|
||||
public function __construct(Entity $combuster, Entity $combustee, int $duration){
|
||||
parent::__construct($combustee, $duration);
|
||||
|
@ -33,8 +33,7 @@ use pocketmine\event\CancellableTrait;
|
||||
class EntityCombustEvent extends EntityEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/** @var int */
|
||||
protected $duration;
|
||||
protected int $duration;
|
||||
|
||||
public function __construct(Entity $combustee, int $duration){
|
||||
$this->entity = $combustee;
|
||||
|
@ -33,11 +33,8 @@ use pocketmine\event\Event;
|
||||
* @phpstan-template TEntity of Entity
|
||||
*/
|
||||
abstract class EntityEvent extends Event{
|
||||
/**
|
||||
* @var Entity
|
||||
* @phpstan-var TEntity
|
||||
*/
|
||||
protected $entity;
|
||||
/** @phpstan-var TEntity */
|
||||
protected Entity $entity;
|
||||
|
||||
/**
|
||||
* @return Entity
|
||||
|
@ -41,27 +41,20 @@ use pocketmine\world\Position;
|
||||
class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/** @var Position */
|
||||
protected $position;
|
||||
|
||||
/** @var Block[] */
|
||||
protected $blocks;
|
||||
|
||||
/** @var float */
|
||||
protected $yield;
|
||||
|
||||
/**
|
||||
* @param Block[] $blocks
|
||||
* @param float $yield 0-100
|
||||
*/
|
||||
public function __construct(Entity $entity, Position $position, array $blocks, float $yield){
|
||||
public function __construct(
|
||||
Entity $entity,
|
||||
protected Position $position,
|
||||
protected array $blocks,
|
||||
protected float $yield
|
||||
){
|
||||
$this->entity = $entity;
|
||||
$this->position = $position;
|
||||
$this->blocks = $blocks;
|
||||
if($yield < 0.0 || $yield > 100.0){
|
||||
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
|
||||
}
|
||||
$this->yield = $yield;
|
||||
}
|
||||
|
||||
public function getPosition() : Position{
|
||||
|
@ -38,16 +38,16 @@ use pocketmine\event\CancellableTrait;
|
||||
class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/** @var float */
|
||||
protected $force;
|
||||
private bool $blockBreaking = true;
|
||||
|
||||
public function __construct(Entity $entity, float $force){
|
||||
public function __construct(
|
||||
Entity $entity,
|
||||
protected float $force
|
||||
){
|
||||
if($force <= 0){
|
||||
throw new \InvalidArgumentException("Explosion radius must be positive");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
$this->force = $force;
|
||||
}
|
||||
|
||||
public function getForce() : float{
|
||||
|
Reference in New Issue
Block a user