laggalive

Create a Minecraft Paper plugin for Paper 1.21.11 (Java 21) called FlowerAdmin.

The plugin must integrate with the LuckPerms API.

Main idea

The server has five LuckPerms groups (yet may add more in the future):

vld glava admin tech default

The first four groups are staff groups. The "default" group is the normal player group.

The plugin must provide a command:

/admin

which toggles a staff member between On Duty and Off Duty.

Behavior When a staff member is ON DUTY

If the player belongs to one of these groups:

vld glava admin tech

and executes:

/admin

the plugin must:

Detect the player's current primary LuckPerms group.

Save the original group in memory (and optionally to disk so it survives server restarts).

Change the player's primary group to the configured off-duty group (default: default).

Refresh LuckPerms data immediately.

Send the configured "off duty" message.

Play the configured sound (optional).

Execute configurable console commands after switching.

While off duty, the player should have exactly the permissions and prefix of the "default" group.

When a staff member is OFF DUTY

If the player executes:

/admin

again, the plugin must:

Restore the player's original LuckPerms group.

Remove the stored temporary data.

Refresh LuckPerms immediately.

Send the configured "on duty" message.

Play the configured sound (optional).

Execute configurable console commands after switching.

The player must receive exactly the same group they originally had.

Examples:

vld → default → vld

glava → default → glava

admin → default → admin

tech → default → tech

LuckPerms requirements

Use the LuckPerms API only.

Do NOT execute console commands like:

/lp user ...

Everything should use the API.

The plugin should correctly change the player's primary group.

Persistence

The plugin must remember off-duty players after a server restart.

If the server restarts while a player is off duty:

they should remain in the off-duty group, the plugin must still know their original group, executing /admin should restore the correct original group.

Store this data in a YAML file.

Configuration

Everything must be configurable in config.yml.

Example options:

command: admin

permission: floweradmin.use

staff-groups: - vld - glava - admin - tech

off-duty-group: default

messages: on-duty: "&aYou are now ON duty." off-duty: "&eYou are now OFF duty." no-permission: "&cYou cannot use this command." not-staff: "&cYou are not a staff member."

sounds: enabled: true on-duty: ENTITY_PLAYER_LEVELUP off-duty: BLOCK_NOTE_BLOCK_PLING

console-commands: on-duty: - "say %player% is now on duty"

off-duty: - "say %player% is now off duty"

save-data: true Permissions floweradmin.use

Only players with this permission can use the command.

Placeholder support

MiniMessage support (hex codes gradients and etc)

Support these placeholders in messages and console commands:

%player% %group% %old_group% %new_group% Reload command

Provide:

/floweradmin reload

Permission:

floweradmin.reload

This should reload the configuration without restarting the server.

Code quality

Requirements:

Java 21 Paper 1.21.11 API LuckPerms API Maven project Clean package structure Proper OOP No deprecated APIs No memory leaks Async LuckPerms operations where appropriate Well-commented code Error handling and logging

Kodari AI
KodariJul 5 at 1:21 am 21

I’ll create a LuckPerms-integrated on/off duty toggle plugin for staff groups.

FlowerAdmin
A LuckPerms-powered staff duty toggle plugin. Staff in configurable groups (vld, glava, admin, tech) can run /admin to switch to an off-duty group (default: default), temporarily losing staff permissions and prefix, then switch back to their exact original group. Original group is persisted to YAML so restarts don't lose data. Fully configurable messages, sounds, and console commands with MiniMessage/legacy color and placeholder support. Includes /floweradmin reload.

Plugin created: FlowerAdmin uses LuckPerms API exclusively (InheritanceNode add/remove + setPrimaryGroup, async load/save) to swap staff between their real group and the off-duty group, persists off-duty state in data.yml, and supports MiniMessage/legacy/hex colors plus placeholders in messages and console commands. /admin toggles duty, /floweradmin reload reloads config live.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
10 712
src/main/java/com/floweradmin/FlowerAdmin.java
package com.floweradmin;

import com.floweradmin.commands.AdminCommand;
import com.floweradmin.commands.FlowerAdminCommand;
import com.floweradmin.config.ConfigManager;
import com.floweradmin.data.DutyDataManager;
import com.floweradmin.manager.DutyManager;
import lombok.Getter;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public final class FlowerAdmin extends JavaPlugin {

    private ConfigManager configManager;
    private DutyDataManager dutyDataManager;
    private DutyManager dutyManager;
    private LuckPerms luckPerms;

    @Override
    public void onEnable() {
        if (!setupLuckPerms()) {
            getLogger().severe("LuckPerms was not found! Disabling FlowerAdmin.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        saveDefaultConfig();

        this.configManager = new ConfigManager(this);
        this.dutyDataManager = new DutyDataManager(this);
        this.dutyDataManager.load();
        this.dutyManager = new DutyManager(this, luckPerms, dutyDataManager, configManager);

        getCommand("admin").setExecutor(new AdminCommand(this));
        getCommand("floweradmin").setExecutor(new FlowerAdminCommand(this));

        getLogger().info("FlowerAdmin has been enabled.");
    }

    @Override
    public void onDisable() {
        if (dutyDataManager != null) {
            dutyDataManager.save();
        }
        getLogger().info("FlowerAdmin has been disabled.");
    }

    private boolean setupLuckPerms() {
        RegisteredServiceProvider<LuckPerms> provider = getServer()
                .getServicesManager()
                .getRegistration(LuckPerms.class);
        if (provider == null) {
            return false;
        }
        this.luckPerms = provider.getProvider();
        return true;
    }

    public void reload() {
        reloadConfig();
        this.configManager.reload();
    }
}