Class ProjectileSender

java.lang.Object
de.eldoria.eldoutilities.entities.projectiles.ProjectileSender

public class ProjectileSender extends Object
A class which represends a result used by ProjectileUtil.getProjectileSource(Entity).
Since:
1.0.0
  • Constructor Details

    • ProjectileSender

      public ProjectileSender(Entity entity)
      Create a new projectile send with a entity
      Parameters:
      entity - entity which is the sender
    • ProjectileSender

      public ProjectileSender(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

      public void ifEntity(Consumer<Entity> entity)
      If an entity is present, perform the given operation on it.
      Parameters:
      entity - the operation to be performed on the entity
    • ifBlock

      public void ifBlock(Consumer<Block> entity)
      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() and isEntity() is false. otherwise true
    • getEntity

      public Entity getEntity()
      Get the sender as entity.
      Returns:
      Will be null if isEntity() is false.
    • getBlock

      public Block getBlock()
      Get the sender as block.
      Returns:
      Will be null if isBlock() ()} is false.
    • getEntityType

      public EntityType getEntityType() throws NullPointerException
      Get the sender as EntityType.
      Returns:
      entity type of sender
      Throws:
      NullPointerException - When isEntity() is false
    • getBlockType

      public Material getBlockType() throws NullPointerException
      Get the sender as Material.
      Returns:
      material of sender
      Throws:
      NullPointerException - When isEntity() is false