description:Geyser Extensions are the equivalent of "plugins", but specifically for the Geyser platform. This brings the advantage of them being platform-agnostic, meaning that you won't have to worry about supporting all platforms individually.
- id: The id of the extension. Every extension needs to have their unique id - all lowercase letters. If you e.g. register a command for your extension, it will have the id as a prefix: e.g. `/exampleid command`.
The main class, the entrypoint for the extension, needs to [implement the **Extension** interface provided by Geyser](https://github.com/GeyserMC/GeyserExampleExtension/blob/master/src/main/java/org/geyser/extension/exampleid/ExampleExtension.java#L12).
That way, Geyser recognizes the extension, and gives you access to important methods - such as `logger()`, to get your extensions logger.
To see all the methods provided by that interface, see [here](https://github.com/GeyserMC/Geyser/blob/master/api/src/main/java/org/geysermc/geyser/api/extension/Extension.java).
Unlike plugins, extensions do not have a `onEnable` or `onDisable` method. Instead, most actions are done in events at different stages during Geyser's lifecycle using events.
- `GeyserPreInitializeEvent`: This event is fired when Geyser starts to initialize. If you e.g. need to register extension commands that are configured in your config,
- `GeyserPostInitializeEvent`: It is called when Geyser has completed initializing. The bulk of your code should go here, as the GeyserAPI is fully available at this stage.
- `GeyserShutdownEvent`: Called when Geyser is shutting down. You can use this to e.g. save data, or clean up resources.
See below for an example:
```java
@Subscribe
public void onPostInitialize(GeyserPostInitializeEvent event) {
// example: show that your extension is loading.
this.logger().info("Loading example extension...");
}
```
If you wish to register custom items, global resource packs (or soon, custom blocks and entities), you will need to subscribe to the event using the @Subscribe annotation,
and register them in the event. You can find an example for custom items [here](/wiki/geyser/custom-items#geyser-extensions). For other events, see [here](/wiki/geyser/events) for documentation.
This interface represents a command source in Geyser. It can be used to e.g. send messages to the source, check if the source has permission to execute a command, or get the locale.
```java
Command command = Command.builder(this) // "this" is the extension's main class
.name("ExampleCommand")
.bedrockOnly(true)
.source(CommandSource.class)
.aliases(List.of("example", "ex"))
.description("An example command")
.executableOnConsole(false)
.suggestedOpOnly(false)
.permission("example.command")
.executor((source, cmd, args) -> {
// this is the command executor - this is where you would put your code to execute the command.
If everything went right, you should be able to execute the command in-game by running `/extesionid [command]` - in our case, `/exampleid examplecommand`.