NightbreakAccount

public class NightbreakAccount

Manages the Nightbreak account token and provides access to the Nightbreak DLC API.

API Base URL: https://nightbreak.io

Endpoints: - GET /server/dlc/:slug/version - Get DLC version info (no auth required) - GET /server/dlc/:slug/access - Check if user has access (auth required) - GET /server/dlc/:slug/download - Download DLC file (auth required)

Types

Link copied to clipboard
public class AccessInfo
Contains access information for a DLC.
Link copied to clipboard
public interface DownloadProgressCallback
Callback interface for download progress updates.
Link copied to clipboard
public final class PluginChangelog extends Record
Link copied to clipboard
Link copied to clipboard
public interface TokenChangeListenerRegistration implements AutoCloseable
Link copied to clipboard
public class VersionInfo
Contains version information for a DLC.

Properties

Link copied to clipboard
public static volatile NightbreakAccount instance
Link copied to clipboard
public static volatile String lastAuthFailureBody
Link copied to clipboard
public static volatile int lastAuthFailureStatus
Link copied to clipboard
public String token

Functions

Link copied to clipboard
public static void addTokenChangeListener(Runnable listener)
Legacy non-removable listener registration.
Link copied to clipboard
Checks if the user has access to a DLC.
Link copied to clipboard
Link copied to clipboard
public static boolean clearToken(JavaPlugin plugin)
Removes the shared Nightbreak token from disk and this shaded classloader.
Link copied to clipboard
public boolean download(String slug, File destinationFile)
Downloads a DLC file.
public boolean download(String slug, File destinationFile, String version)
Downloads a specific version of a DLC file.
public boolean download(String slug, File destinationFile, String version, NightbreakAccount.DownloadProgressCallback progressCallback)
Downloads a DLC file with progress updates.
Link copied to clipboard
public boolean downloadPlugin(String slug, File destinationFile, NightbreakAccount.DownloadProgressCallback progressCallback)
Link copied to clipboard
Link copied to clipboard
Gets version info for all available DLC from the Nightbreak API.
Link copied to clipboard
Returns the singleton, re-reading from disk if another plugin's shaded copy wrote a new token since the last access.
Link copied to clipboard
public static String getLastAuthFailureBody()
Link copied to clipboard
public static int getLastAuthFailureStatus()
Link copied to clipboard
Link copied to clipboard
public static List<NightbreakAccount.PluginChangelog> getPublicDlcChangelogs(String slug, boolean logFailures)
Public DLC release history; this endpoint intentionally requires no account token.
Link copied to clipboard
public static NightbreakAccount.VersionInfo getPublicDlcVersion(String slug, boolean logFailures)
Link copied to clipboard
public static List<NightbreakAccount.PluginChangelog> getPublicPluginChangelogs(String slug, boolean logFailures)
Fetches the public release history uploaded by the Nightbreak release pipeline.
Link copied to clipboard
public static NightbreakAccount.VersionInfo getPublicPluginVersion(String slug, boolean logFailures)
Link copied to clipboard
public String getToken()
Link copied to clipboard
Gets the latest version info for a DLC.
Link copied to clipboard
public static boolean hasAuthFailure()
Returns true after Nightbreak rejects the current token with 401/403.
Link copied to clipboard
public static boolean hasToken()
Checks if a token is currently registered.
Link copied to clipboard
public static NightbreakAccount initialize(JavaPlugin plugin)
Initializes the NightbreakAccount by loading the token from the shared config folder.
Link copied to clipboard
public static NightbreakAccount registerToken(JavaPlugin plugin, String token)
Registers a new token by saving it to the shared config file.
Link copied to clipboard
Registers a removable listener for every actual credential change: login, token replacement, or logout.
Link copied to clipboard
public static void resetAuthFailureSuppression()
Re-enables auth-failure logging.