crazygamerz0137

PROJECT NAME: CrazyNetworkBot

AUTHOR: CrazyNetwork PACKAGE: com.crazynetwork.bot

Create a production-ready Java 21 Maven Discord bot integrated with a Paper 1.21.11 Minecraft server.

========================================= GENERAL REQUIREMENTS =========================================

  • Java 21
  • Maven
  • JDA latest version
  • YAML storage only
  • Async tasks
  • Modular structure
  • Production-ready code
  • Memory optimized
  • Fully configurable
  • Large server support
  • Error handling everywhere
  • Comments on important methods

========================================= MODULES =========================================

  1. Discord ↔ Minecraft Account Linking
  2. Discord Vote System
  3. Vote Rewards
  4. Vote Streak System
  5. Vote Leaderboards
  6. Offline Reward Queue
  7. Logging System
  8. Professional Ticket System
  9. Staff Statistics
  10. Anti-Abuse System

========================================= ACCOUNT LINKING SYSTEM =========================================

Minecraft commands:

/link /unlink /linkinfo

Discord commands:

/linkaccount <code> /unlinkaccount /linkinfo

When player uses /link:

Generate a random 6-digit code.

Example:

Your link code is: 528193

Use:

/linkaccount 528193

in Discord.

Requirements:

  • Codes expire after configurable time.
  • One Discord account = one Minecraft account.
  • One Minecraft account = one Discord account.
  • Prevent duplicate linking.
  • Save Discord ID and UUID.
  • Confirmation messages on both sides.

Files:

links.yml

========================================= DISCORD VOTE SYSTEM =========================================

Discord command:

/vote

Requirements:

  • Account must be linked.
  • Bot finds linked IGN automatically.
  • No IGN argument required.
  • Cooldown support.
  • Prevent duplicate rewards.
  • Save vote count.

========================================= VOTE CHANNEL RESTRICTION =========================================

config.yml:

vote: channels: - 1234567890 - 9876543210

Only those channels may use /vote.

Else:

❌ You can only vote inside the configured vote channel.

Admins bypass restriction.

========================================= REWARD SYSTEM =========================================

Unlimited rewards.

Example:

rewards: vote: commands: - "crate give %player% Vote 1"

Support:

  • ExcellentCrates
  • CrazyCrates
  • ReviveCrates

========================================= MILESTONE REWARDS =========================================

10 votes 25 votes 50 votes 100 votes 250 votes 500 votes 1000 votes

========================================= STREAK SYSTEM =========================================

Track:

  • Daily streak
  • Weekly streak
  • Monthly streak

Bonus rewards.

========================================= OFFLINE REWARDS =========================================

If player is offline:

Queue rewards.

Deliver next join.

========================================= LEADERBOARDS =========================================

Minecraft:

/vote top

Discord:

/votetop

Show top voters.

========================================= STATISTICS =========================================

Minecraft:

/vote stats

Discord:

/votestats

Display:

  • Total votes
  • Current streak
  • Highest streak
  • Rank

========================================= PLACEHOLDERAPI =========================================

%cn_votes% %cn_rank% %cn_streak% %cn_total%

========================================= LOGGING SYSTEM =========================================

Separate channels:

Vote Logs Link Logs Reward Logs Ticket Logs Staff Logs

Embeds should contain:

Username IGN Time Action

========================================= EMBEDS =========================================

Modern embeds.

Use:

  • Hex colors
  • Footer icons
  • Timestamps

========================================= PROFESSIONAL DISCORD TICKET SYSTEM =========================================

Command:

/setup-tickets

Create embed with buttons.

Buttons:

🎫 Support 💰 Purchase 🐞 Bug Report ⚒ Staff Report 📢 Other

========================================= TICKET CHANNELS =========================================

Examples:

ticket-ansh bug-ansh purchase-ansh

========================================= TICKET PERMISSIONS =========================================

Visible only to:

  • Ticket creator
  • Staff roles
  • Administrators
  • Bot

========================================= TICKET COMMANDS =========================================

/close /claim /reopen /delete /transcript /add /remove /rename

========================================= TICKET BUTTONS =========================================

Close Ticket Delete Ticket Claim Ticket Transcript

========================================= CLAIM SYSTEM =========================================

Only one staff member may claim.

Store claim history.

========================================= TRANSCRIPTS =========================================

Generate HTML transcripts.

Include:

Messages Embeds Attachments Timestamps

Send transcript to logs channel.

========================================= AUTO CLOSE =========================================

Configurable.

Default:

48 hours

========================================= TICKET LIMITS =========================================

Maximum:

3 open tickets

========================================= COOLDOWNS =========================================

Prevent ticket spam.

========================================= BLACKLIST SYSTEM =========================================

Commands:

/ticket blacklist add /ticket blacklist remove

========================================= PRIORITY SYSTEM =========================================

Low Medium High Critical

========================================= TICKET RATINGS =========================================

After closing:

⭐⭐⭐⭐⭐

Save ratings.

========================================= STAFF STATISTICS =========================================

Track:

Tickets claimed Tickets closed Average response time Average rating

Command:

/staffstats

========================================= WELCOME MESSAGE =========================================

Welcome to CrazyNetwork Support.

Please explain your issue.

A staff member will assist you shortly.

========================================= ANTI-ABUSE =========================================

  • Duplicate protection
  • Cooldowns
  • Button spam prevention
  • Permission checks
  • Reward abuse prevention
  • Multi-account protection

========================================= FILES =========================================

config.yml messages.yml votes.yml links.yml rewards.yml tickets.yml ticket-messages.yml staff-stats.yml blacklist.yml

========================================= PERMISSIONS =========================================

cn.vote cn.admin cn.reload cn.ticket.staff cn.ticket.admin

========================================= PERFORMANCE =========================================

  • Async saving
  • Automatic backups
  • Thread safety
  • Memory optimization
  • Error handling
  • Production ready

========================================= EXTRA FEATURES =========================================

  1. Vote reminders
  2. Vote history
  3. Broadcast vote messages
  4. Rich embeds
  5. Future expansion support
  6. MiniMessage support
  7. Hex colors
  8. Tab completion
  9. Reload command
  10. Offline support
  11. Staff analytics
  12. Ticket ratings
  13. HTML transcripts
  14. Priority tickets
  15. Cooldowns
  16. Vote milestones
  17. Monthly rewards
  18. Weekly rewards
  19. Daily rewards
  20. Modular architecture

Generate clean, maintainable, enterprise-level code suitable for large Minecraft networks.

Kodari AI
KodariJun 17 at 6:46 am 145
CrazyNetworkBot
A production-ready Paper 1.21.1 plugin that embeds a full-featured JDA Discord bot. Includes bidirectional account linking with expiring codes, a cooldown-based vote system with streaks, milestone &amp; offline rewards, a five-tier ticket system with HTML transcripts and ratings, staff statistics tracking, an anti-abuse blacklist, per-category logging channels, and PlaceholderAPI support — all backed by async YAML storage with read/write locking.

42 files generated. Here’s a summary of everything built:

Build — pom.xml with JDA 5.2.1 shaded + relocated, Paper 1.21.1, PlaceholderAPI, and Lombok.

Data layer — Thread-safe YamlStorage base using ReadWriteLock, with write-through async saves. Five typed storage classes: LinkStorage, VoteStorage, TicketStorage, StaffStatsStorage, BlacklistStorage.

Account Linking — /link generates a unique 6-digit expiring code. /linkaccount <code> in Discord consumes it, verifies both sides aren’t already linked, notifies the Minecraft player in real-time, and logs to the link-log channel.

Vote System — /vote restricts to configured channels, checks cooldown, resolves IGN from the linked account, updates daily/weekly/monthly streaks, delivers rewards (or queues them offline), broadcasts to Minecraft, and emits a rich log embed.

Rewards — Configurable base rewards, 7 milestone tiers (10→1000 votes), and streak bonuses for daily/weekly/monthly — all with unlimited commands and MiniMessage player messages.

Ticket System — /setup-tickets posts a 5-button panel. Each click creates a private channel with correct role/member permission overrides. Full lifecycle: claim → close → rate (DM stars) → transcript → delete with 5s delay. Auto-close scheduled every 30 min. Max 3 tickets, per-user cooldown, and blacklist enforcement throughout.

HTML Transcripts — Discord-dark-theme styled self-contained HTML with messages, embeds, and attachment links.

Staff Stats — Claims, closures, average response time, and running average ratings tracked per Discord ID.

To get started: set discord.token, discord.guild-id, plus the channel and category IDs in config.yml, then build with mvn package.

crazygamerz0137

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java at line 128: illegal text block open delimiter sequence, missing line terminator
                   .replace("\"", """)
                                     ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java

Please fix this error by creating a new artifact with the corrected code.

crazygamerz0137

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java at line 128: illegal text block open delimiter sequence, missing line terminator
                   .replace("\"", """)
                                     ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java

Please fix this error by creating a new artifact with the corrected code.

crazygamerz0137

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java at line 128: illegal text block open delimiter sequence, missing line terminator
                   .replace("\"", """)
                                     ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java

Please fix this error by creating a new artifact with the corrected code.

crazygamerz0137

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java at line 128: illegal text block open delimiter sequence, missing line terminator
                   .replace("\"", """)
                                     ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/crazynetwork/bot/utils/TranscriptUtil.java

Please fix this error by creating a new artifact with the corrected code.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
42 3,464
src/main/java/com/crazynetwork/bot/CrazyNetworkBot.java
package com.crazynetwork.bot;

import com.crazynetwork.bot.discord.DiscordBot;
import com.crazynetwork.bot.managers.*;
import com.crazynetwork.bot.minecraft.commands.CnAdminCommand;
import com.crazynetwork.bot.minecraft.commands.LinkCommand;
import com.crazynetwork.bot.minecraft.commands.VoteCommand;
import com.crazynetwork.bot.minecraft.listeners.PlayerJoinListener;
import com.crazynetwork.bot.placeholders.CrazyNetworkExpansion;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class CrazyNetworkBot extends JavaPlugin {

    @Getter private static CrazyNetworkBot instance;

    @Getter private ConfigManager configManager;
    @Getter private DiscordBot discordBot;
    @Getter private LinkManager linkManager;
    @Getter private VoteManager voteManager;
    @Getter private RewardManager rewardManager;
    @Getter private OfflineRewardManager offlineRewardManager;
    @Getter private TicketManager ticketManager;
    @Getter private StaffStatsManager staffStatsManager;
    @Getter private BlacklistManager blacklistManager;

    @Override
    public void onEnable() {
        instance = this;

        configManager = new ConfigManager(this);
        configManager.loadAll();

        linkManager = new LinkManager(this);
        voteManager = new VoteManager(this);
        rewardManager = new RewardManager(this);
        offlineRewardManager = new OfflineRewardManager(this);
        ticketManager = new TicketManager(this);
        staffStatsManager = new StaffStatsManager(this);
        blacklistManager = new BlacklistManager(this);

        discordBot = new DiscordBot(this);
        discordBot.start();

        registerCommands();
        registerListeners();

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

        startAutoSaveTask();
        getLogger().info("CrazyNetworkBot v" + getDescription().getVersion() + " enabled.");
    }

    @Override
    public void onDisable() {
        if (linkManager != null) linkManager.saveAll();
        if (voteManager != null) voteManager.saveAll();
        if (ticketManager != null) ticketManager.saveAll();
        if (staffStatsManager != null) staffStatsManager.saveAll();
        if (blacklistManager != null) blacklistManager.saveAll();
        if (discordBot != null) discordBot.shutdown();
        getLogger().info("CrazyNetworkBot disabled.");
    }

    private void registerCommands() {
        LinkCommand linkCommand = new LinkCommand(this);
        getCommand("link").setExecutor(linkCommand);
        getCommand("unlink").setExecutor(linkCommand);
        getCommand("linkinfo").setExecutor(linkCommand);

        VoteCommand voteCommand = new VoteCommand(this);
        getCommand("vote").setExecutor(voteCommand);
        getCommand("vote").setTabCompleter(voteCommand);

        CnAdminCommand cnAdmin = new CnAdminCommand(this);
        getCommand("cn").setExecutor(cnAdmin);
        getCommand("cn").setTabCompleter(cnAdmin);
    }

    private void registerListeners() {
        getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
    }

    /** Periodically flushes all in-memory caches to disk. */
    private void startAutoSaveTask() {
        long intervalTicks = configManager.getConfig().getLong("backup.interval-minutes", 60) * 1200L;
        getServer().getScheduler().runTaskTimerAsynchronously(this, () -> {
            linkManager.saveAll();
            voteManager.saveAll();
            ticketManager.saveAll();
            staffStatsManager.saveAll();
        }, intervalTicks, intervalTicks);
    }

    /** Hot-reload all configs and invalidate manager caches. */
    public void reload() {
        configManager.loadAll();
        rewardManager.reload();
        linkManager.reload();
        voteManager.reload();
        ticketManager.reload();
    }
}