Class ArrowStateManager

java.lang.Object
wtf.choco.arrows.registry.ArrowStateManager

public final class ArrowStateManager
extends Object
Handles the in-world entities for AlchemicalArrow types. All alchemical arrows in the world have an associated AlchemicalArrowEntity registered in this state manager so long as they are still valid according to Entity.isValid().
Author:
Parker Hawke - Choco
  • Constructor Details

    • ArrowStateManager

      public ArrowStateManager()
  • Method Details

    • add

      public void add​(@NotNull @NotNull AlchemicalArrowEntity arrow)
      Add an AlchemicalArrowEntity to the state manager.
      Parameters:
      arrow - the arrow to add
    • remove

      public void remove​(@NotNull @NotNull AlchemicalArrowEntity arrow)
      Remove an AlchemicalArrowEntity from the state manager.
      Parameters:
      arrow - the arrow to remove
    • remove

      public void remove​(@NotNull @NotNull org.bukkit.entity.Arrow arrow)
      Remove an Arrow (and therefore its associated AlchemicalArrowEntity, if one exists) from the state manager.
      Parameters:
      arrow - the arrow to remove
    • get

      @Nullable public @Nullable AlchemicalArrowEntity get​(@Nullable @Nullable org.bukkit.entity.Arrow arrow)
      Get the AlchemicalArrowEntity associated with the provided Arrow.
      Parameters:
      arrow - the Bukkit arrow from which to get an alchemical arrow
      Returns:
      an instance of the alchemical arrow entity. null if not stated
    • get

      @Nullable public @Nullable AlchemicalArrowEntity get​(@Nullable @Nullable UUID uuid)
      Get the AlchemicalArrowEntity associated with the provided UUID.
      Parameters:
      uuid - the UUID of the arrow from which to get an alchemical arrow
      Returns:
      an instance of the alchemical arrow entity. null if none
    • getArrows

      @NotNull public @NotNull Collection<AlchemicalArrowEntity> getArrows()
      Get a copied collection of all AlchemicalArrowEntity states in the manager. Changes made to the returned collection will not affect the state manager.
      Returns:
      all actively stated arrows
    • getArrows

      @NotNull public @NotNull Collection<AlchemicalArrowEntity> getArrows​(@NotNull @NotNull org.bukkit.World world)
      Get an unmodifiable collection of all AlchemicalArrowEntity states in the specified world.
      Parameters:
      world - the world from which to query arrows
      Returns:
      all actively stated arrows in the specified world
    • getArrows

      @NotNull public <T extends AlchemicalArrowEntity> @NotNull Collection<T> getArrows​(@NotNull @NotNull Class<T> type)
      Get an unmodifiable collection of all AlchemicalArrowEntity states of the specified arrow entity type.
      Type Parameters:
      T - the arrow entity type
      Parameters:
      type - the type of arrows to get
      Returns:
      all actively stated arrows of the specified type
      See Also:
      getArrowsOfType(Class)
    • getArrowsOfType

      @NotNull public @NotNull Collection<AlchemicalArrowEntity> getArrowsOfType​(@NotNull @NotNull Class<? extends AlchemicalArrow> type)
      Get an unmodifiable collection of all AlchemicalArrowEntity states of the specified AlchemicalArrow type.
      Parameters:
      type - the type of arrows to get
      Returns:
      all actively stated arrows of the specified type
      See Also:
      getArrows(Class)
    • clear

      public void clear()
      Clears the state manager.