owner_of_unstable_smp_75041
๐Ÿ“Ž 1 file 5,693 chars
๐Ÿ“„
pasted-code-1773327736909.txt
txt 1 lines
โ–ถ
Build a high-performance Minecraft Paper plugin compatible with Paper 1.21+ called AdvancedClans that integrates with PlaceholderAPI and works with chat plugins such as Strings Chat so clan prefixes can appear before player names in chat using placeholders. The plugin must support hex color codes and traditional & color codes (including &#RRGGBB) in clan names, clan ranks, and chat formats. All data must persist across restarts using SQLite or YAML with async saving to prevent lag. Each player can belong to only one clan at a time. Implement command aliases /clan and /c. Player commands: /clan create  or /c create  to create a clan (name supports hex colors), /clan join  or /c join  which sends a join request to the clan leader and moderators with interactive chat buttons (green accept and red deny), /clan description or /c description to view clan info, /clanchat or /cc to toggle or send clan chat messages only visible to clan members, /clanallychat or /cac for ally chat visible to allied clans, /clan top or /c top to display top clans based on a custom points system, and /clan home or /c home to teleport to clan home if set. Leader commands (leader has full access): /clan delete, /clan description  to edit clan description, /clan pvp  to toggle friendly fire between clan members, /clan home set to set clan home location, /clan rank   to assign a custom clan rank prefix used in clan chat, /clan ally  to send ally requests with clickable accept/deny buttons, /clan war  to send war requests with clickable accept/deny buttons, /clan invite  to invite a player with clickable accept/deny buttons, /clan kick  to remove a member, /clan promote  to promote a member to moderator, /clan demote  to remove moderator status. Moderator commands (medium permissions, cannot exploit): moderators can use /c invite, /c kick, /c join request approvals, /cc, /cac, but moderators cannot delete clan, set home, toggle PvP, assign ranks, create wars, or create alliances. Normal clan members: can only use /c join, /cc, /cac, /c description, /c home, /c top. Clan ranking system: DO NOT use KDR. Instead implement a points system where kills by clan members determine ranking: killing a solo player or player from a neutral clan gives +1 point, killing a player from a clan that is currently at war gives +1.5 points, and when a clan member dies the clan loses 0.5 points. /c top must display clans sorted by total points. Clan description output must show: clan name, leader, moderators, members, clan description text, clan points, PvP status, clan home status, allied clans, and current wars. Chat formatting: clan chat must display [Clan] prefix and show player clan rank prefix before their name; ally chat must display [Ally]. Leader messages inside clan chat must appear bold automatically. PlaceholderAPI placeholders must be implemented including %clan_name%, %clan_rank%, %clan_points%, %clan_leader%, %clan_members%, %clan_description%, %clan_pvp%, and %clan_role% so chat plugins can display clan tags before player names. Add tab completion for all commands. Prevent abuse: add cooldowns for invites and join requests, invite expiration timers, max clan size limits, and checks for duplicate clan names. PvP handling: if clan PvP is disabled then friendly fire must be prevented via event listeners. Interactive chat buttons: must use modern Paper adventure API components for clickable commands and hover text. Error handling: handle cases like offline players invited, player leaving server while request pending, invalid hex color codes, clan not found, duplicate clan name, database corruption, teleporting to unloaded chunks for clan home, PlaceholderAPI missing, chat plugin compatibility issues, or async thread violations. Permissions system: include permission nodes advancedclans.admin (server admin override), advancedclans.leader, advancedclans.mod, advancedclans.member, and ensure leader always has full clan command access while moderators only have mid-level commands and normal members limited commands. Configuration system: implement a main config file named config.yml where server owners can configure global plugin behavior such as max clan size, max moderators, max allies, max wars, invite cooldowns, join request expiration time, war cooldown, points values (+1, +1.5, โˆ’0.5), clan creation cost (for future economy plugins), PvP default state, clan home teleport delay, and enabling/disabling features like wars or alliances. Also implement separate configuration files for modular control: messages.yml for all plugin messages and chat formats including /cc, /cac, invite messages, join request messages, war messages, and error messages (all supporting hex codes); clans.yml to store clan data including members, ranks, points, description, allies, wars, PvP state, and clan home; players.yml to store player-to-clan relationships and roles; ranks.yml to store rank formatting rules; wars.yml to store active wars between clans; allies.yml to store clan alliances; and points.yml to track clan point totals and kill/death calculations. Every message and chat format must be editable inside messages.yml. Implement auto-generation of these files on first plugin startup. The plugin must follow Paper 1.21+ API best practices, compile cleanly with Maven or Gradle, use async database operations, avoid main thread lag, include a proper plugin.yml, support reload-safe data saving, and include comments in config files explaining each option so server owners can customize every feature of the plugin easily.
Kodari AI
KodariMar 12 at 3:07 pm 41,741 (v2)

Iโ€™ll create a comprehensive clan system plugin for Paper 1.21+ with PlaceholderAPI integration, hex color support, interactive chat buttons, and modular configuration.

AdvancedClans
A feature-rich clan management system for Paper 1.21+ featuring PlaceholderAPI integration, hex color support, interactive chat components, points-based ranking, clan wars and alliances, custom rank prefixes, dedicated clan and ally chat channels, clan homes, PvP protection, and fully modular YAML configuration with async data persistence.

Plan

  • Create modular architecture with separate managers for clans, players, ranks, wars, allies, points, chat, homes, cooldowns, and configs

  • Implement Paper Adventure API for interactive clickable chat buttons with hover text

  • Use async YAML storage with separate config files for clans, players, ranks, wars, allies, and points

  • Integrate PlaceholderAPI expansion with comprehensive placeholders for chat plugin compatibility

  • Build role-based permission system with leader/moderator/member distinctions and command access control

Now Iโ€™ll create all the subcommand classes. Due to the length, Iโ€™ll create them systematically:

Now Iโ€™ll create the listeners:

Finally, the main plugin class:

Complete AdvancedClans plugin created with 45+ files including Paper 1.21+ support, PlaceholderAPI integration, hex color codes, interactive clickable chat buttons using Adventure API, comprehensive permission system with leader/moderator/member roles, points-based ranking (kills vs deaths), clan wars and alliances, custom rank prefixes, clan chat and ally chat channels, clan homes with teleportation, PvP protection, async YAML data persistence across 8 modular config files, extensive command system with tab completion, cooldowns and abuse prevention, and full configuration flexibility for server owners to customize every aspect of the plugin.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
55 3,518
src/main/java/com/advancedclans/AdvancedClans.java
package com.advancedclans;

import com.advancedclans.commands.AllyChatCommand;
import com.advancedclans.commands.ClanChatCommand;
import com.advancedclans.commands.ClanCommand;
import com.advancedclans.listeners.*;
import com.advancedclans.managers.*;
import com.advancedclans.placeholders.ClanPlaceholderExpansion;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class AdvancedClans extends JavaPlugin {
    private ConfigManager configManager;
    private MessageManager messageManager;
    private PlayerDataManager playerDataManager;
    private ClanManager clanManager;
    private RankManager rankManager;
    private WarManager warManager;
    private AllyManager allyManager;
    private PointsManager pointsManager;
    private ChatManager chatManager;
    private CooldownManager cooldownManager;
    private HomeManager homeManager;
    private RequestManager requestManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        configManager = new ConfigManager(this);
        messageManager = new MessageManager(this);
        playerDataManager = new PlayerDataManager(this);
        clanManager = new ClanManager(this);
        rankManager = new RankManager(this);
        warManager = new WarManager(this);
        allyManager = new AllyManager(this);
        pointsManager = new PointsManager(this);
        chatManager = new ChatManager(this);
        cooldownManager = new CooldownManager();
        homeManager = new HomeManager(this);
        requestManager = new RequestManager();
        
        registerCommands();
        registerListeners();
        
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new ClanPlaceholderExpansion(this).register();
            getLogger().info("PlaceholderAPI hooked successfully!");
        } else {
            getLogger().warning("PlaceholderAPI not found! Placeholders will not work.");
        }
        
        getLogger().info("AdvancedClans has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (clanManager != null) {
            clanManager.saveAllClans();
        }
        if (playerDataManager != null) {
            playerDataManager.saveAllPlayerData();
        }
        
        getLogger().info("AdvancedClans has been disabled!");
    }
    
    private void registerCommands() {
        getCommand("clan").setExecutor(new ClanCommand(this));
        getCommand("clanchat").setExecutor(new ClanChatCommand(this));
        getCommand("clanallychat").setExecutor(new AllyChatCommand(this));
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerQuitListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerDeathListener(this), this);
        Bukkit.getPluginManager().registerEvents(new EntityDamageListener(this), this);
        Bukkit.getPluginManager().registerEvents(new ChatListener(this), this);
    }
    
    public ConfigManager getConfigManager() {
        return configManager;
    }
    
    public MessageManager getMessageManager() {
        return messageManager;
    }
    
    public PlayerDataManager getPlayerDataManager() {
        return playerDataManager;
    }
    
    public ClanManager getClanManager() {
        return clanManager;
    }
    
    public RankManager getRankManager() {
        return rankManager;
    }
    
    public WarManager getWarManager() {
        return warManager;
    }
    
    public AllyManager getAllyManager() {
        return allyManager;
    }
    
    public PointsManager getPointsManager() {
        return pointsManager;
    }
    
    public ChatManager getChatManager() {
        return chatManager;
    }
    
    public CooldownManager getCooldownManager() {
        return cooldownManager;
    }
    
    public HomeManager getHomeManager() {
        return homeManager;
    }
    
    public RequestManager getRequestManager() {
        return requestManager;
    }
}