Class FlockMembershipSystems

java.lang.Object
com.hypixel.hytale.server.flock.FlockMembershipSystems

public class FlockMembershipSystems extends Object
A class that contains a variety of flock-related systems for managing flock membership.
  • Constructor Details

    • FlockMembershipSystems

      public FlockMembershipSystems()
  • Method Details

    • canJoinFlock

      public static boolean canJoinFlock(@Nonnull Ref<EntityStore> reference, @Nonnull Ref<EntityStore> flockReference, @Nonnull Store<EntityStore> store)
      A helper method for checking if a given entity is allowed to join the specified flock.

      The specific criteria checked include max flock size and whether the entity belongs to the list of allowed roles based on the current leader.

      Note that calling join(Ref, Ref, Store) will ignore these checks so they should be done beforehand if limiting flock members by these criteria is desired.

      Parameters:
      reference - reference to the entity wishing to join the flock.
      flockReference - reference to the flock being joined.
      store - the component store.
      Returns:
      true if the entity can join the flock, false otherwise.
    • join

      public static void join(@Nonnull Ref<EntityStore> ref, @Nonnull Ref<EntityStore> flockRef, @Nonnull Store<EntityStore> store)
      A helper method to handle creating and attaching a FlockMembership to an entity for a given flock, thus triggering the system logic to handle adding the entity to the flock.

      If the entity is already a member of a flock, a different code path will be triggered which will cause them to leave their old flock first.

      Parameters:
      ref - The entity ref of the entity joining the flock.
      flockRef - The entity ref of the flock to join.
      store - The Store<EntityStore> for component access.