moneyface_.w

read it

📎 1 file 2,638 chars
📄
pasted-code-1774315194969.txt
txt 123 lines
▶
Create a complete Minecraft Paper plugin for version 1.21.11 using Java.

The purpose of this plugin is to simplify rank management for server admins by creating a custom command `/rank` that acts as an alias and wrapper for the LuckyPerms command:

/lp user (user) group set (group)

Instead of using the LuckyPerms command directly, admins should be able to use:

/rank  

For example:
/rank Steve owner

This should internally execute the equivalent LuckyPerms command to set the user's primary group.

---

### 🔧 Requirements:

1. **Plugin Setup**

   * Must be compatible with Paper 1.21.11
   * Use modern Java practices
   * Include a proper plugin.yml
   * Depend on LuckyPerms (soft or hard depend)

---

2. **Command Behavior**

   * Register a command `/rank`
   * Syntax: `/rank  `
   * Validate arguments:

     * If player or group is missing, send a usage message
   * Execute the equivalent LuckyPerms API call (do NOT use console dispatch if possible, use the LuckyPerms API directly)

---

3. **Permissions**

   * Add a permission node:
     rank.use
   * Only players or console with this permission can use the command
   * Send a "no permission" message if they don’t have it

---

4. **Messages (VERY IMPORTANT – STYLE & COLORS)**

Use Minecraft color codes (§ or ChatColor).

### Message to the target player:

"You are now an (RANK)!"

* The rank should be:

  * Bold
  * Colored (e.g. gold or green)
* Example:
  §aYou are now an §lOWNER§a!

---

### Message to the command executor:

"You have set the rank of (player) to (RANK)."

* Player name: highlighted (e.g. yellow)
* Rank: bold and colored
* Example:
  §eYou have set the rank of §6Steve §eto §lOWNER§e.

---

5. **Console Support**

   * Command should also work from console
   * Console should receive similar feedback messages

---

6. **Error Handling**

   * If player does not exist → send error
   * If group does not exist → send error
   * If LuckyPerms is not installed → disable plugin safely

---

7. **Code Quality**

   * Clean, readable, modular code
   * Use classes where appropriate (Command class, Main class, etc.)
   * Include comments explaining key parts

---

8. **Extra (Optional but Recommended)**

   * Tab completion for:

     * Online player names
     * Available LuckyPerms groups
   * Config file for customizable messages

---

### 📦 Output Requirements:

* Provide full source code
* Include:

  * Main plugin class
  * Command handler class
  * plugin.yml
* Ensure it compiles without errors

---

The final plugin should feel polished, professional, and ready to drop into a server.
Kodari AI
KodariMar 24 at 1:21 am 11,570 (v2)

I’ll create a professional rank management plugin that wraps LuckyPerms commands into a simple /rank interface.

SimpleRankManager
A streamlined rank management plugin for Paper servers that provides an intuitive /rank command as a wrapper for LuckyPerms group management. Features include permission-based access control, colorful feedback messages, smart tab completion for players and groups, and configurable messaging. Simplifies rank assignment for server administrators while maintaining full LuckyPerms integration.

I’ll create a polished rank management plugin with LuckyPerms API integration, custom messages, and tab completion.

Plugin Created Successfully! 🎉

Your SimpleRankManager plugin is ready with:

✅ LuckyPerms API Integration - Direct API calls (no console commands)
✅ Color-Coded Messages - Bold, colored rank names with customizable colors
✅ Smart Tab Completion - Autocomplete for online players and LuckyPerms groups
✅ Configurable Messages - All messages editable in config.yml
✅ Offline Player Support - Works with UUIDs for offline players
✅ Permission System - rank.use permission node
✅ Error Handling - Validates players, groups, and catches exceptions
✅ Console Support - Works from both players and console

Example Usage:

Plain Text
/rank Steve owner → Sets Steve to owner rank

Messages sent:

  • Executor: §eYou have set the rank of §6Steve §eto §4§lOWNER§e.

  • Target: §aYou are now §4§lOWNER§a!

The plugin automatically colors ranks based on the rank-colors section in config.yml. You can customize messages and add more rank colors as needed!

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
5 262
src/main/java/com/simplerankmanager/SimpleRankManager.java
package com.simplerankmanager;

import com.simplerankmanager.command.RankCommand;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

public class SimpleRankManager extends JavaPlugin {
    private LuckPerms luckPerms;
    private FileConfiguration config;

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

        saveDefaultConfig();
        this.config = getConfig();

        PluginCommand rankCommand = getCommand("rank");
        if (rankCommand != null) {
            RankCommand executor = new RankCommand(this, luckPerms);
            rankCommand.setExecutor(executor);
            rankCommand.setTabCompleter(executor);
        }

        getLogger().info("SimpleRankManager has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("SimpleRankManager has been disabled!");
    }

    private boolean setupLuckPerms() {
        try {
            this.luckPerms = LuckPermsProvider.get();
            return true;
        } catch (IllegalStateException e) {
            return false;
        }
    }

    public String getMessage(String path) {
        String message = config.getString("messages." + path, "&cMessage not found: " + path);
        return ChatColor.translateAlternateColorCodes('&', message);
    }

    public String getRankColor(String rankName) {
        String color = config.getString("rank-colors." + rankName.toLowerCase(), 
                                       config.getString("rank-colors.default", "&a"));
        return ChatColor.translateAlternateColorCodes('&', color);
    }

    public LuckPerms getLuckPerms() {
        return luckPerms;
    }
}