mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Apply nullable and void typehints to events namespace
This commit is contained in:
parent
cfb10360ff
commit
eb0276d459
@ -59,7 +59,7 @@ abstract class Event{
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function setCancelled(bool $value = true){
|
||||
public function setCancelled(bool $value = true) : void{
|
||||
if(!($this instanceof Cancellable)){
|
||||
throw new \BadMethodCallException("Event is not Cancellable");
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
|
||||
/**
|
||||
* @param bool $instaBreak
|
||||
*/
|
||||
public function setInstaBreak(bool $instaBreak){
|
||||
public function setInstaBreak(bool $instaBreak) : void{
|
||||
$this->instaBreak = $instaBreak;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
|
||||
/**
|
||||
* @param Item[] $drops
|
||||
*/
|
||||
public function setDrops(array $drops){
|
||||
public function setDrops(array $drops) : void{
|
||||
$this->setDropsVariadic(...$drops);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
|
||||
*
|
||||
* @param Item ...$drops
|
||||
*/
|
||||
public function setDropsVariadic(Item ...$drops){
|
||||
public function setDropsVariadic(Item ...$drops) : void{
|
||||
$this->blockDrops = $drops;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class SignChangeEvent extends BlockEvent implements Cancellable{
|
||||
*
|
||||
* @throws \InvalidArgumentException if there are more or less than 4 lines in the passed array
|
||||
*/
|
||||
public function setLines(array $lines){
|
||||
public function setLines(array $lines) : void{
|
||||
if(count($lines) !== 4){
|
||||
throw new \InvalidArgumentException("Array size must be 4!");
|
||||
}
|
||||
@ -94,7 +94,7 @@ class SignChangeEvent extends BlockEvent implements Cancellable{
|
||||
*
|
||||
* @throws \InvalidArgumentException if the index is out of bounds
|
||||
*/
|
||||
public function setLine(int $index, string $line){
|
||||
public function setLine(int $index, string $line) : void{
|
||||
if($index < 0 or $index > 3){
|
||||
throw new \InvalidArgumentException("Index must be in the range 0-3!");
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class EntityCombustEvent extends EntityEvent implements Cancellable{
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
public function setDuration(int $duration){
|
||||
public function setDuration(int $duration) : void{
|
||||
$this->duration = $duration;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class EntityDamageByChildEntityEvent extends EntityDamageByEntityEvent{
|
||||
*
|
||||
* @return Entity|null
|
||||
*/
|
||||
public function getChild(){
|
||||
public function getChild() : ?Entity{
|
||||
return $this->getEntity()->getLevel()->getServer()->findEntity($this->childEntityEid, $this->getEntity()->getLevel());
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
|
||||
$this->addAttackerModifiers($damager);
|
||||
}
|
||||
|
||||
protected function addAttackerModifiers(Entity $damager){
|
||||
protected function addAttackerModifiers(Entity $damager) : void{
|
||||
if($damager instanceof Living){ //TODO: move this to entity classes
|
||||
if($damager->hasEffect(Effect::STRENGTH)){
|
||||
$this->setModifier($this->getBaseDamage() * 0.3 * $damager->getEffect(Effect::STRENGTH)->getEffectLevel(), self::MODIFIER_STRENGTH);
|
||||
@ -68,7 +68,7 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
|
||||
*
|
||||
* @return Entity|null
|
||||
*/
|
||||
public function getDamager(){
|
||||
public function getDamager() : ?Entity{
|
||||
return $this->getEntity()->getLevel()->getServer()->findEntity($this->damagerEntityId, $this->getEntity()->getLevel());
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
|
||||
/**
|
||||
* @param float $knockBack
|
||||
*/
|
||||
public function setKnockBack(float $knockBack){
|
||||
public function setKnockBack(float $knockBack) : void{
|
||||
$this->knockBack = $knockBack;
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
|
||||
* @param float $damage
|
||||
* @param int $type
|
||||
*/
|
||||
public function setModifier(float $damage, int $type){
|
||||
public function setModifier(float $damage, int $type) : void{
|
||||
$this->modifiers[$type] = $damage;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class EntityDeathEvent extends EntityEvent{
|
||||
/**
|
||||
* @param Item[] $drops
|
||||
*/
|
||||
public function setDrops(array $drops){
|
||||
public function setDrops(array $drops) : void{
|
||||
$this->drops = $drops;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class EntityEffectAddEvent extends EntityEffectEvent{
|
||||
/**
|
||||
* @return EffectInstance|null
|
||||
*/
|
||||
public function getOldEffect(){
|
||||
public function getOldEffect() : ?EffectInstance{
|
||||
return $this->oldEffect;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace pocketmine\event\entity;
|
||||
* Called when an effect is removed from an entity.
|
||||
*/
|
||||
class EntityEffectRemoveEvent extends EntityEffectEvent{
|
||||
public function setCancelled(bool $value = true){
|
||||
public function setCancelled(bool $value = true) : void{
|
||||
if($this->getEffect()->getDuration() <= 0){
|
||||
throw new \InvalidStateException("Removal of expired effects cannot be cancelled");
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param Block[] $blocks
|
||||
*/
|
||||
public function setBlockList(array $blocks){
|
||||
public function setBlockList(array $blocks) : void{
|
||||
$this->blocks = $blocks;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param float $yield
|
||||
*/
|
||||
public function setYield(float $yield){
|
||||
public function setYield(float $yield) : void{
|
||||
$this->yield = $yield;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class EntityInventoryChangeEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param Item $item
|
||||
*/
|
||||
public function setNewItem(Item $item){
|
||||
public function setNewItem(Item $item) : void{
|
||||
$this->newItem = $item;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class EntityRegainHealthEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param float $amount
|
||||
*/
|
||||
public function setAmount(float $amount){
|
||||
public function setAmount(float $amount) : void{
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class EntityShootBowEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param Entity $projectile
|
||||
*/
|
||||
public function setProjectile(Entity $projectile){
|
||||
public function setProjectile(Entity $projectile) : void{
|
||||
if($projectile !== $this->projectile){
|
||||
if(count($this->projectile->getViewers()) === 0){
|
||||
$this->projectile->close();
|
||||
@ -97,7 +97,7 @@ class EntityShootBowEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param float $force
|
||||
*/
|
||||
public function setForce(float $force){
|
||||
public function setForce(float $force) : void{
|
||||
$this->force = $force;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class EntityTeleportEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param Position $to
|
||||
*/
|
||||
public function setTo(Position $to){
|
||||
public function setTo(Position $to) : void{
|
||||
$this->to = $to;
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
|
||||
return $this->force;
|
||||
}
|
||||
|
||||
public function setForce(float $force){
|
||||
public function setForce(float $force) : void{
|
||||
$this->force = $force;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
|
||||
/**
|
||||
* @param bool $affectsBlocks
|
||||
*/
|
||||
public function setBlockBreaking(bool $affectsBlocks){
|
||||
public function setBlockBreaking(bool $affectsBlocks) : void{
|
||||
$this->blockBreaking = $affectsBlocks;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class FurnaceBurnEvent extends BlockEvent implements Cancellable{
|
||||
/**
|
||||
* @param int $burnTime
|
||||
*/
|
||||
public function setBurnTime(int $burnTime){
|
||||
public function setBurnTime(int $burnTime) : void{
|
||||
$this->burnTime = $burnTime;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ class FurnaceBurnEvent extends BlockEvent implements Cancellable{
|
||||
/**
|
||||
* @param bool $burning
|
||||
*/
|
||||
public function setBurning(bool $burning){
|
||||
public function setBurning(bool $burning) : void{
|
||||
$this->burning = $burning;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class FurnaceSmeltEvent extends BlockEvent implements Cancellable{
|
||||
/**
|
||||
* @param Item $result
|
||||
*/
|
||||
public function setResult(Item $result){
|
||||
public function setResult(Item $result) : void{
|
||||
$this->result = $result;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ abstract class PlayerBucketEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param Item $item
|
||||
*/
|
||||
public function setItem(Item $item){
|
||||
public function setItem(Item $item) : void{
|
||||
$this->item = $item;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function setMessage(string $message){
|
||||
public function setMessage(string $message) : void{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{
|
||||
*
|
||||
* @param Player $player
|
||||
*/
|
||||
public function setPlayer(Player $player){
|
||||
public function setPlayer(Player $player) : void{
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $format
|
||||
*/
|
||||
public function setFormat(string $format){
|
||||
public function setFormat(string $format) : void{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param Player[] $recipients
|
||||
*/
|
||||
public function setRecipients(array $recipients){
|
||||
public function setRecipients(array $recipients) : void{
|
||||
$this->recipients = $recipients;
|
||||
}
|
||||
}
|
||||
|
@ -58,14 +58,14 @@ class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function setMessage(string $message){
|
||||
public function setMessage(string $message) : void{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
*/
|
||||
public function setPlayer(Player $player){
|
||||
public function setPlayer(Player $player) : void{
|
||||
$this->player = $player;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class PlayerDataSaveEvent extends Event implements Cancellable{
|
||||
/**
|
||||
* @param CompoundTag $data
|
||||
*/
|
||||
public function setSaveData(CompoundTag $data){
|
||||
public function setSaveData(CompoundTag $data) : void{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class PlayerDeathEvent extends EntityDeathEvent{
|
||||
/**
|
||||
* @param TextContainer|string $deathMessage
|
||||
*/
|
||||
public function setDeathMessage($deathMessage){
|
||||
public function setDeathMessage($deathMessage) : void{
|
||||
$this->deathMessage = $deathMessage;
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ class PlayerDeathEvent extends EntityDeathEvent{
|
||||
return $this->keepInventory;
|
||||
}
|
||||
|
||||
public function setKeepInventory(bool $keepInventory){
|
||||
public function setKeepInventory(bool $keepInventory) : void{
|
||||
$this->keepInventory = $keepInventory;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class PlayerExhaustEvent extends EntityEvent implements Cancellable{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
public function setAmount(float $amount){
|
||||
public function setAmount(float $amount) : void{
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class PlayerJoinEvent extends PlayerEvent{
|
||||
/**
|
||||
* @param string|TextContainer $joinMessage
|
||||
*/
|
||||
public function setJoinMessage($joinMessage){
|
||||
public function setJoinMessage($joinMessage) : void{
|
||||
$this->joinMessage = $joinMessage;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class PlayerKickEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param TextContainer|string $quitMessage
|
||||
*/
|
||||
public function setQuitMessage($quitMessage){
|
||||
public function setQuitMessage($quitMessage) : void{
|
||||
$this->quitMessage = $quitMessage;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class PlayerLoginEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $kickMessage
|
||||
*/
|
||||
public function setKickMessage(string $kickMessage){
|
||||
public function setKickMessage(string $kickMessage) : void{
|
||||
$this->kickMessage = $kickMessage;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ class PlayerMoveEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param Location $to
|
||||
*/
|
||||
public function setTo(Location $to){
|
||||
public function setTo(Location $to) : void{
|
||||
$this->to = $to;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class PlayerPreLoginEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $kickMessage
|
||||
*/
|
||||
public function setKickMessage(string $kickMessage){
|
||||
public function setKickMessage(string $kickMessage) : void{
|
||||
$this->kickMessage = $kickMessage;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class PlayerQuitEvent extends PlayerEvent{
|
||||
/**
|
||||
* @param TranslationContainer|string $quitMessage
|
||||
*/
|
||||
public function setQuitMessage($quitMessage){
|
||||
public function setQuitMessage($quitMessage) : void{
|
||||
$this->quitMessage = $quitMessage;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class PlayerRespawnEvent extends PlayerEvent{
|
||||
/**
|
||||
* @param Position $position
|
||||
*/
|
||||
public function setRespawnPosition(Position $position){
|
||||
public function setRespawnPosition(Position $position) : void{
|
||||
$this->position = $position;
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class PlayerTransferEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $address
|
||||
*/
|
||||
public function setAddress(string $address){
|
||||
public function setAddress(string $address) : void{
|
||||
$this->address = $address;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ class PlayerTransferEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param int $port
|
||||
*/
|
||||
public function setPort(int $port){
|
||||
public function setPort(int $port) : void{
|
||||
$this->port = $port;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ class PlayerTransferEvent extends PlayerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function setMessage(string $message){
|
||||
public function setMessage(string $message) : void{
|
||||
$this->message = $message;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param int $timeout
|
||||
*/
|
||||
public function setTimeout(int $timeout){
|
||||
public function setTimeout(int $timeout) : void{
|
||||
$this->timeout = $timeout;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param string $serverName
|
||||
*/
|
||||
public function setServerName(string $serverName){
|
||||
public function setServerName(string $serverName) : void{
|
||||
$this->serverName = $serverName;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setListPlugins(bool $value){
|
||||
public function setListPlugins(bool $value) : void{
|
||||
$this->listPlugins = $value;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param Plugin[] $plugins
|
||||
*/
|
||||
public function setPlugins(array $plugins){
|
||||
public function setPlugins(array $plugins) : void{
|
||||
$this->plugins = $plugins;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param Player[] $players
|
||||
*/
|
||||
public function setPlayerList(array $players){
|
||||
public function setPlayerList(array $players) : void{
|
||||
$this->players = $players;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param int $count
|
||||
*/
|
||||
public function setPlayerCount(int $count){
|
||||
public function setPlayerCount(int $count) : void{
|
||||
$this->numPlayers = $count;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param int $count
|
||||
*/
|
||||
public function setMaxPlayerCount(int $count){
|
||||
public function setMaxPlayerCount(int $count) : void{
|
||||
$this->maxPlayers = $count;
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param string $world
|
||||
*/
|
||||
public function setWorld(string $world){
|
||||
public function setWorld(string $world) : void{
|
||||
$this->map = $world;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ class QueryRegenerateEvent extends ServerEvent{
|
||||
/**
|
||||
* @param array $extraData
|
||||
*/
|
||||
public function setExtraData(array $extraData){
|
||||
public function setExtraData(array $extraData) : void{
|
||||
$this->extraData = $extraData;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ class ServerCommandEvent extends ServerEvent implements Cancellable{
|
||||
/**
|
||||
* @param string $command
|
||||
*/
|
||||
public function setCommand(string $command){
|
||||
public function setCommand(string $command) : void{
|
||||
$this->command = $command;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user