Class ServerPlayerListModule

java.lang.Object
com.hypixel.hytale.server.core.plugin.PluginBase
com.hypixel.hytale.server.core.plugin.JavaPlugin
com.hypixel.hytale.server.core.modules.serverplayerlist.ServerPlayerListModule
All Implemented Interfaces:
CommandOwner

public class ServerPlayerListModule extends JavaPlugin
A module that manages the server-wide player list.

This module tracks all players connected to the server and sends updates when players connect or disconnect from the server.

A spectating player is flagged on their list entry. Per-viewer hides from HiddenPlayersManager drop the hidden player from just that viewer's list.

  • Field Details

  • Constructor Details

    • ServerPlayerListModule

      public ServerPlayerListModule(@Nonnull JavaPluginInit init)
      Default Constructor for a ServerPlayerListModule instance.
      Parameters:
      init - The plugin initialization step for this plugin.
  • Method Details

    • get

      @Nonnull public static ServerPlayerListModule get()
      Returns:
      the singleton instance of the ServerPlayerListModule.
    • broadcastLivesChange

      public void broadcastLivesChange(@Nonnull PlayerRef subjectRef)
      Broadcasts a player's list entry after their remaining lives change. Only a multi-life HardcoreMode.PerPlayer universe carries a lives count in the list (HardcoreMode.showsPersonalLives(int)), so the other modes broadcast nothing.
      Parameters:
      subjectRef - The player whose entry to broadcast.
    • broadcastListEntry

      public void broadcastListEntry(@Nonnull PlayerRef subjectRef)
      Broadcasts a player's list entry as an upsert to every viewer who can see them, reading their current spectating status.
      Parameters:
      subjectRef - The player whose entry to broadcast.
    • broadcastListEntry

      public void broadcastListEntry(@Nonnull PlayerRef subjectRef, boolean spectating)
      Broadcasts a player's list entry as an upsert to every viewer who can see them, refreshing their spectating status. Called when the player starts or stops spectating.
      Parameters:
      subjectRef - The player whose entry to broadcast.
      spectating - Whether the player is currently spectating.
    • onPlayerHiddenForViewer

      public void onPlayerHiddenForViewer(@Nonnull PlayerRef viewerRef, @Nonnull UUID subjectUuid)
      Drops a player from one viewer's list after the viewer hid them.
      Parameters:
      viewerRef - The viewer whose list to update.
      subjectUuid - The UUID of the player the viewer hid.
    • onPlayerShownForViewer

      public void onPlayerShownForViewer(@Nonnull PlayerRef viewerRef, @Nonnull UUID subjectUuid)
      Restores a player to one viewer's list after the viewer unhid them.
      Parameters:
      viewerRef - The viewer whose list to update.
      subjectUuid - The UUID of the player the viewer unhid.