Overview
TheEssentialAPI interface is the central access point for all public Essential development tools. You can obtain an instance via EssentialAPI.getInstance() or through dependency injection.
Getting an Instance
There are two ways to access the Essential API:Static Access
Dependency Injection
See Dependency Injection for details on using DI.API Methods
commandRegistry()
The entry point to Essential’s powerful Command API. All commands must be registered here if you wish for them to work.CommandRegistry - The command registry instance
Static Access:
di()
Access Essential’s dependency injection system. Essential provides the option of obtaining all of its APIs via dependency injection, as well as providing a library for you to use DI in your own projects.DI - The dependency injection instance
Static Access:
notifications()
Notifications are a way to quickly display relevant information to the user without cluttering their chat box. Essential provides an easy to use API to display beautiful notifications.Notifications - The notifications API instance
Static Access:
config()
Essential has some internal settings that players can modify with the Essential config GUI. If you wish to have behavior dependent on any of these options, you can access their values here.EssentialConfig - The Essential configuration instance
Static Access:
guiUtil()
A collection of GUI utilities.GuiUtil - GUI utilities instance
Static Access:
minecraftUtil()
A collection of general Minecraft related utilities.MinecraftUtils - Minecraft utilities instance
Static Access:
shutdownHookUtil()
A utility that allows you to run something when shutting down to prevent using Runtime’s shutdown hook.ShutdownHookUtil - Shutdown hook utility instance
Static Access:
imageCache()
Image cache for Minecraft skins.ImageCache - The image cache instance
Static Access:
trustedHostsUtil()
Utility for interacting with Essential’s trusted image host list.TrustedHostsUtil - Trusted hosts utility instance
Static Access:
componentFactory()
Utility for using some of Essential’s Elementa components in your GUIs.EssentialComponentFactory - The component factory instance
Static Access:
mojangAPI()
Utility for interacting with the Mojang API.MojangAPI - The Mojang API utility instance
Static Access:
onboardingData()
Utility for accessing the player’s Essential TOS status.OnboardingData - The onboarding data instance
Static Access:
Usage Examples
Accessing Multiple APIs
Using Static Methods (Java)
Source Reference
- Location:
api/src/main/kotlin/gg/essential/api/EssentialAPI.kt - Package:
gg.essential.api