Class PlayerUtil

java.lang.Object
com.hypixel.hytale.server.core.universe.world.PlayerUtil

public class PlayerUtil extends Object
A utility class that contains a variety of player-specific functions and utilities.
  • Constructor Details

    • PlayerUtil

      public PlayerUtil()
  • Method Details

    • forEachPlayerThatCanSeeEntity

      public static void forEachPlayerThatCanSeeEntity(@Nonnull Ref<EntityStore> ref, @Nonnull TriConsumer<Ref<EntityStore>, PlayerRef, ComponentAccessor<EntityStore>> consumer, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to iterate over each player that can see the given entity, executing the provided consumer.
      Parameters:
      ref - The entity reference of the target entity.
      consumer - The consumer of logic that is to be executed on each player.
      componentAccessor - The invalid input: '<' EntityStore > for component access.
    • forEachPlayerThatCanSeeEntity

      public static void forEachPlayerThatCanSeeEntity(@Nonnull Ref<EntityStore> ref, @Nonnull TriConsumer<Ref<EntityStore>, PlayerRef, ComponentAccessor<EntityStore>> consumer, @Nullable Ref<EntityStore> ignoredPlayerRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to iterate over each player that can see the given entity, executing the provided consumer.
      Parameters:
      ref - The entity reference of the target entity.
      consumer - The consumer of logic that is to be executed on each player.
      ignoredPlayerRef - An optional entity reference of a player to ignore during iteration.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • broadcastMessageToPlayers

      public static void broadcastMessageToPlayers(@Nullable UUID sourcePlayerUuid, @Nonnull Message message, @Nonnull Store<EntityStore> store)
      Called to broadcast a message to all player entities within the given entity store.
      Parameters:
      sourcePlayerUuid - The UUID instance of the source player entity, if any.
      message - The message instance to be sent.
      store - The for component access.
    • broadcastPacketToPlayers

      public static void broadcastPacketToPlayers(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull ToClientPacket packet)
      Called to broadcast the given packet to all player instances within the store of the provided component accessor.
      Parameters:
      componentAccessor - The ComponentAccessor<EntityStore> associated with the store.
      packet - The packet instance to be sent to all player entities.
    • broadcastPacketToPlayersNoCache

      public static void broadcastPacketToPlayersNoCache(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull ToClientPacket packet)
      Called to broadcast the given packet to all player instances within the store of the provided component accessor without caching the packet
      Parameters:
      componentAccessor - The ComponentAccessor<EntityStore> associated with the store.
      packet - The packet instance to be sent to all player entities.
    • broadcastPacketToPlayers

      public static void broadcastPacketToPlayers(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull ToClientPacket... packets)
      Called to broadcast the given packets to all player instances within the store of the provided component accessor.
      Parameters:
      componentAccessor - The ComponentAccessor<EntityStore> associated with the store.
      packets - The packet instances to be sent to all player entities.
    • resetPlayerModel

      @Deprecated(forRemoval=true) public static void resetPlayerModel(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Called to reset the model of the provided player entity.
      Parameters:
      ref - The entity reference of the entity that we are resetting the model for.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.