12323acdf

help me make a 1.21.11 plugin that will auto do a command called /lp uesr and then a username of a player with out a rank then parent set Member

Kodari AI
KodariAug 19 at 2:03 pm 1
AutoRankAssigner
A Minecraft 1.21.1 plugin that automatically assigns the "Member" rank to players without a rank. When a player joins the server, the plugin checks if they have any LuckPerms parent groups. If they have none, it executes the command "/lp user [username] parent set Member" automatically. The plugin listens to player join events, verifies rank status via LuckPerms API, and applies the default rank seamlessly. It includes configurable rank name, permission checks, and handles offline player edge cases. The plugin integrates with LuckPerms to ensure every new player receives the Member rank upon their first join, maintaining consistent server hierarchy and access control.
  1. Create a Paper 1.21.11 plugin that checks players when they join.

  2. If a player has no LuckPerms primary group, assign the Member group through the LuckPerms API.

  3. Add the required Gradle setup, plugin descriptor, and configurable group name.

Created the MemberRank Paper plugin for Minecraft 1.21.11.

  • Checks players when they join.

  • If their LuckPerms primary group is default, assigns the Member group.

  • Uses the LuckPerms API asynchronously instead of dispatching /lp user.

  • Includes configurable groups in config.yml.

  • Requires LuckPerms and logs an instruction if the Member group does not exist.

Create the group once with:

Plain Text
/lp creategroup Member

Then install the built plugin alongside LuckPerms.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 130
src/main/java/com/kodari/memberrank/MemberRankPlugin.java
package com.kodari.memberrank;

import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import org.bukkit.plugin.java.JavaPlugin;

public final class MemberRankPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        LuckPerms luckPerms;
        try {
            luckPerms = LuckPermsProvider.get();
        } catch (IllegalStateException exception) {
            getLogger().severe("LuckPerms was not available, disabling MemberRank.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        String defaultGroup = getConfig().getString("default-group", "default");
        String memberGroup = getConfig().getString("member-group", "Member");
        if (defaultGroup == null || defaultGroup.isBlank() || memberGroup == null || memberGroup.isBlank()) {
            getLogger().severe("Both default-group and member-group must be configured.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getServer().getPluginManager().registerEvents(
                new MemberRankListener(luckPerms, defaultGroup, memberGroup, getLogger()), this);
        getLogger().info("MemberRank enabled. Players with the " + defaultGroup
                + " group will be assigned " + memberGroup + ".");
    }
}