Spigot Plugin

RiftStats

Create a premium-quality Minecraft Paper plugin called **RiftStats**. Requirements: - Java 21 - Support Paper 1.21.4–1.21.8 - Automatically detect and hook into Citizens if it is installed (no manual version configuration). - Clean, optimized, and asynchronous where possible. - Well-structured code with comments. - Full config.yml, messages.yml, and plugin.yml. /stats GUI When a player executes: /stats Open a modern, animated inventory GUI with a clean design. Display the player's statistics: ⚔ Kills ☠ Deaths ⏱ Playtime Each statistic should have: - Beautiful item icons

Read the full description

- Custom names using MiniMessage gradients - Clean lore - Premium-looking layout - Decorative glass panes around the GUI Example: ⚔ Your Statistics Kills: 154 Deaths: 29 Playtime: 18h 42m Leaderboard Button In the bottom-right corner of the GUI, place a button called: 🏆 Leaderboards Clicking it opens another GUI containing three categories: ⚔ Top Kills ☠ Top Deaths ⏱ Top Playtime Each category should display the Top 5 players. Example: ⚔ Top Kills 🥇 #1 Steve - 542 🥈 #2 Alex - 501 🥉 #3 Rift - 420 4️⃣ Notch - 388 5️⃣ Dream - 350 Example for Deaths: ☠ Top Deaths 🥇 #1 Steve - 230 🥈 #2 Alex - 211 🥉 #3 Rift - 185 4️⃣ Notch - 170 5️⃣ Dream - 165 Example for Playtime: ⏱ Top Playtime 🥇 #1 Steve - 312h 🥈 #2 Alex - 287h 🥉 #3 Rift - 260h 4️⃣ Notch - 244h 5️⃣ Dream - 229h NPC Integration Command: /stats create <name> Requirements: - Creates a Citizens NPC at the player's location. - NPC uses the provided name. - NPC automatically opens the /stats GUI when right-clicked. - No additional setup required. - Automatically hooks into Citizens if installed. - If Citizens is missing, display a friendly error message. Commands /stats Open your statistics GUI. /stats create <name> Create a Citizens NPC that opens the Stats GUI. /stats reload Reload plugin configuration. Permissions riftstats.use riftstats.create riftstats.reload Statistics Use Paper API statistics where possible. Track: - Player Kills - Deaths - Total Playtime Playtime should be displayed in: Days Hours Minutes Example: 1d 4h 37m Design Use MiniMessage gradients and modern colors. Theme: - Cyan - Blue - Purple - Gold accents Inventory should look premium with: - Animated title (optional) - Decorative borders - Clean spacing - High-quality icons - Professional lore formatting Performance - No memory leaks - Async leaderboard loading - Efficient caching - Optimized for servers with 500+ players - Minimal CPU usage Deliverables Generate the complete Maven project including: - src/ - pom.xml - plugin.yml - config.yml - messages.yml The project must compile without errors and produce a ready-to-use RiftStats.jar.

src/main/java/eu/codexe/riftstats/RiftStatsPlugin.java
package eu.codexe.riftstats;

import eu.codexe.riftstats.commands.StatsCommand;
import eu.codexe.riftstats.config.Config;
import eu.codexe.riftstats.config.Messages;
import eu.codexe.riftstats.listeners.PlayerJoinListener;
import eu.codexe.riftstats.listeners.NPCInteractListener;
import eu.codexe.riftstats.storage.StorageManager;
import eu.codexe.riftstats.storage.SQLiteStorage;
import eu.codexe.riftstats.citizens.CitizensHook;
import org.bukkit.plugin.java.JavaPlugin;

/**
 * RiftStats - Premium player statistics plugin
 * Tracks kills, deaths, and playtime with beautiful GUIs and leaderboards
 */
public class RiftStatsPlugin extends JavaPlugin {

    private static RiftStatsPlugin instance;
    private Config config;
    private Messages messages;
    private StorageManager storage;
    private CitizensHook citizensHook;

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

        getLogger().info("═══════════════════════════════════════");
        getLogger().info("  RiftStats v1.0.0 - Initializing...");
        getLogger().info("═══════════════════════════════════════");

        // Load configuration
        config = new Config(this);
        messages = new Messages(this);

        // Initialize storage
        storage = new SQLiteStorage(this);
        if (!storage.initialize()) {
            getLogger().severe("Failed to initialize storage! Disabling plugin...");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        // Initialize Citizens hook
        citizensHook = new CitizensHook(this);
        citizensHook.initialize();

        // Register commands
        getCommand("stats").setExecutor(new StatsCommand(this));

        // Register listeners
        getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
        if (citizensHook.isCitizensLoaded()) {
            getServer().getPluginManager().registerEvents(new NPCInteractListener(this), this);
        }

        getLogger().info("═══════════════════════════════════════");
        getLogger().info("  RiftStats enabled successfully!");
        getLogger().info("  Citizens: " + (citizensHook.isCitizensLoaded() ? "✓ Hooked" : "✗ Not loaded"));