Package wtf.choco.arrows.registry
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 Summary
Constructors Constructor Description ArrowStateManager() -
Method Summary
Modifier and Type Method Description voidadd(@NotNull AlchemicalArrowEntity arrow)Add anAlchemicalArrowEntityto the state manager.voidclear()Clears the state manager.@Nullable AlchemicalArrowEntityget(@Nullable UUID uuid)Get theAlchemicalArrowEntityassociated with the providedUUID.@Nullable AlchemicalArrowEntityget(@Nullable org.bukkit.entity.Arrow arrow)Get theAlchemicalArrowEntityassociated with the providedArrow.@NotNull Collection<AlchemicalArrowEntity>getArrows()Get a copied collection of allAlchemicalArrowEntitystates in the manager.<T extends AlchemicalArrowEntity>
@NotNull Collection<T>getArrows(@NotNull Class<T> type)Get an unmodifiable collection of allAlchemicalArrowEntitystates of the specified arrow entity type.@NotNull Collection<AlchemicalArrowEntity>getArrows(@NotNull org.bukkit.World world)Get an unmodifiable collection of allAlchemicalArrowEntitystates in the specified world.@NotNull Collection<AlchemicalArrowEntity>getArrowsOfType(@NotNull Class<? extends AlchemicalArrow> type)Get an unmodifiable collection of allAlchemicalArrowEntitystates of the specifiedAlchemicalArrowtype.voidremove(@NotNull org.bukkit.entity.Arrow arrow)Remove anArrow(and therefore its associatedAlchemicalArrowEntity, if one exists) from the state manager.voidremove(@NotNull AlchemicalArrowEntity arrow)Remove anAlchemicalArrowEntityfrom the state manager.
-
Constructor Details
-
ArrowStateManager
public ArrowStateManager()
-
-
Method Details
-
add
Add anAlchemicalArrowEntityto the state manager.- Parameters:
arrow- the arrow to add
-
remove
Remove anAlchemicalArrowEntityfrom the state manager.- Parameters:
arrow- the arrow to remove
-
remove
public void remove(@NotNull @NotNull org.bukkit.entity.Arrow arrow)Remove anArrow(and therefore its associatedAlchemicalArrowEntity, 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 theAlchemicalArrowEntityassociated with the providedArrow.- 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
Get theAlchemicalArrowEntityassociated with the providedUUID.- 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
Get a copied collection of allAlchemicalArrowEntitystates 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 allAlchemicalArrowEntitystates 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 allAlchemicalArrowEntitystates 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 allAlchemicalArrowEntitystates of the specifiedAlchemicalArrowtype.- 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.
-