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 Summary

    Constructors
    Constructor
    Description
    Empty projectile sender
    ProjectileSender(org.bukkit.block.Block block)
    Create a new projectile send with a block
    ProjectileSender(org.bukkit.entity.Entity entity)
    Create a new projectile send with a entity
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.block.Block
    Get the sender as block.
    org.bukkit.Material
    Get the sender as Material.
    org.bukkit.entity.Entity
    Get the sender as entity.
    org.bukkit.entity.EntityType
    Get the sender as EntityType.
    void
    ifBlock(Consumer<org.bukkit.block.Block> entity)
    Executes the given consumer if a block is present.
    void
    ifEntity(Consumer<org.bukkit.entity.Entity> entity)
    If an entity is present, perform the given operation on it.
    boolean
    Check if a block is present.
    boolean
    Check if the sender is empty.
    boolean
    Checks if an entity is present.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public void ifEntity(Consumer<org.bukkit.entity.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<org.bukkit.block.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 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

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

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