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
ConstructorsConstructorDescriptionEmpty projectile senderProjectileSender(org.bukkit.block.Block block) Create a new projectile send with a blockProjectileSender(org.bukkit.entity.Entity entity) Create a new projectile send with a entity -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.block.BlockgetBlock()Get the sender as block.org.bukkit.MaterialGet the sender asMaterial.org.bukkit.entity.EntityGet the sender as entity.org.bukkit.entity.EntityTypeGet the sender asEntityType.voidExecutes the given consumer if a block is present.voidIf an entity is present, perform the given operation on it.booleanisBlock()Check if a block is present.booleanisEmpty()Check if the sender is empty.booleanisEntity()Checks if an entity is present.
-
Constructor Details
-
ProjectileSender
public ProjectileSender(org.bukkit.entity.Entity entity) Create a new projectile send with a entity- Parameters:
entity- entity which is the sender
-
ProjectileSender
public ProjectileSender(org.bukkit.block.Block block) 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
public org.bukkit.entity.Entity getEntity()Get the sender as entity.- Returns:
- Will be null if
isEntity()is false.
-
getBlock
public org.bukkit.block.Block 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
-