Remove garbage from Entity(De)SpawnEvent

These methods:
a) add concrete dependencies
b) are pointless (event->getEntity() instanceof Creature, anyone? an IDE can better understand this as well...)
c) encourage bad code (they don't enforce type contracts the same way an instanceof check does - oh, and why not let's add an is*() for every new mob that gets added ever?
This commit is contained in:
Dylan K. Taylor 2018-10-12 16:35:51 +01:00
parent 97c836f199
commit acb794e728
2 changed files with 0 additions and 88 deletions

View File

@ -23,12 +23,7 @@ declare(strict_types=1);
namespace pocketmine\event\entity; namespace pocketmine\event\entity;
use pocketmine\entity\Creature;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
use pocketmine\entity\Human;
use pocketmine\entity\object\ItemEntity;
use pocketmine\entity\projectile\Projectile;
use pocketmine\entity\Vehicle;
/** /**
* Called when a entity is despawned * Called when a entity is despawned
@ -41,39 +36,4 @@ class EntityDespawnEvent extends EntityEvent{
public function __construct(Entity $entity){ public function __construct(Entity $entity){
$this->entity = $entity; $this->entity = $entity;
} }
/**
* @return bool
*/
public function isCreature() : bool{
return $this->entity instanceof Creature;
}
/**
* @return bool
*/
public function isHuman() : bool{
return $this->entity instanceof Human;
}
/**
* @return bool
*/
public function isProjectile() : bool{
return $this->entity instanceof Projectile;
}
/**
* @return bool
*/
public function isVehicle() : bool{
return $this->entity instanceof Vehicle;
}
/**
* @return bool
*/
public function isItem() : bool{
return $this->entity instanceof ItemEntity;
}
} }

View File

@ -23,13 +23,7 @@ declare(strict_types=1);
namespace pocketmine\event\entity; namespace pocketmine\event\entity;
use pocketmine\entity\Creature;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
use pocketmine\entity\Human;
use pocketmine\entity\object\ItemEntity;
use pocketmine\entity\projectile\Projectile;
use pocketmine\entity\Vehicle;
use pocketmine\level\Position;
/** /**
* Called when a entity is spawned * Called when a entity is spawned
@ -42,46 +36,4 @@ class EntitySpawnEvent extends EntityEvent{
public function __construct(Entity $entity){ public function __construct(Entity $entity){
$this->entity = $entity; $this->entity = $entity;
} }
/**
* @return Position
*/
public function getPosition() : Position{
return $this->entity->getPosition();
}
/**
* @return bool
*/
public function isCreature() : bool{
return $this->entity instanceof Creature;
}
/**
* @return bool
*/
public function isHuman() : bool{
return $this->entity instanceof Human;
}
/**
* @return bool
*/
public function isProjectile() : bool{
return $this->entity instanceof Projectile;
}
/**
* @return bool
*/
public function isVehicle() : bool{
return $this->entity instanceof Vehicle;
}
/**
* @return bool
*/
public function isItem() : bool{
return $this->entity instanceof ItemEntity;
}
} }