vanilla

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	provider.BaseProvider
}

func New

func New() *Provider

func (*Provider) Download

func (p *Provider) Download(gameVersion, serverVersion, installDir string, onProgress func(current, total int64)) error

Download downloads the vanilla server JAR to the specified installation directory. It uses a default background context.

func (*Provider) DownloadContext added in v2.1.0

func (p *Provider) DownloadContext(ctx context.Context, gameVersion, serverVersion, installDir string, onProgress func(current, total int64)) error

DownloadContext downloads the vanilla server JAR to the specified installation directory with context support.

Parameters:

  • ctx: the context to control the download cancellation.
  • gameVersion: the Minecraft version string (e.g., "1.16.5", "15w14a", "1.18-pre2").
  • serverVersion: ignored for vanilla.
  • installDir: the directory where the server JAR will be saved.
  • onProgress: a callback function to report download progress.

Returns:

  • error: an error if the download fails.

func (*Provider) DownloadURL

func (p *Provider) DownloadURL(gameVersion, serverVersion string) (string, error)

DownloadURL returns the download URL for the Minecraft vanilla server JAR for a given game version. It uses a default background context.

func (*Provider) DownloadURLContext added in v2.1.0

func (p *Provider) DownloadURLContext(ctx context.Context, gameVersion, serverVersion string) (string, error)

DownloadURLContext returns the download URL for the Minecraft vanilla server JAR for a given game version with context support.

Parameters:

  • ctx: the context to control the request lifetime.
  • gameVersion: the Minecraft version string (e.g., "1.16.5", "15w14a", "1.18-pre2").
  • serverVersion: ignored for vanilla as it doesn't have separate server versions.

Returns:

  • string: the direct download URL for the server JAR file.
  • error: an error if the version is not found or if any HTTP or JSON decoding issues occur.

func (*Provider) GameVersions

func (p *Provider) GameVersions() ([]string, error)

GameVersions fetches the list of all Minecraft vanilla versions from the official Mojang API version manifest. It uses a default background context.

func (*Provider) GameVersionsContext added in v2.1.0

func (p *Provider) GameVersionsContext(ctx context.Context) ([]string, error)

GameVersionsContext fetches the list of all Minecraft vanilla versions from the official Mojang API version manifest with context support.

Parameters:

  • ctx: the context to control the request lifetime.

Returns:

  • []string: a slice of Minecraft versions (e.g., "1.16.5", "15w14a", "1.18-pre2").
  • error: an error if any HTTP or JSON decoding issues occur.

func (*Provider) ServerVersions

func (p *Provider) ServerVersions(gameVersion string) ([]string, error)

ServerVersions returns the list of available server versions for a given game version. It uses a default background context. For vanilla, this always returns an error.

func (*Provider) ServerVersionsContext added in v2.1.0

func (p *Provider) ServerVersionsContext(ctx context.Context, gameVersion string) ([]string, error)

ServerVersionsContext returns the list of available server versions for a given game version with context support. For vanilla, this always returns an error as there are no separate server versions.

Parameters (unused for vanilla):

  • ctx: the context to control the request lifetime.
  • gameVersion: the Minecraft version string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL