Getting Started

Getting Started

Prerequisites

Lotus 2.x is built for Java 21 across all modules, including lotus-spigot. Even if you target Spigot 1.8.8, your build and runtime environment still need Java 21.

Before you start, decide which server API you are writing against:

Module Use when Title type
lotus-paper You are building for Paper 1.21+ Component
lotus-spigot You are building for Spigot 1.8.8 String

Step 1 — Add The Right Artifact

Add the repositories you already need for Paper development:

repositories {
    maven("https://repo.papermc.io/repository/maven-public/")
    mavenCentral()
}

Then add Lotus:

Add the repositories typically used for legacy Spigot development:

repositories {
    maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
    maven("https://oss.sonatype.org/content/repositories/snapshots/")
    mavenCentral()
}

Then add Lotus:

Add one platform artifact, not both. lotus-commons is pulled in transitively, so you should not depend on it directly in a normal plugin.

Step 2 — Shade Lotus Into Your Plugin

Lotus is a library, not a standalone plugin. Your final JAR needs to include it.

Relocating studio.mevera is strongly recommended, especially if your plugin ships with several embedded libraries.

Step 3 — Create One Lotus Runtime

Construct one Lotus instance in onEnable(). The platform factory also registers the framework listener for you.

{`

public final class MyPlugin extends JavaPlugin {

private Lotus<Component> lotus;

@Override
public void onEnable() {
    this.lotus = PaperLotus.create(this);
}

public Lotus<Component> lotus() {
    return lotus;
}

} }</CodeTabItem> <CodeTabItem value="spigot" label="Spigot 1.8.8" language="java">{

public final class MyPlugin extends JavaPlugin {

private Lotus<String> lotus;

@Override
public void onEnable() {
    this.lotus = SpigotLotus.create(this);
}

public Lotus<String> lotus() {
    return lotus;
}

} `}

You do not call registerEvents(...) yourself for Lotus. PaperLotus.create(...) and SpigotLotus.create(...) wire the listener automatically.

Step 4 — Customize The Builder If You Need To

Both platform factories accept a second argument: a Consumer<LotusBuilder<C>>.

this.lotus = PaperLotus.create(this, builder -> builder
    .allowBottomInventoryClick(false)
    .dynamicButtonAction(false)
    .debug(true)
);

What the options actually do

Option Default What it controls
allowBottomInventoryClick true Whether clicks in the player inventory below the menu are allowed through
dynamicButtonAction false Whether Lotus should internally move buttons when pickup/place inventory actions happen
debug false Whether lotus.logger().debug(...) prints [lotus] lines

Lotus already cancels clicks in the top menu inventory by default. allowBottomInventoryClick only affects the player's own inventory while the menu is open.

Step 5 — Know Your First Destination

At this point you are ready to write a menu class and open it for a player. The next page walks through that from zero:

Your First Menu