Move Event cancellable parts to trait

This commit is contained in:
Dylan K. Taylor
2019-01-16 22:14:25 +00:00
parent 2e7e56de1e
commit 38afe22b79
64 changed files with 225 additions and 35 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine\event\block;
use pocketmine\block\Block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\item\Item;
use pocketmine\Player;
@ -32,6 +33,8 @@ use pocketmine\Player;
* Called when a player destroys a block somewhere in the world.
*/
class BlockBreakEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Player */
protected $player;

View File

@ -25,11 +25,14 @@ namespace pocketmine\event\block;
use pocketmine\block\Block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
/**
* Called when a block is burned away by fire.
*/
class BlockBurnEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Block */
private $causingBlock;

View File

@ -25,11 +25,14 @@ namespace pocketmine\event\block;
use pocketmine\block\Block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
/**
* Called when plants or crops grow.
*/
class BlockGrowEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Block */
private $newState;

View File

@ -25,6 +25,7 @@ namespace pocketmine\event\block;
use pocketmine\block\Block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\item\Item;
use pocketmine\Player;
@ -32,6 +33,8 @@ use pocketmine\Player;
* Called when a player places a block
*/
class BlockPlaceEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Player */
protected $player;

View File

@ -24,10 +24,11 @@ declare(strict_types=1);
namespace pocketmine\event\block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
/**
* Called when a block tries to be updated due to a neighbor change
*/
class BlockUpdateEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
}

View File

@ -24,10 +24,11 @@ declare(strict_types=1);
namespace pocketmine\event\block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
/**
* Called when leaves decay due to not being attached to wood.
*/
class LeavesDecayEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
}

View File

@ -25,6 +25,7 @@ namespace pocketmine\event\block;
use pocketmine\block\Block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\Player;
use function count;
@ -32,6 +33,8 @@ use function count;
* Called when a sign is changed by a player.
*/
class SignChangeEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Player */
private $player;
/** @var string[] */