Class HytaleServerConfig

java.lang.Object
com.hypixel.hytale.server.core.HytaleServerConfig

public class HytaleServerConfig extends Object
The configuration file containing the configuration values for HytaleServer and all ServerModule's.
  • Field Details

    • VERSION

      public static final int VERSION
      The current version of the server configuration.
      See Also:
    • DEFAULT_MAX_VIEW_RADIUS

      public static final int DEFAULT_MAX_VIEW_RADIUS
      The default maximum view radius for players.
      See Also:
    • MAX_VIEW_RADIUS_LIMIT

      public static final int MAX_VIEW_RADIUS_LIMIT
      Hard ceiling on the configured MaxViewRadius. SphereOffsets.build(int) is O(R³), so an unbounded value would let a misconfigured (or hostile) config.json trigger a multi-gigabyte allocation on first chunk tracking. Matches the client's sphere-radius cap (MapModule.MaxClientSphereChunkRadius); a larger server value buys nothing because the client clamps its own sphere to that radius.
      See Also:
    • PATH

      @Nonnull public static final Path PATH
      The path to the server configuration file.
    • PLUGIN_IDENTIFIERS

      public static final PluginIdentifier[] PLUGIN_IDENTIFIERS
    • CODEC

      @Nonnull public static final BuilderCodec<HytaleServerConfig> CODEC
      The codec used to parse HytaleServerConfig instances.
  • Constructor Details

    • HytaleServerConfig

      public HytaleServerConfig()
  • Method Details

    • setBoot

      public static void setBoot(@Nonnull HytaleServerConfig serverConfig, @Nonnull PluginIdentifier identifier, boolean enabled)
      Sets the enabled state for a mod/plugin in the server config.
      Parameters:
      serverConfig - The server configuration.
      identifier - The mod/plugin identifier.
      enabled - Whether the mod/plugin should be enabled.
    • getServerName

      public String getServerName()
      Returns:
      the server name.
    • setServerName

      public void setServerName(@Nonnull String serverName)
      Called to set the server name.
      Parameters:
      serverName - The new server name to set.
    • getMotd

      public String getMotd()
      Returns:
      the message of the day.
    • setMotd

      public void setMotd(@Nonnull String motd)
      Called to set the message of the day.
      Parameters:
      motd - The new message of the day to set.
    • getPassword

      public String getPassword()
      Returns:
      the server password.
    • setPassword

      public void setPassword(@Nonnull String password)
      Called to set the server password.
      Parameters:
      password - The new server password to set.
    • isRequireJoinPermission

      public boolean isRequireJoinPermission()
      While this is set, a player needs the hytale.server.join permission to connect, and every player without it is refused. A grant to the player, a group they belong to, and a wildcard that covers the node all satisfy it. No group holds the node itself, but the admin group holds every permission.
      Returns:
      true if a player needs a permission to connect.
    • setRequireJoinPermission

      public void setRequireJoinPermission(boolean requireJoinPermission)
      Called to set whether a player needs the hytale.server.join permission to connect.
      Parameters:
      requireJoinPermission - The new value to set.
    • isDisplayTmpTagsInStrings

      public boolean isDisplayTmpTagsInStrings()
      Returns:
      true if temporary tags should be displayed in strings, false otherwise.
    • setDisplayTmpTagsInStrings

      public void setDisplayTmpTagsInStrings(boolean displayTmpTagsInStrings)
      Called to set whether temporary tags should be displayed in strings.
      Parameters:
      displayTmpTagsInStrings - The new value to set.
    • getMaxPlayers

      public int getMaxPlayers()
      Returns:
      the maximum number of players allowed on the server.
    • setMaxPlayers

      public void setMaxPlayers(int maxPlayers)
      Called to set the maximum number of players allowed on the server.
      Parameters:
      maxPlayers - The new maximum number of players to set.
    • getMaxViewRadius

      public int getMaxViewRadius()
      Returns:
      the maximum view radius for players.
    • setMaxViewRadius

      public void setMaxViewRadius(int maxViewRadius)
      Called to set the maximum view radius for players.
      Parameters:
      maxViewRadius - The new maximum view radius to set.
    • getDefaults

      @Nonnull public HytaleServerConfig.Defaults getDefaults()
      Returns:
      the default configuration values.
    • setDefaults

      public void setDefaults(@Nonnull HytaleServerConfig.Defaults defaults)
      Called to set the default configuration values.
      Parameters:
      defaults - The new default configuration values to set.
    • getConnectionTimeouts

      @Nonnull public HytaleServerConfig.TimeoutProfile getConnectionTimeouts()
      Returns:
      the configurable connection timeouts.
    • setConnectionTimeouts

      public void setConnectionTimeouts(@Nonnull HytaleServerConfig.TimeoutProfile connectionTimeouts)
      Called to set the configurable connection timeouts.
      Parameters:
      connectionTimeouts - The new connection timeouts to set.
    • getRateLimitConfig

      @Nonnull public RateLimitConfig getRateLimitConfig()
      Returns:
      the packet rate limit configuration.
    • setRateLimitConfig

      public void setRateLimitConfig(@Nonnull RateLimitConfig rateLimitConfig)
      Called to set the packet rate limit configuration.
      Parameters:
      rateLimitConfig - The new rate limit configuration to set.
    • getModules

      @Nonnull public Map<String, HytaleServerConfig.Module> getModules()
      Returns:
      an unmodifiable map of module names to their corresponding HytaleServerConfig.Module configurations.
    • getModule

      @Nonnull public HytaleServerConfig.Module getModule(String moduleName)
      Called to get the module configuration for the specified module name.
      Parameters:
      moduleName - The name of the module.
      Returns:
      the module configuration.
    • setModules

      public void setModules(@Nonnull Map<String, HytaleServerConfig.Module> modules)
      Called to set the module configurations.
      Parameters:
      modules - The new module configurations to set.
    • getLogLevels

      @Nonnull public Map<String,Level> getLogLevels()
      Returns:
      the unmodifiable map of logger names to their corresponding log levels.
    • setLogLevels

      public void setLogLevels(@Nonnull Map<String,Level> logLevels)
      Called to set the log levels for loggers.
      Parameters:
      logLevels - The new log levels to set.
    • getModConfig

      @Nonnull public Map<PluginIdentifier, ModConfig> getModConfig()
      Returns:
      the map of mod/plugin identifiers to their corresponding ModConfig configurations.
    • setModConfig

      public void setModConfig(@Nonnull Map<PluginIdentifier, ModConfig> modConfig)
      Called to set the mod configurations.
      Parameters:
      modConfig - The new mod configurations to set.
    • getDefaultModsEnabled

      public boolean getDefaultModsEnabled()
      Returns the default enabled state for external mods not explicitly configured. Built-in mods use their manifest default; this only affects external mods.
      Returns:
      true if external mods should be enabled by default, false otherwise.
    • getModLoadOrder

      public PluginIdentifier[] getModLoadOrder()
    • getPlayerStorageProvider

      @Nonnull public PlayerStorageProvider getPlayerStorageProvider()
      The provider is decoded on the first call, so call this once the plugins are loaded.
      Returns:
      the storage provider for player data.
    • setPlayerStorageProvider

      public void setPlayerStorageProvider(@Nonnull PlayerStorageProvider playerStorageProvider)
      Called to set the storage provider for player data.
      Parameters:
      playerStorageProvider - The new player storage provider to set.
    • getUniverseResourceStorageProvider

      @Nonnull public IUniverseResourceStorageProvider getUniverseResourceStorageProvider()
      The provider is decoded on the first call, so call this once the plugins are loaded.
      Returns:
      the storage provider for universe resources.
    • setUniverseResourceStorageProvider

      public void setUniverseResourceStorageProvider(@Nonnull IUniverseResourceStorageProvider universeResourceStorageProvider)
      Called to set the storage provider for universe resources.
      Parameters:
      universeResourceStorageProvider - The new universe resource storage provider to set.
    • getBanStorageProvider

      @Nonnull public BanStorageProvider getBanStorageProvider()
      The provider is decoded on the first call, so call this once the plugins are loaded.
      Returns:
      the ban list the server applies when a player connects
    • setBanStorageProvider

      public void setBanStorageProvider(@Nonnull BanStorageProvider banStorageProvider)
      Called to set the ban list the server applies when a player connects.
      Parameters:
      banStorageProvider - The new ban list to set.
    • getAuthCredentialStoreProvider

      @Nonnull public AuthCredentialStoreProvider getAuthCredentialStoreProvider()
      The provider is decoded on the first call, so call this once the plugins are loaded.
      Returns:
      the store for the credentials the server authenticates with
    • setAuthCredentialStoreProvider

      public void setAuthCredentialStoreProvider(@Nonnull AuthCredentialStoreProvider provider)
      Sets the auth credential store provider directly.
      Parameters:
      provider - The provider to use.
    • getUpdateConfig

      @Nonnull public UpdateConfig getUpdateConfig()
      Returns:
      the auto-update configuration.
    • setUpdateConfig

      public void setUpdateConfig(@Nonnull UpdateConfig updateConfig)
      Called to set the auto-update configuration.
      Parameters:
      updateConfig - The new auto-update configuration to set.
    • getBackupConfig

      @Nonnull public BackupConfig getBackupConfig()
      Returns:
      the backup configuration.
    • setBackupConfig

      public void setBackupConfig(@Nonnull BackupConfig backupConfig)
      Called to set the backup configuration.
      Parameters:
      backupConfig - The new backup configuration to set.
    • getFallbackServer

      @Nullable public HostAddress getFallbackServer()
    • setFallbackServer

      public void setFallbackServer(@Nullable HostAddress fallbackServer)
    • getWorldMapConfig

      @Nonnull public ServerWorldMapConfig getWorldMapConfig()
      Returns:
      the server-level world map configuration, acting as the global limitations for world map settings.
    • setWorldMapConfig

      public void setWorldMapConfig(@Nonnull ServerWorldMapConfig worldMapConfig)
      Called to set the server-level world map configuration.
      Parameters:
      worldMapConfig - The new world map configuration to set.
    • removeModule

      public void removeModule(@Nonnull String module)
      Called to remove a module configuration.
      Parameters:
      module - The name of the module to remove.
    • markChanged

      public void markChanged()
      Called to mark the configuration as changed.
    • consumeHasChanged

      public boolean consumeHasChanged()
      Returns:
      true if the configuration has changed since it was last saved, false otherwise.
    • load

      @Nonnull public static HytaleServerConfig load()
      Returns:
      the loaded server configuration, or null if loading failed.
    • load

      @Nonnull public static HytaleServerConfig load(@Nonnull Path path)
      Called to load and return the server configuration from the specified path.
      Parameters:
      path - The path to load the server configuration from.
      Returns:
      the loaded server configuration.
    • save

      @Nonnull public static CompletableFuture<Void> save(@Nonnull HytaleServerConfig hytaleServerConfig)
      Called to save the server configuration to the default path.
      Parameters:
      hytaleServerConfig - The server configuration to save.
      Returns:
      a future that completes when the save is complete.
    • save

      @Nonnull public static CompletableFuture<Void> save(@Nonnull Path path, @Nonnull HytaleServerConfig hytaleServerConfig)
      Called to save the server configuration to the specified path.
      Parameters:
      path - The path to save the server configuration to.
      hytaleServerConfig - The server configuration to save.
      Returns:
      a future that completes when the save is complete.
    • getMaxViewSphereOffsets

      @Nonnull public SphereOffsets getMaxViewSphereOffsets()
      Returns the shared SphereOffsets list built for the server's maximum-allowed view radius. Used by per-player SphereSpiralIterator instances; each iterator clamps this list to its own (smaller-or-equal) radius via a binary search at init.

      Lazily built on first access and cached. synchronized ensures all callers observe the same instance. Building is a one-shot cost in the low milliseconds, so the lock is uncontended after warmup.