Class ProjectileSender
java.lang.Object
de.eldoria.eldoutilities.entities.projectiles.ProjectileSender
A class which represends a result used by
ProjectileUtil.getProjectileSource(Entity)
.- Since:
- 1.0.0
-
Constructor Summary
ConstructorDescriptionEmpty projectile senderProjectileSender
(Block block) Create a new projectile send with a blockProjectileSender
(Entity entity) Create a new projectile send with a entity -
Method Summary
Modifier and TypeMethodDescriptiongetBlock()
Get the sender as block.Get the sender asMaterial
.Get the sender as entity.Get the sender asEntityType
.void
Executes the given consumer if a block is present.void
If an entity is present, perform the given operation on it.boolean
isBlock()
Check if a block is present.boolean
isEmpty()
Check if the sender is empty.boolean
isEntity()
Checks if an entity is present.
-
Constructor Details
-
ProjectileSender
Create a new projectile send with a entity- Parameters:
entity
- entity which is the sender
-
ProjectileSender
Create a new projectile send with a block- Parameters:
block
- block which send the projectile
-
ProjectileSender
public ProjectileSender()Empty projectile sender
-
-
Method Details
-
ifEntity
If an entity is present, perform the given operation on it.- Parameters:
entity
- the operation to be performed on the entity
-
ifBlock
Executes the given consumer if a block is present.- Parameters:
entity
- the consumer to be executed if a block is present.
-
isEntity
public boolean isEntity()Checks if an entity is present.- Returns:
- true if the sender is a entity
-
isBlock
public boolean isBlock()Check if a block is present.- Returns:
- true if the sender is a block
-
isEmpty
public boolean isEmpty()Check if the sender is empty.- Returns:
- false if
isBlock()
andisEntity()
is false. otherwise true
-
getEntity
Get the sender as entity.- Returns:
- Will be null if
isEntity()
is false.
-
getBlock
Get the sender as block.- Returns:
- Will be null if
isBlock()
()} is false.
-
getEntityType
Get the sender asEntityType
.- Returns:
- entity type of sender
- Throws:
NullPointerException
- WhenisEntity()
is false
-
getBlockType
Get the sender asMaterial
.- Returns:
- material of sender
- Throws:
NullPointerException
- WhenisEntity()
is false
-