Y

PROJECT: MOON SMP

Plugin Name: MoonAbilities

Version: 1.0.0

Develop a complete, production-ready Minecraft SMP plugin for MOON SMP.

This plugin must include a complete random ability system, kill progression, ability upgrades, Ultra attacks, custom items, a legendary craftable Scythe, Pearl TP, and special Trial Chamber mechanics.

IMPORTANT:

Do not create a demo, prototype, or incomplete implementation. Every feature and command must work with actual Minecraft server mechanics.

---

  1. TECHNICAL REQUIREMENTS
  • Minecraft: Paper 1.21.1+
  • Java: Java 21
  • Build system: Maven
  • Database: SQLite with optional MySQL support.
  • API: Paper API.
  • Adventure API for messages.
  • Persistent player data.
  • Configurable mechanics.
  • Optimized for SMP servers.

Use clean architecture, separate classes for different systems, and proper error handling.

  1. RANDOM ABILITY SYSTEM

Create 20 unique abilities:

  1. INFERNO
  2. THUNDER
  3. VOID
  4. FROST
  5. VAMPIRE
  6. DRAGON
  7. WIND
  8. OCEAN
  9. TOXIC
  10. PHANTOM
  11. SOLAR
  12. CRYSTAL
  13. SPIDER
  14. TITAN
  15. GALAXY
  16. BAT
  17. CURSE
  18. EARTH
  19. GRAVITY
  20. ARCANE

On first join:

  • Assign one random ability.
  • Save the ability permanently.
  • Display an animated ability reveal.
  • Prevent duplicate assignments.
  • Never change the ability after death or reconnecting.

Each ability must have exactly THREE powers:

  • Ability 1: Normal ability.
  • Ability 2: Special ability.
  • Ultra Ability: Ultimate attack.

Players can use Ability 1 and Ability 2 immediately.

Ultra Ability requires upgrading the corresponding ability.

  1. ABILITY POWERS

INFERNO:

  • Flame Burst
  • Hell Dash
  • Ultra: INFERNAL APOCALYPSE

THUNDER:

  • Lightning Strike
  • Thunder Dash
  • Ultra: GOD'S JUDGEMENT

VOID:

  • Void Teleport
  • Black Hole
  • Ultra: DIMENSIONAL COLLAPSE

FROST:

  • Ice Prison
  • Frost Nova
  • Ultra: ETERNAL WINTER

VAMPIRE:

  • Blood Drain
  • Blood Rage
  • Ultra: BLOOD MOON

DRAGON:

  • Dragon Breath
  • Dragon Wings
  • Ultra: DRAGON'S WRATH

WIND:

  • Wind Blast
  • Sky Dash
  • Ultra: TORNADO GOD

OCEAN:

  • Water Blast
  • Tsunami
  • Ultra: POSEIDON'S WRATH

TOXIC:

  • Poison Dart
  • Toxic Cloud
  • Ultra: VENOM APOCALYPSE

PHANTOM:

  • Shadow Step
  • Phantom Mode
  • Ultra: DEATH'S SHADOW

SOLAR:

  • Solar Beam
  • Sun Dash
  • Ultra: SUPERNOVA

CRYSTAL:

  • Crystal Spike
  • Crystal Shield
  • Ultra: CRYSTAL DOMINION

SPIDER:

  • Web Trap
  • Web Swing
  • Ultra: SPIDER KING

TITAN:

  • Ground Smash
  • Titan Rage
  • Ultra: COLOSSAL IMPACT

GALAXY:

  • Star Shot
  • Cosmic Rift
  • Ultra: GALACTIC DESTRUCTION

BAT:

  • Sonic Screech
  • Night Flight
  • Ultra: NIGHTMARE

CURSE:

  • Curse Mark
  • Soul Drain
  • Ultra: CURSED APOCALYPSE

EARTH:

  • Earth Spike
  • Stone Armor
  • Ultra: EARTHQUAKE

GRAVITY:

  • Gravity Pull
  • Gravity Crush
  • Ultra: BLACK SUN

ARCANE:

  • Magic Bolt
  • Arcane Shield
  • Ultra: ABSOLUTE MAGIC

Every ability must have actual mechanics, unique particles, animations, sounds, cooldowns and configurable damage.

  1. KILL PROGRESSION
  • Every 3 valid player kills unlocks one new ability.
  • Show an ability unlock animation.
  • Announce the new ability.
  • Prevent duplicate ability unlocks.
  • Track kills independently.
  • Implement anti-kill-farming protection.
  • Environmental deaths must not count as kills.
  • Save progression permanently.
  1. ABILITY COMMANDS

/ability1 Activate first equipped ability.

/ability2 Activate second equipped ability.

/ultraability Activate unlocked Ultra Ability.

/abilities Open ability management GUI.

/ability withdraw Withdraw an eligible ability into an Ability Book.

/ability upgrade Upgrade selected ability.

/ability give <player> Transfer an eligible ability.

/ability info Show ability information.

/ability cooldown Display cooldowns.

  1. REROLL BOOK

Item name: MOON REROLL BOOK

Appearance:

  • Enchanted Book.
  • Purple and silver design.
  • Moon particles.
  • Custom lore.

Mechanics:

  • Right-click to activate.
  • Open a GUI.
  • Select an owned ability to reroll.
  • Generate a different random ability.
  • Consume the book after successful reroll.
  • Play a reveal animation.
  • Preserve unrelated progression.
  • Prevent duplicate item exploits.

Admin command:

/moonadmin rerollbook give <player> <amount>

  1. MOON UPGRADE CRYSTAL

Item name: MOON UPGRADE CRYSTAL

Appearance:

  • Amethyst Shard or Nether Star.
  • Glowing purple effects.
  • Custom lore.

Mechanics:

  • Required to upgrade abilities.
  • Open /abilities.
  • Select an ability.
  • Click Upgrade.
  • Verify requirements.
  • Consume the required crystal.
  • Play awakening animation.
  • Unlock that ability's Ultra Ability.

All upgrade requirements must be configurable.

Admin command:

/moonadmin upgradecrystal give <player> <amount>

  1. ULTRA ABILITY SYSTEM

Each ability has a unique Ultra Ability.

Requirements:

  • Must be unlocked through upgrading.
  • Command: /ultraability
  • Cooldown: 24 HOURS.
  • Cooldown survives server restarts.
  • Store cooldowns using timestamps.
  • Unique particles and animations.
  • Configurable damage and range.
  • Safe-zone protection.
  • Command spam protection.
  1. LEGENDARY MOON SCYTHE

Item name:

✦ MOON SCYTHE ✦

This weapon must use actual Minecraft MACE combat mechanics.

Appearance:

  • Curved scythe blade.
  • Black handle.
  • Purple and silver glowing effects.
  • Custom attack particles.
  • Unique sound effects.

Special powers:

  1. Mace-based smash attacks.
  2. Purple impact particles.
  3. Custom impact sound.
  4. Landing shockwave.
  5. Configurable bonus damage.
  6. Special kill animation.

Crafting Recipe

Create an expensive custom crafting recipe.

Suggested ingredients:

  • 1 Heavy Core.
  • 1 Nether Star.
  • 4 Echo Shards.
  • 3 Amethyst Blocks.

Recipe must be configurable.

Requirements:

  • Prevent shift-click duplication.
  • Preserve weapon identity.
  • Prevent anvil exploits.
  • Correctly handle item movement.
  • Ensure Mace mechanics are not applied twice.
  • Preserve functionality after restart.

Admin command:

/moonadmin scythe give <player>

  1. PEARL TP — NEW CUSTOM ITEM

Create a special teleportation item called:

✦ PEARL TP ✦

Appearance

  • Material: ENDER PEARL.
  • Custom display name: §5✦ PEARL TP ✦
  • Purple enchanted glow.
  • Custom moon-themed lore.
  • Unique item identifier.
  • Optional custom texture support.

CRAFTING RECIPE

The item must be craftable using a vanilla crafting table.

Recipe:

Obsidian| Obsidian| Obsidian Obsidian| Ender Pearl| Obsidian Obsidian| Obsidian| Obsidian

Total ingredients:

  • 8 Obsidian.
  • 1 Ender Pearl in the center.

Crafting must produce exactly one Pearl TP.

PEARL TP MECHANICS

The Pearl TP allows a player to teleport directly to another player.

How it works:

  1. Player A obtains a Pearl TP.
  2. Player B also needs a Pearl TP.
  3. Both players must possess at least one valid Pearl TP.
  4. Player A holds the Pearl TP in their main hand.
  5. Player A uses the "/pearltp <player>" command.
  6. The plugin verifies both players.
  7. The target player receives a teleport request.
  8. Target player accepts the request.
  9. Player A teleports to Player B.

IMPORTANT:

Both players must have the Pearl TP item in their inventory when the teleport request is initiated and when it is accepted.

PERMISSION REQUIREMENT

Teleportation requires a specific permission:

"moonabilities.pearltp.use"

Without this permission:

  • Players cannot send teleport requests.
  • Players cannot teleport using Pearl TP.
  • Show a configurable permission-denied message.

The target player must also have the permission.

COMMANDS

/pearltp <player> Send a teleport request.

/pearltp accept Accept a teleport request.

/pearltp deny Reject a teleport request.

/pearltp toggle Enable or disable incoming requests.

/pearltp reload Admin configuration reload.

TELEPORTATION CONDITIONS

Before teleporting, verify:

  • Sender has Pearl TP.
  • Target has Pearl TP.
  • Both players have the required permission.
  • Both players are online.
  • Target has accepted the request.
  • Request has not expired.
  • Neither player is dead.
  • Neither player is in a restricted state.
  • Destination is safe.
  • Neither player is in a protected region where teleportation is prohibited.

Additional protections:

  • Configurable request expiration.
  • Configurable teleport cooldown.
  • No teleportation during combat.
  • No teleportation into lava or dangerous locations.
  • No teleportation into solid blocks.
  • Prevent teleport requests to yourself.
  • Prevent duplicate pending requests.
  • Prevent request spam.
  • Cancel requests if either player disconnects.
  • Recheck all conditions immediately before teleporting.

ITEM CONSUMPTION

Pearl TP must NOT disappear after every teleport.

It is a reusable special item.

Only crafting consumes the ingredients.

The item must have a unique persistent identifier so normal Ender Pearls cannot activate Pearl TP mechanics.

ADMIN COMMANDS

/moonadmin pearltp give <player> <amount>

/moonadmin pearltp reload

/moonadmin pearltp cooldown reset <player>

PERMISSIONS

moonabilities.pearltp.use moonabilities.pearltp.admin

All permissions must be registered in plugin.yml.

  1. ABILITY WITHDRAW AND TRADING

Players can withdraw eligible abilities into special Ability Books.

Requirements:

  • Unique UUID per book.
  • Transferable between players.
  • Tradeable and sellable.
  • Server-side ownership verification.
  • Preserve upgrade information.
  • Prevent duplicate ownership.
  • Atomic database transactions.
  • Correct death and disconnect handling.
  1. OMINOUS VAULT — HEAVY CORE FEATURE

Implement a special Trial Chamber mechanic.

For each player:

  • First successful Ominous Vault key use: Normal vanilla loot.
  • Second successful use: Normal vanilla loot.
  • Third successful use: Guarantee one Heavy Core.

Repeat this cycle.

Requirements:

  • Separate player progress.
  • Permanent saving.
  • No duplicate rewards.
  • Do not break vanilla vault mechanics.
  • Crash recovery.
  • Configurable rewards and messages.
  1. PREMIUM GUI

Create a Moon SMP-themed GUI.

Design:

  • Dark purple.
  • Black.
  • Silver.
  • Moon-themed icons.
  • Animated borders.
  • Ability rarity.
  • Upgrade buttons.
  • Ultra unlock status.
  • Cooldown display.
  • Reroll Book section.
  • Pearl TP information.
  • Moon Scythe information.
  1. ADMIN COMMANDS

/moonadmin give <player> <ability>

/moonadmin remove <player> <ability>

/moonadmin reset <player>

/moonadmin setkills <player> <amount>

/moonadmin upgrade <player> <ability>

/moonadmin unlockultra <player> <ability>

/moonadmin rerollbook give <player> <amount>

/moonadmin upgradecrystal give <player> <amount>

/moonadmin scythe give <player>

/moonadmin pearltp give <player> <amount>

/moonadmin cooldown reset <player>

/moonadmin reload

All commands must have appropriate permission checks.

  1. CONFIGURATION FILES

Create:

config.yml abilities.yml messages.yml cooldowns.yml gui.yml vault.yml moon_scythe.yml upgrade.yml reroll.yml pearl_tp.yml

Every major gameplay mechanic must be configurable.

  1. DATABASE AND ANTI-DUPE SYSTEM

Persist:

  • Player abilities.
  • Kill progression.
  • Ability ownership.
  • Upgrade progression.
  • Ultra unlocks.
  • Cooldowns.
  • Reroll history.
  • Special item identities.
  • Moon Scythe ownership.
  • Pearl TP crafting and configuration data.
  • Ominous Vault progress.

Implement:

  • UUID-based item verification.
  • Atomic transactions.
  • Inventory transaction protection.
  • Crash recovery.
  • Death recovery.
  • Disconnect recovery.
  • Restart recovery.
  • Concurrent transaction protection.
  • Duplicate item detection.
  • Permission validation.
  • Cooldown persistence.

Never trust display names or lore alone for item verification.

  1. PERFORMANCE
  • Optimize for public SMP servers.
  • Avoid unnecessary repeating tasks.
  • Avoid excessive entity spawning.
  • Avoid expensive synchronous database operations.
  • Clean up temporary entities.
  • Prevent memory leaks.
  • Avoid unnecessary chunk loading.
  • Handle multiple players using abilities simultaneously.
  1. COMPLETE TESTING

Test all features:

  1. First-join random assignment.
  2. Three-kill ability progression.
  3. All 20 abilities.
  4. Ability 1.
  5. Ability 2.
  6. All 20 Ultra abilities.
  7. Upgrade system.
  8. 24-hour cooldown persistence.
  9. Reroll Book.
  10. Moon Upgrade Crystal.
  11. Ability withdrawal.
  12. Ability trading.
  13. Moon Scythe crafting.
  14. Actual Mace mechanics.
  15. Pearl TP crafting.
  16. Pearl TP player requirements.
  17. Pearl TP permission checks.
  18. Pearl TP request acceptance and denial.
  19. Pearl TP safe destination validation.
  20. Ominous Vault Heavy Core guarantee.
  21. Death recovery.
  22. Disconnect recovery.
  23. Server restart recovery.
  24. Anti-dupe protection.
  25. GUI functionality.
  26. Multiple simultaneous players.

Fix all discovered bugs before release.

  1. FINAL DELIVERY

Provide:

  • Complete Java source code.
  • Compiled plugin JAR.
  • Maven project.
  • plugin.yml.
  • All configuration files.
  • Installation guide.
  • Admin command documentation.
  • Permission documentation.
  • Testing report.

FINAL DEVELOPMENT INSTRUCTIONS

Build MoonAbilities as a complete production-ready plugin for MOON SMP.

Do not skip features.

Do not provide placeholder implementations.

Do not leave commands unfinished.

Do not use fake item mechanics.

All custom items must have real server-side functionality.

All player progression must persist after restart.

All trading and inventory operations must be protected against duplication.

All abilities must have exactly two normal powers and one Ultra Ability.

Ultra Ability cooldown must be 24 hours.

Pearl TP must require both players to own the item and possess the required permission.

The Moon Scythe must use actual Mace mechanics while remaining a custom-named legendary Scythe.

The final plugin must be stable, optimized, secure and ready for a real public Minecraft SMP server.

Kodari AI
KodariNov 5 at 8:36 am 13
MoonAbilities
MoonAbilities is a comprehensive SMP plugin for Paper 1.21.1 that introduces a random ability system with 20 unique abilities, each featuring two normal powers and an unlockable Ultra Ability. It includes kill-based progression, ability upgrading via Moon Upgrade Crystals, and a reroll system using Moon Reroll Books. The plugin adds the legendary Moon Scythe with Mace mechanics, a Pearl TP item for player-to-player teleportation with permissions, and an Ominous Vault Heavy Core guarantee system. Features a premium GUI, persistent SQLite/MySQL storage, anti-dupe protections, and extensive admin commands for full server control.
  1. Set up the Paper 1.21.11 plugin, configuration, SQLite/MySQL persistence, and player progression.

  2. Implement all 20 abilities, kill unlocks, upgrades, cooldowns, books, and anti-duplicate claims.

  3. Add the Scythe, Pearl TP, protected teleport requests, and Ominous Vault reward cycle.

  4. Wire GUIs, commands, recipes, permissions, installation/admin docs, and an honest test checklist.

Created the MoonAbilities Paper plugin project targeting Minecraft 1.21.11 / Java 21, with the 20-ability system, persistent progression, upgrades and cooldowns, custom items, GUI, commands, recipes, and SQLite with optional MySQL.

  • Added all requested configuration files, plugin.yml, an installation/admin guide, and a testing checklist.

  • The project uses Gradle, not Maven, following the workspace build convention. Safe zones use configurable cuboids; external region plugins are not integrated automatically.

  • Live gameplay tests were not run; TESTING.md marks the checks as unverified.

To get the compiled jar: click Compile in the desktop top bar, or ⋮ → Compile Project on phone; click Compile, then Download on the successful build.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
README.md
settings.gradle
TESTING.md
Code
34 3,379
src/main/java/com/moonsmp/moonabilities/MoonAbilitiesPlugin.java
package com.moonsmp.moonabilities;

import com.moonsmp.moonabilities.command.AbilityCommand;
import com.moonsmp.moonabilities.command.MoonAdminCommand;
import com.moonsmp.moonabilities.command.PearlTPCommand;
import com.moonsmp.moonabilities.gui.MenuService;
import com.moonsmp.moonabilities.listener.GameplayListener;
import com.moonsmp.moonabilities.service.AbilityPowerEngine;
import com.moonsmp.moonabilities.service.AbilityService;
import com.moonsmp.moonabilities.service.PearlTeleportService;
import com.moonsmp.moonabilities.service.UpgradeService;
import com.moonsmp.moonabilities.service.VaultService;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;

public final class MoonAbilitiesPlugin extends JavaPlugin {
    private static final List<String> CONFIG_FILES = List.of("abilities.yml", "messages.yml", "cooldowns.yml", "gui.yml", "vault.yml", "moon_scythe.yml", "upgrade.yml", "reroll.yml", "pearl_tp.yml");
    private final Map<String, FileConfiguration> customConfigs = new HashMap<>();
    private final Map<UUID, PlayerProfile> profiles = new ConcurrentHashMap<>();
    private final java.util.Set<UUID> pendingDeliveries = ConcurrentHashMap.newKeySet();
    private PlayerDataStore dataStore;
    private CustomItemService items;
    private ProtectionService protection;
    private CombatService combat;
    private AbilityPowerEngine powerEngine;
    private UpgradeService upgradeService;
    private AbilityService abilityService;
    private PearlTeleportService pearlTeleportService;
    private MenuService menuService;
    private VaultService vaultService;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        loadCustomConfigs();
        dataStore = new PlayerDataStore(this);
        try {
            dataStore.initialize();
        } catch (Exception exception) {
            getLogger().log(Level.SEVERE, "Could not initialize MoonAbilities database.", exception);
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        items = new CustomItemService(this);
        protection = new ProtectionService(this);
        combat = new CombatService(this);
        powerEngine = new AbilityPowerEngine(this);
        upgradeService = new UpgradeService(this);
        abilityService = new AbilityService(this, powerEngine);
        pearlTeleportService = new PearlTeleportService(this);
        menuService = new MenuService(this);
        vaultService = new VaultService(this);
        getServer().getPluginManager().registerEvents(new GameplayListener(this), this);
        getServer().getPluginManager().registerEvents(menuService, this);
        getServer().getPluginManager().registerEvents(vaultService, this);
        registerCommands();
        registerRecipes();
        for (Player player : Bukkit.getOnlinePlayers()) loadPlayer(player);
        getLogger().info("MoonAbilities 1.0.0 enabled with " + Ability.values().length + " abilities.");
    }

    @Override
    public void onDisable() {
        if (dataStore != null) dataStore.shutdown();
        profiles.clear();
    }

    private void registerCommands() {
        AbilityCommand ability = new AbilityCommand(this);
        Objects.requireNonNull(getCommand("ability")).setExecutor(ability);
        Objects.requireNonNull(getCommand("ability1")).setExecutor(ability);
        Objects.requireNonNull(getCommand("ability2")).setExecutor(ability);
        Objects.requireNonNull(getCommand("ultraability")).setExecutor(ability);
        Objects.requireNonNull(getCommand("abilities")).setExecutor(ability);
        Objects.requireNonNull(getCommand("pearltp")).setExecutor(new PearlTPCommand(this));
        Objects.requireNonNull(getCommand("moonadmin")).setExecutor(new MoonAdminCommand(this));
    }

    private void loadCustomConfigs() {
        customConfigs.clear();
        for (String name : CONFIG_FILES) {
            File file = new File(getDataFolder(), name);
            if (!file.exists()) saveResource(name, false);
            customConfigs.put(name, YamlConfiguration.loadConfiguration(file));
        }
    }

    public void reloadPluginConfigs() {
        reloadConfig();
        loadCustomConfigs();
        registerRecipes();
    }

    private void registerRecipes() {
        NamespacedKey pearlKey = new NamespacedKey(this, "pearl_tp_recipe");
        NamespacedKey scytheKey = new NamespacedKey(this, "moon_scythe_recipe");
        Bukkit.removeRecipe(pearlKey);
        Bukkit.removeRecipe(scytheKey);
        if (pearlConfig().getBoolean("recipe.enabled", true)) {
            Material obsidian = items.resolveMaterial("OBSIDIAN");
            Material pearl = items.resolveMaterial("ENDER_PEARL");
            if (obsidian != null && pearl != null) {
                ShapedRecipe recipe = new ShapedRecipe(pearlKey, items.pearlTp());
                recipe.shape("OOO", "OPO", "OOO");
                recipe.setIngredient('O', obsidian);
                recipe.setIngredient('P', pearl);
                Bukkit.addRecipe(recipe);
            } else getLogger().warning("Could not register Pearl TP recipe: unresolved XSeries materials.");
        }
        ConfigurationSection section = scytheConfig().getConfigurationSection("recipe");
        if (section == null || !section.getBoolean("enabled", true)) return;
        List<String> shape = section.getStringList("shape");
        ConfigurationSection ingredients = section.getConfigurationSection("ingredients");
        if (shape.isEmpty() || shape.size() > 3 || ingredients == null || shape.stream().anyMatch(row -> row.length() > 3)) {
            getLogger().warning("Moon Scythe recipe configuration is invalid; recipe skipped.");
            return;
        }
        for (String row : shape) {
            for (char symbol : row.toCharArray()) {
                if (symbol != ' ' && !ingredients.contains(Character.toString(symbol))) {
                    getLogger().warning("Moon Scythe recipe is missing ingredient mapping for " + symbol);
                    return;
                }
            }
        }
        ShapedRecipe recipe = new ShapedRecipe(scytheKey, items.scythe());
        recipe.shape(shape.toArray(new String[0]));
        for (String symbol : ingredients.getKeys(false)) {
            if (symbol.length() != 1) continue;
            Material material = items.resolveMaterial(ingredients.getString(symbol));
            if (material == null) { getLogger().warning("Unknown Moon Scythe ingredient: " + ingredients.getString(symbol)); return; }
            recipe.setIngredient(symbol.charAt(0), material);
        }
        Bukkit.addRecipe(recipe);
    }

    public void loadPlayer(Player player) {
        UUID uuid = player.getUniqueId();
        dataStore.loadOrCreate(uuid, Ability.random()).whenComplete((profile, error) -> {
            if (error != null) { getLogger().log(Level.SEVERE, "Could not load MoonAbilities data for " + uuid, error); return; }
            Bukkit.getScheduler().runTask(this, () -> {
                Player online = Bukkit.getPlayer(uuid);
                if (online == null) return;
                profiles.put(uuid, profile);
                if (profile.isFirstJoin()) {
                    Messages.send(this, online, "first-ability", Map.of("ability", abilityService.display(profile.getFirstAbility())));
                    abilityService.reveal(online, profile.getFirstAbility());
                }
                deliverPendingGrants(online);
            });
        });
    }

    public void unloadPlayer(UUID uuid) {
        profiles.remove(uuid);
        if (pearlTeleportService != null) pearlTeleportService.cancelFor(uuid);
        if (combat != null) combat.clear(uuid);
        if (menuService != null) menuService.cancelAnimation(uuid);
    }

    public void deliverPendingGrants(Player player) {
        UUID uuid = player.getUniqueId();
        if (!pendingDeliveries.add(uuid)) return;
        dataStore.pendingGrants(uuid).whenComplete((grants, error) -> Bukkit.getScheduler().runTask(this, () -> {
            Player online = Bukkit.getPlayer(uuid);
            if (error != null) {
                pendingDeliveries.remove(uuid);
                getLogger().log(Level.SEVERE, "Could not load pending item grants for " + uuid, error);
                return;
            }
            if (online == null) { pendingDeliveries.remove(uuid); return; }
            List<CompletableFuture<Void>> completed = new ArrayList<>();
            for (PlayerDataStore.PendingGrant grant : grants) {
                if (items.hasGrantId(online, grant.id())) { completed.add(dataStore.completeGrant(grant.id())); continue; }
                ItemStack item = items.itemForGrant(grant);
                if (item == null) { getLogger().warning("Could not construct pending grant " + grant.id()); continue; }
                if (online.getInventory().addItem(item).isEmpty()) completed.add(dataStore.completeGrant(grant.id()));
                else Messages.send(this, online, "grant-inventory-full");
            }
            CompletableFuture.allOf(completed.toArray(new CompletableFuture[0])).whenComplete((ignored, completionError) -> pendingDeliveries.remove(uuid));
        }));