G

Develop a clans plugin named "Gracc Clans" for Minecraft version 1.21.1 that allows players to create clans using the command /clan create. The plugin should feature customizable clan colors, a hierarchy with designated leaders and members, and support for displaying clan information through placeholders for nametags and scoreboards. Ensure that the plugin maintains a clean codebase and includes essential functionalities like clan chat, member management, and permission settings, similar to the Better Teams plugin.

Kodari AI
KodariApr 15 at 10:41 am 20,172 (v2)
GraccClans
A feature-rich clans plugin for Minecraft 1.21.1 allowing players to create and manage clans with /clan create. Includes customizable clan colors, a leader/member hierarchy, clan chat toggle, member management (invite, kick, leave, disband), clan tags, and PlaceholderAPI support for nametags and scoreboards. Data is persisted per-clan in YAML files. Clean command structure with subcommands and full permission support.

Planning class dependencies before writing:

  • GraccClans → holds ClanManager, FileStorage

  • ClanManager → uses Clan, ClanPlayer, ClanRole, FileStorage

  • Clan → @Data, stores members, color, tag, leader UUID

  • ClanPlayer → @Data, stores UUID, clan name, role

  • ClanRole → enum LEADER / MEMBER

  • ClanCommand → uses ClanManager, MessageUtil

  • ClanChatListener → uses ClanManager

  • PlaceholderHook → uses ClanManager

  • FileStorage → uses Clan, ClanPlayer, ClanRole

  • MessageUtil → static utility

Now I have everything needed. Let me build the full plugin:

Now I need to wire MessageUtil into GraccClans and update the main class to expose it:

GraccClans Clans plugin is complete. Here’s a summary of everything built:

  • GraccClans — main plugin class with FileStorage, ClanManager, MessageUtil fields and @Getter

  • Clan / ClanPlayer / ClanRole / PendingInvite — data models with Lombok annotations

  • ClanManager — full business logic: create, disband, invite, accept/deny, kick, leave, color, tag, transfer leadership, clan chat messaging

  • FileStorage — per-clan YAML files in data/clans/ and per-player YAML in data/players/, full load/save/delete operations

  • MessageUtil — centralized message formatting with prefix support and placeholder replacement

  • ClanColors — 16 named color options mapped to & codes

  • ClanCommand — full /clan command with 13 subcommands and tab-completion

  • ClanChatListener — intercepts chat for players with clan chat toggled on

  • ClanPlayerListener — resets clan chat state on disconnect

  • ClansPlaceholderExpansion — 10 PAPI placeholders (%graccclans_clan_name%, %graccclans_clan_tag_formatted%, %graccclans_clan_prefix%, etc.) for use in nametags and scoreboards

G

Can I update some things

Kodari AI
KodariApr 15 at 11:11 am 700 (v2)

Of course! What would you like to update or change?

G

First of all as you can see in clan prefix idk why I write theduo but it only registered the I want to register atleast 6 words and create 6 words clan and also one thing that is when I did the prefix thing it already has brackets with placeholder please delete all brackets with placeholder I only the prefix name or name of the clan

Kodari AI
KodariApr 15 at 11:14 am 9,231 (v2)

Let me read all the relevant files first.

Now let me read the placeholder and listener files to find where the prefix is displayed in chat.

I can see both issues clearly:

  1. Multi-word clan names — handleCreate only reads args[1] (one word), and isValidName regex [a-zA-Z0-9_]+ blocks spaces entirely

  2. Brackets in placeholder — clan_prefix and clan_tag_formatted both hardcode "[" + clan.getTag() + "]"

Here’s what changed:

  • Multi-word names: handleCreate now joins all words after /clan create into one name (e.g. /clan create The Duo → "The Duo"), isValidName now allows spaces and enforces a max of 6 words (configurable via max-clan-name-words in config), and max-clan-name-length is raised to 48 to accommodate longer names

  • No more brackets in placeholders: %graccclans_clan_prefix% now returns just the colored clan name (e.g. TheDuo), and %graccclans_clan_tag_formatted% returns just the colored tag with no [ ] wrapping

G

Not only that the prefix also gets only 3 words shown in tab or in nametag

Kodari AI
KodariApr 15 at 11:18 am 11,154 (v2)

Let me read the relevant files first.

Let me read the remaining files.

The issue is clear:

  • The plugin has no scoreboard team implementation, so nametags/tab use nothing from this plugin directly

  • When TAB plugin uses %graccclans_clan_prefix% it returns the full clan name, but Minecraft scoreboard team prefixes are capped at 16 characters pre-1.13, causing truncation — which at &b + color + name cuts off visually at ~3 words

  • The fix: implement a proper ClanTeamManager using scoreboard teams with the formatted tag (short, designed for this), refresh on all clan state changes (join, leave, disband, kick, login)

Now I have everything I need. Here’s the plan:

  • Create ClanTeamManager that manages one Bukkit scoreboard team per clan, setting the prefix to colorCode + "[" + tag + "] " — well under the 16-char pre-1.13 limit

  • Register team on clan creation, refresh prefix on color/tag change, remove player on leave/kick/disband, assign on login

  • Wire into GraccClans, ClanManager, and ClanPlayerListener

Now patch GraccClans to add the manager field and load all teams after clans are loaded:

Now patch ClanPlayerListener to handle PlayerJoinEvent and assign the scoreboard team:

Now patch ClanManager to call clanTeamManager on every mutation — create, disband, accept invite, kick, leave, color, tag, transfer leadership:


What changed: Added ClanTeamManager which creates one main-scoreboard team per clan (named gc_<clanname>, max 16 chars, safe on all versions) with prefix [color][TAG] — only 10–12

G

Actually I mean this look I have created a clan name grass but it only shows the gra

1 image attached
Kodari AI
KodariApr 15 at 11:19 am 4,240 (v2)

Let me read the relevant files to find where the clan tag is being truncated.

Found the bug. In Clan.java, the constructor auto-generates the tag using only the first 3 characters of the name, so “grass” → “GRA”. It should use up to 5 characters (matching the max-tag-length config default).

The default tag generation now uses up to 5 characters (matching max-tag-length), so a clan named “grass” will show [GRASS] instead of [GRA]. Existing clans with saved tags are unaffected — only newly created clans get the corrected default.

G

Download

Kodari AI
KodariApr 15 at 11:20 am 10,654 (v2)

Here’s a full breakdown of your GraccClans plugin:


📦 Project Structure

Plain Text
GraccClans/
├── build.gradle
├── src/main/
│   ├── java/com/graccnetwork/clans/
│   │   ├── GraccClans.java                        ← Main plugin class
│   │   ├── commands/
│   │   │   └── ClanCommand.java                   ← All /clan subcommands + tab completion
│   │   ├── listeners/
│   │   │   ├── ClanChatListener.java              ← Intercepts chat for clan chat mode
│   │   │   └── ClanPlayerListener.java            ← Join/quit handling
│   │   ├── managers/
│   │   │   ├── ClanManager.java                   ← Core logic (create, disband, invite, etc.)
│   │   │   ├── ClanTeamManager.java               ← Scoreboard team/prefix management
│   │   │   └── MessageUtil.java                   ← Config-based messaging utility
│   │   ├── model/
│   │   │   ├── Clan.java                          ← Clan data model
│   │   │   ├── ClanPlayer.java                    ← Per-player clan state
│   │   │   ├── ClanRole.java                      ← LEADER / MEMBER enum
│   │   │   └── PendingInvite.java                 ← Invite with expiry
│   │   ├── placeholders/
│   │   │   └── ClansPlaceholderExpansion.java     ← PlaceholderAPI integration
│   │   ├── storage/
│   │   │   └── FileStorage.java                   ← YAML flat-file persistence
│   │   └── util/
│   │       └── ClanColors.java                    ← Color name → &code mapping
│   └── resources/
│       ├── plugin.yml
│       └── config.yml

✅ Features

Feature
Details
Clan creation
/clan create <name>
— name up to 48 chars, up to 6 words, alphanumeric + spaces
Disband
Leader only; notifies all members and deletes all data
Invite / Accept / Deny
Timed invites (configurable, default 60s); auto-expire via scheduler
Kick
Leader can kick online or offline members
Leave
Members only — leaders must disband or transfer first
Clan info
Shows tag, leader, color, full member list with role colors
Clan list
Lists all clans with tag, name, and member count
Clan chat
Toggle with
/clan chat
; persists across sessions (off on quit)
Color
16 named colors (e.g.
aqua
,
gold
) mapped to
&
codes
Tag
2–5 alphanumeric characters; forced uppercase
Transfer leadership
/clan setleader <player>
— swaps LEADER/MEMBER roles
Scoreboard prefix
Clan tag + color shown in tab/nametags via main scoreboard teams
PlaceholderAPI
10 placeholders:
%graccclans_clan_name%
,
_tag%
,
_color%
,
_role%
, etc.
Flat-file storage
Individual YAML files per clan (
data/clans/
) and player (
data/players/
)
Tab completion
Context-aware for all subcommands
Config messages
Every message is configurable in
config.yml
under
messages:

🔧 Commands

Command
Permission
Description
/clan create <name>
graccclans.clan.create
Create a new clan
/clan disband
graccclans.clan.disband
Disband your clan (leader only)
/clan invite <player>
graccclans.clan.invite
Invite a player (leader only)
/clan accept
—
Accept a pending invite
/clan deny
—
Deny a pending invite
/clan kick <player>
graccclans.clan.kick
Kick a member (leader only)
/clan leave
graccclans.clan.leave
Leave your clan
/clan info [clan]
graccclans.clan.info
View clan info
/clan list
graccclans.clan.list
List all clans
/clan chat
graccclans.clan.chat
Toggle clan chat mode
/clan color <name>
graccclans.clan.color
Set clan color (leader only)
/clan tag <tag>
graccclans.clan.tag
Set clan tag (leader only)
/clan setleader <player>
graccclans.clan.setleader
Transfer leadership

📌 PlaceholderAPI Placeholders

Placeholder
Returns
%graccclans_clan_name%
Raw clan name
%graccclans_clan_tag%
Raw tag
%graccclans_clan_color%
Translated color char
%graccclans_clan_tag_formatted%
Color + tag
%graccclans_clan_name_formatted%
Color + name
%graccclans_clan_role%
Leader
or
Member
%graccclans_clan_leader%
Leader’s name
%graccclans_clan_size%
Member count
%graccclans_clan_prefix%
Color + name + reset
%graccclans_in_clan%
true
/
false

⚙️ Build

Shell
./gradlew jar

Requires Java 21, targets Spigot 1.21.1. Output jar is in build/libs/. No shading needed — only compile-only deps (Spigot, PAPI, Lombok).

G

How should I download the new jar

Kodari AI
KodariApr 15 at 11:21 am 913 (v2)

Since this is a Gradle project, you build the jar using the Gradle wrapper from your project’s root directory:

On Windows:

Plain Text
gradlew build

On Mac/Linux:

Plain Text
./gradlew build

The compiled jar will be output to:

Plain Text
build/libs/

Common tips:

  • If you get a permission denied on Mac/Linux, run chmod +x gradlew first

  • Use gradlew clean build to do a fresh build and avoid stale cache issues

  • If you’re using an IDE like IntelliJ, you can also open the Gradle panel on the right side and double-click Tasks → build → build

Drop the jar into your server’s plugins/ folder and restart (or use a plugin manager like /reload — though a full restart is always safer).

G

Inwas wondering why is there a space between the clan prefix and when we /clan info it shows half the name of the clan in tag

1 image attached
Kodari AI
KodariApr 16 at 6:34 am 15,740 (v2)

Let me read the relevant files to find the source of both issues.

Let me also read the placeholder and config files.

I can see both issues clearly now:

  • Space in prefix: The clan_prefix placeholder returns clan.getName() + " &r" — that trailing space before &r lands inside the brackets when your TAB config wraps it like [%graccclans_clan_prefix%], producing [duo ] instead of [duo].

  • Half the name in /clan info tag display: Your TAB config is using %graccclans_clan_prefix% (which returns the full clan name) instead of %graccclans_clan_tag%. For “Redemption” it shows the entire name inside the tag brackets. If a name is long enough it can get cut off by TAB’s character limits, showing only half.

Fix: remove the trailing space from clan_prefix, and add a properly-formatted clan_tag_bracket placeholder so you have a clean option for TAB.

Now in your TAB plugin config, swap whichever placeholder wraps in brackets to use %graccclans_clan_tag_bracket% instead of %graccclans_clan_prefix% or [%graccclans_clan_name%]. For example:

Plain Text
%graccclans_clan_tag_bracket% %player_name%

This will render as [DUO] Velox1ty instead of [Redemption ] etc.

Summary of what was wrong and what changed:

  • clan_prefix was returning name + " &r" — the space before &r landed inside the […] your TAB format added, causing [duo ]

  • The full clan name was leaking into the tag display because clan_prefix returns the name, not the short tag — long names got visually cut off by TAB’s character limit (looked like “half the name”)

  • Fixed clan_prefix to remove the trailing space, and added a new %graccclans_clan_tag_bracket% placeholder that correctly returns [TAG] (color-coded, short tag, no stray spaces) for use in TAB

G

Set the default color of the clan created firstly to gray who ever create a clan the first color should be gray not aqua

Kodari AI
KodariApr 16 at 6:36 am 2,576 (v2)

Changed the default colorCode in the Clan constructor from &b (aqua) to &7 (gray), so every newly created clan will start with a gray color.

G

That's it thankyou

Kodari AI
KodariApr 16 at 6:36 am 746 (v2)

Got it! I have the full project structure for GraccClans loaded. Whenever you’re ready, just let me know what you’d like to add, fix, or change.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
17 1,500
src/main/java/com/graccnetwork/clans/GraccClans.java
package com.graccnetwork.clans;

import com.graccnetwork.clans.commands.ClanCommand;
import com.graccnetwork.clans.listeners.ClanChatListener;
import com.graccnetwork.clans.listeners.ClanPlayerListener;
import com.graccnetwork.clans.managers.ClanManager;
import com.graccnetwork.clans.managers.ClanTeamManager;
import com.graccnetwork.clans.managers.MessageUtil;
import com.graccnetwork.clans.placeholders.ClansPlaceholderExpansion;
import com.graccnetwork.clans.storage.FileStorage;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class GraccClans extends JavaPlugin {

    private FileStorage fileStorage;
    private ClanManager clanManager;
    private MessageUtil messageUtil;
    private ClanTeamManager clanTeamManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.messageUtil = new MessageUtil(this);
        this.fileStorage = new FileStorage(this);
        this.clanManager = new ClanManager(this);

        clanManager.loadAll();

        this.clanTeamManager = new ClanTeamManager(this);
        clanTeamManager.loadAll();

        getCommand("clan").setExecutor(new ClanCommand(this));
        getCommand("clan").setTabCompleter(new ClanCommand(this));

        Bukkit.getPluginManager().registerEvents(new ClanChatListener(this), this);
        Bukkit.getPluginManager().registerEvents(new ClanPlayerListener(this), this);

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new ClansPlaceholderExpansion(this).register();
            getLogger().info("PlaceholderAPI hooked successfully.");
        }

        getLogger().info("GraccClans enabled successfully.");
    }

    @Override
    public void onDisable() {
        if (clanManager != null) {
            clanManager.saveAll();
        }
        getLogger().info("GraccClans disabled.");
    }
}