wasamitoobad_6978

Create a Minecraft server plugin that allows administrators to create and assign custom role names to players.

The plugin should support roles such as “King,” “Duke,” “Knight,” or any custom title chosen by the admin.

Features required:

* Create unlimited custom roles/titles * Assign or remove roles from players using commands * Display the role before the player’s username in chat and optionally above their head * Support colored role names using Minecraft color codes or HEX colors * Permission-based access for admins/moderators * Save all roles and player data in a config/database file * Easy configuration through a YAML config * Compatible with modern Minecraft server software (Paper/Spigot) * Lightweight and optimized for performance

Example: [King] Lewis: Hello everyone!

Optional features:

* INVENTORY GUI menu for role management * Role priority system * Temporary roles with expiration time * Integration with LuckPerms/Vault * PlaceholderAPI support

Language: Java Platform: Paper/Spigot Minecraft Server Plugin

Kodari AI
KodariMay 10 at 4:22 am 19,200 (v2)

I’ll create a comprehensive custom roles plugin with GUI management, temporary roles, priority system, and PlaceholderAPI support.

CustomRoles
A feature-rich custom roles plugin that allows administrators to create and assign custom titles to players. Supports unlimited role creation with color formatting, priority-based display, temporary role expiration, and PlaceholderAPI integration. Features an intuitive GUI interface for role management, chat prefix display, and persistent storage. Includes permission-based access control and full configuration through YAML files. Optimized for Paper/Spigot servers with cross-version compatibility.

Architecture Plan

Core Systems:

  • Role management with priority and colors

  • Player role assignments with expiration support

  • Chat formatting with role prefixes

  • GUI-based administration interface

  • PlaceholderAPI integration

  • YAML storage with auto-save

Package Structure:

Plain Text
com.example.customroles/
├── Main plugin
├── data/ (Role, PlayerRoleData)
├── manager/ (RoleManager, StorageManager)
├── listener/ (ChatListener)
├── command/ (RoleCommand)
├── inventory/ (GUI framework + implementations)
├── hook/ (PlaceholderAPI)
└── util/ (ColorUtil)

All core files created successfully! The CustomRoles plugin includes:

Features implemented:

  • ✅ Unlimited custom roles with priority system

  • ✅ Role assignment/removal with temporary duration support

  • ✅ Chat formatting with role prefixes/suffixes

  • ✅ Full GUI management system for easy administration

  • ✅ PlaceholderAPI integration with 6 placeholders

  • ✅ Persistent YAML storage (roles.yml + playerdata.yml)

  • ✅ Permission-based access control

  • ✅ Automatic role expiration with notifications

  • ✅ Tab completion for all commands

  • ✅ XSeries for cross-version compatibility

Commands: /role create|delete|assign|remove|list|info|gui|reload

Placeholders: %customroles_role%, %customroles_prefix%, %customroles_suffix%, %customroles_priority%, %customroles_role_id%, %customroles_has_role%

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
23 1,420
src/main/java/com/example/customroles/CustomRoles.java
package com.example.customroles;

import com.example.customroles.command.RoleCommand;
import com.example.customroles.hook.RolePlaceholder;
import com.example.customroles.inventory.gui.GUIListener;
import com.example.customroles.inventory.gui.GUIManager;
import com.example.customroles.listener.ChatListener;
import com.example.customroles.manager.RoleManager;
import com.example.customroles.manager.StorageManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CustomRoles extends JavaPlugin {
    private RoleManager roleManager;
    private StorageManager storageManager;
    private GUIManager guiManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.storageManager = new StorageManager(this);
        this.roleManager = new RoleManager(this);
        this.guiManager = new GUIManager();
        
        this.storageManager.load();
        
        getCommand("role").setExecutor(new RoleCommand(this));
        
        if (getConfig().getBoolean("enable-chat-format", true)) {
            Bukkit.getPluginManager().registerEvents(new ChatListener(this), this);
        }
        
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new RolePlaceholder(this).register();
            getLogger().info("PlaceholderAPI hook enabled!");
        }
        
        int interval = getConfig().getInt("auto-save-interval", 5);
        if (interval > 0) {
            Bukkit.getScheduler().runTaskTimer(this, () -> storageManager.save(), interval * 60 * 20L, interval * 60 * 20L);
        }
        
        Bukkit.getScheduler().runTaskTimer(this, () -> roleManager.checkExpiredRoles(), 20L, 20L * 60);
        
        getLogger().info("CustomRoles enabled successfully!");
    }
    
    @Override
    public void onDisable() {
        if (storageManager != null) {
            storageManager.save();
        }
        getLogger().info("CustomRoles disabled successfully!");
    }
}