mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
event: modernize property declarations where possible
only private fields are modified; protected ones can't be changed in case someone extended the classes
This commit is contained in:
@ -33,11 +33,11 @@ use pocketmine\event\CancellableTrait;
|
||||
abstract class BaseBlockChangeEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
private Block $newState;
|
||||
|
||||
public function __construct(Block $block, Block $newState){
|
||||
public function __construct(
|
||||
Block $block,
|
||||
private Block $newState
|
||||
){
|
||||
parent::__construct($block);
|
||||
$this->newState = $newState;
|
||||
}
|
||||
|
||||
public function getNewState() : Block{
|
||||
|
@ -33,12 +33,11 @@ use pocketmine\event\CancellableTrait;
|
||||
class BlockBurnEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/** @var Block */
|
||||
private $causingBlock;
|
||||
|
||||
public function __construct(Block $block, Block $causingBlock){
|
||||
public function __construct(
|
||||
Block $block,
|
||||
private Block $causingBlock
|
||||
){
|
||||
parent::__construct($block);
|
||||
$this->causingBlock = $causingBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,12 +29,13 @@ use pocketmine\block\Block;
|
||||
* Called when a block spreads to another block, such as grass spreading to nearby dirt blocks.
|
||||
*/
|
||||
class BlockSpreadEvent extends BaseBlockChangeEvent{
|
||||
/** @var Block */
|
||||
private $source;
|
||||
|
||||
public function __construct(Block $block, Block $source, Block $newState){
|
||||
public function __construct(
|
||||
Block $block,
|
||||
private Block $source,
|
||||
Block $newState
|
||||
){
|
||||
parent::__construct($block, $newState);
|
||||
$this->source = $source;
|
||||
}
|
||||
|
||||
public function getSource() : Block{
|
||||
|
@ -32,12 +32,11 @@ use pocketmine\utils\Utils;
|
||||
class BlockTeleportEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/** @var Vector3 */
|
||||
private $to;
|
||||
|
||||
public function __construct(Block $block, Vector3 $to){
|
||||
public function __construct(
|
||||
Block $block,
|
||||
private Vector3 $to
|
||||
){
|
||||
parent::__construct($block);
|
||||
$this->to = $to;
|
||||
}
|
||||
|
||||
public function getTo() : Vector3{
|
||||
|
@ -35,20 +35,12 @@ use pocketmine\player\Player;
|
||||
class SignChangeEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/** @var BaseSign */
|
||||
private $sign;
|
||||
|
||||
/** @var Player */
|
||||
private $player;
|
||||
|
||||
/** @var SignText */
|
||||
private $text;
|
||||
|
||||
public function __construct(BaseSign $sign, Player $player, SignText $text){
|
||||
public function __construct(
|
||||
private BaseSign $sign,
|
||||
private Player $player,
|
||||
private SignText $text
|
||||
){
|
||||
parent::__construct($sign);
|
||||
$this->sign = $sign;
|
||||
$this->player = $player;
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
public function getSign() : BaseSign{
|
||||
|
@ -17,13 +17,12 @@ use pocketmine\world\BlockTransaction;
|
||||
class StructureGrowEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
private BlockTransaction $transaction;
|
||||
private ?Player $player;
|
||||
|
||||
public function __construct(Block $block, BlockTransaction $transaction, ?Player $player){
|
||||
public function __construct(
|
||||
Block $block,
|
||||
private BlockTransaction $transaction,
|
||||
private ?Player $player
|
||||
){
|
||||
parent::__construct($block);
|
||||
$this->transaction = $transaction;
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
public function getTransaction() : BlockTransaction{
|
||||
|
Reference in New Issue
Block a user