Package dev.itsharshxd.zentrix.api
Interface ZentrixAPI
public interface ZentrixAPI
Main entry point for the Zentrix Developer API.
This API allows third-party developers to create addons that interact with Zentrix Battle Royale games without accessing the core plugin source code.
Getting Started
// Get the API instance (recommended)
ZentrixAPI api = ZentrixAPI.get();
// Access services
GameService gameService = api.getGameService();
Collection<ZentrixGame> games = gameService.getActiveGames();
Available Services
GameService- Game management and queriesPlayerService- Player-related operationsTeamService- Team management and queriesClassService- Player class informationCurrencyService- Economy operationsProfileService- Player statisticsPhaseService- Game phase informationDataService- Data folder and configuration accessRecipeService- Custom recipe management
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ZentrixAPIget()Gets the ZentrixAPI instance.@NotNull AddonManagerGets the addon manager for addon lifecycle management.@NotNull StringGets the API version for compatibility checks.@NotNull ClassServiceGets the class service for player class information.@NotNull CurrencyServiceGets the currency service for economy operations.@NotNull DataServiceGets the data service for data folder and configuration access.@NotNull GameServiceGets the game service for game management operations.@NotNull PhaseServiceGets the phase service for game phase information.@NotNull PlayerServiceGets the player service for player-related queries.@NotNull ProfileServiceGets the profile service for player statistics.@NotNull RecipeServiceGets the recipe service for custom recipe management.@NotNull TeamServiceGets the team service for team-related operations.static booleanChecks if the ZentrixAPI is available.
-
Method Details
-
get
Gets the ZentrixAPI instance.This is the recommended way to access the Zentrix API from anywhere in your addon.
Usage Example
// Get the API instance ZentrixAPI api = ZentrixAPI.get(); // Use services api.getGameService().getActiveGames(); api.getCurrencyService().getBalance(player);- Returns:
- The API instance (never null)
- Throws:
IllegalStateException- if Zentrix is not loaded. Ensure your plugin.yml hasdepend: [Zentrix]to guarantee load order.- Since:
- 1.0.0
-
isAvailable
static boolean isAvailable()Checks if the ZentrixAPI is available.Use this method to safely check whether the API can be accessed before calling
get().Usage Example
if (ZentrixAPI.isAvailable()) { ZentrixAPI api = ZentrixAPI.get(); // Safe to use API }- Returns:
trueif the API is initialized and ready to use- Since:
- 1.0.0
-
getAPIVersion
Gets the API version for compatibility checks.Addons should check this version to ensure compatibility with the installed Zentrix version.
- Returns:
- Semantic version string (e.g., "1.0.0")
-
getGameService
Gets the game service for game management operations.Use this service to:
- Get active games
- Find which game a player is in
- Query game state and information
- Returns:
- The game service instance
-
getPlayerService
Gets the player service for player-related queries.Use this service to:
- Get player information within games
- Check player states (alive, spectating)
- Query player game statistics
- Returns:
- The player service instance
-
getTeamService
Gets the team service for team-related operations.Use this service to:
- Get team information
- Check team membership
- Query team status (alive, eliminated)
- Returns:
- The team service instance
-
getClassService
Gets the class service for player class information.Use this service to:
- Get available player classes
- Query class details and abilities
- Check player's selected class
- Returns:
- The class service instance
-
getCurrencyService
Gets the currency service for economy operations.Use this service to:
- Check player balances
- Get currency configuration
- Query reward amounts
- Returns:
- The currency service instance
-
getProfileService
Gets the profile service for player statistics.Use this service to:
- Get player lifetime statistics
- Query wins, kills, deaths, etc.
- Access player rankings
- Returns:
- The profile service instance
-
getPhaseService
Gets the phase service for game phase information.Use this service to:
- Get current phase for a game
- Query phase configurations
- Check phase timings and borders
- Returns:
- The phase service instance
-
getAddonManager
Gets the addon manager for addon lifecycle management.Use this to:
- Query registered addons
- Check addon status
- Returns:
- The addon manager instance
-
getDataService
Gets the data service for data folder and configuration access.Use this service to:
- Access the Zentrix plugin data folder
- Create addon-specific data folders
- Read and write configuration files
- Access Zentrix configuration values (read-only)
- Returns:
- The data service instance
-
getRecipeService
Gets the recipe service for custom recipe management.Use this service to:
- Register custom crafting recipes
- Query existing recipes
- Check player craft limits
- Manage recipe restrictions (one-time, craft limits)
- Returns:
- The recipe service instance
-