Class AlchemicalArrow

    • Constructor Detail

      • AlchemicalArrow

        public AlchemicalArrow()
    • Method Detail

      • getDisplayName

        @NotNull
        public abstract @NotNull String getDisplayName()
        Get the display name of this alchemical arrow. This includes colour codes and formatting. The returned String should be expected in messages sent to players
        Returns:
        the arrow's display name
      • getItem

        @NotNull
        public abstract @NotNull org.bukkit.inventory.ItemStack getItem()
        Get the item representation of this alchemical arrow. The type must be of Material.ARROW and unique to this type, otherwise an exception will be thrown. If this item is present in the player's inventory whilst attempting to shoot a bot, this arrow type will be used instead of a regular arrow.
        Returns:
        the arrow item
      • getProperties

        @NotNull
        public final @NotNull PropertyMap getProperties()
        Get a map containing all properties for this arrow
        Returns:
        the arrow properties
      • tick

        public void tick​(@NotNull
                         @NotNull AlchemicalArrowEntity arrow,
                         @NotNull
                         @NotNull org.bukkit.Location location)
        Called 20 times every second. This method is intended for displaying particles around the arrow, performing tasks whilst the arrow is still in the world, etc.
        Parameters:
        arrow - the alchemical arrow entity instance
        location - the arrow's current location at this tick
      • onHitBlock

        public void onHitBlock​(@NotNull
                               @NotNull AlchemicalArrowEntity arrow,
                               @NotNull
                               @NotNull org.bukkit.block.Block block)
        Called when the arrow hits a solid block
        Parameters:
        arrow - the alchemical arrow entity instance
        block - the block on which the arrow landed
      • onHitPlayer

        public void onHitPlayer​(@NotNull
                                @NotNull AlchemicalArrowEntity arrow,
                                @NotNull
                                @NotNull org.bukkit.entity.Player player)
        Called when the arrow hits a player
        Parameters:
        arrow - the alchemical arrow entity instance
        player - the player damaged by the arrow
      • onHitEntity

        public void onHitEntity​(@NotNull
                                @NotNull AlchemicalArrowEntity arrow,
                                @NotNull
                                @NotNull org.bukkit.entity.Entity entity)
        Called when the arrow hits an entity (this excludes Players. For Players, see onHitPlayer(AlchemicalArrowEntity, Player))
        Parameters:
        arrow - the alchemical arrow entity instance
        entity - the entity damaged by the arrow
      • onShootFromPlayer

        public boolean onShootFromPlayer​(@NotNull
                                         @NotNull AlchemicalArrowEntity arrow,
                                         @NotNull
                                         @NotNull org.bukkit.entity.Player player)
        Called at low priority when a player has successfully shot this alchemical arrow, but it has yet to be registered. Such that this method returns true, the alchemical arrow will be launched
        Parameters:
        arrow - the alchemical arrow entity instance
        player - the player that shot the arrow
        Returns:
        whether the shot should be permitted or not
      • onShootFromSkeleton

        public boolean onShootFromSkeleton​(@NotNull
                                           @NotNull AlchemicalArrowEntity arrow,
                                           @NotNull
                                           @NotNull org.bukkit.entity.Skeleton skeleton)
        Called at a low priority when a Skeleton successfully shoots an arrow, but it has yet to be registered. Such that this method returns true, the alchemical arrow will be launched. The ArrowProperty.SKELETONS_CAN_SHOOT property must return true in order for this method to be invoked
        Parameters:
        arrow - the alchemical arrow entity instance
        skeleton - the skeleton that shot the arrow
        Returns:
        whether the shot should be permitted or not
      • onShootFromBlockSource

        public boolean onShootFromBlockSource​(@NotNull
                                              @NotNull AlchemicalArrowEntity arrow,
                                              @NotNull
                                              @NotNull org.bukkit.projectiles.BlockProjectileSource source)
        Called at a low priority when a BlockProjectileSource (i.e. Dispenser) shoots an arrow, but it has yet to be registered. Such that this method returns true, the alchemical arrow will be launched
        Parameters:
        arrow - the alchemical arrow entity instance
        source - the block source that shot the arrow
        Returns:
        whether the shot should be permitted or not
      • hitGroundEventHandler

        public void hitGroundEventHandler​(@NotNull
                                          @NotNull AlchemicalArrowEntity arrow,
                                          @NotNull
                                          @NotNull org.bukkit.event.entity.ProjectileHitEvent event)
        Called the instant before onHitBlock(AlchemicalArrowEntity, Block) is called. Used to cancel events if necessary
        Parameters:
        arrow - the alchemical arrow entity instance
        event - the ProjectileHitEvent source
      • createNewArrow

        @NotNull
        public @NotNull AlchemicalArrowEntity createNewArrow​(@NotNull
                                                             @NotNull org.bukkit.entity.Arrow arrow)
        Create a new instance of an AlchemicalArrowEntity. If a custom AlchemicalArrowEntity implementation is used, this method must be overridden to return a custom instance of it. Under no circumstance should additional, non-arrow entity-related code be executed in an overridden implementation of this method. For additional logic, see AlchemicalArrow's various methods and override them where required
        Parameters:
        arrow - the Bukkit Arrow instance from which to create an AlchemicalArrowEntity
        Returns:
        the new AlchemicalArrowEntity instance of this implementation
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object