kcdxb
📎 1 file 2,449 chars
📄
pasted-code-1786920582127.txt
txt 39 lines
▶
Build a Paper plugin (Java 21, Minecraft 1.21.x) called "VexisShards" for server VexisSMP — 9 unique magic shards with active abilities.

## Concept
On first join, player randomly receives one of 9 shards as an item (custom name, lore, enchant glint). Assignment persistent per player (UUID), survives death/restarts.

## Item behavior
- Cannot be dropped or put into containers — stays in inventory.
- Returns to inventory on respawn if lost on death.
- Normal right-click does nothing.
- Shift+Right-click activates ability if not on cooldown.
- Right-click without sneaking → action bar hint "hold shift to activate".

## First join
Randomly assign type, give item, show title with shard name, chat message (name, ability, activation), play sound.

## HUD
Action bar every second: ": ✅" (ready) or ": s" (cooldown).

## The 9 shards (name — ability — duration — cooldown)
1. Shard of Flight — flight — 10s — 60s
2. Shard of Haste — Speed III — 15s — 45s
3. Shard of Leap — Jump Boost V — 15s — 30s
4. Shard of Shadow — Invisibility — 12s — 60s
5. Shard of Flame — fire resistance + ignites enemies ~4 blocks — 20s — 45s
6. Shard of Vitality — instant heal (+8HP) + Regeneration II — 10s — 40s
7. Shard of Might — Strength II — 15s — 45s
8. Shard of Warp — teleport forward to safe block, up to 6 blocks — instant — 20s
9. Shard of Echo — fires a Sonic Boom projectile forward, damaging/knocking back on hit — instant — 45s

## Commands (operator permission)
- /vexissmp give  [type], /vexissmp info , /vexissmp reset  [type], /vexissmp reload

## Full configurability
Everything editable in config.yml without recompiling: shard names, ability labels, lore, item material, durations, cooldowns, action bar text (ready/cooldown, placeholders), first-join messages, sounds, command names/aliases, permission nodes, and every INVENTORY GUI slot (item, position, name, lore) if a shard menu exists.

## Code structure
Maven project, separate classes: main plugin class, ShardType registry (from config), ShardManager (assignment, persistence, cooldowns, abilities), listeners (join, interaction, inventory protection, death/respawn), repeating task for HUD, ConfigManager (load/validate/reload).

Persist player data in a YAML file keyed by UUID, identify shard items via PersistentDataContainer. Comment code in English. Use standard Bukkit/Paper API mechanics only.
Kodari AI
KodariAug 16 at 10:52 pm 2
VexisShards
A Paper plugin for VexisSMP that assigns each player one of nine unique magic shards on first join. Each shard grants an active ability triggered by shift-right-click, with configurable durations and cooldowns. Features persistent UUID-based assignment, inventory protection preventing drops or container transfers, automatic item return on respawn, action bar HUD showing cooldown status, and operator commands for giving, inspecting, resetting, and reloading shard configurations. All shard properties, messages, sounds, and GUI layouts are fully configurable via config.yml.
  1. Create the Maven/Paper project metadata and default configuration.

  2. Add the configurable shard registry, persistence, cooldowns, item identity, and abilities.

  3. Add listeners, HUD scheduling, command handling, and plugin bootstrap wiring.

Implemented the VexisShards Paper plugin project with:

  • Maven setup for Java 21 and Paper 1.21.x.

  • Persistent UUID-based shard assignments.

  • Nine configurable shard types and abilities.

  • Configurable names, lore, materials, durations, cooldowns, HUD, messages, sounds, permissions, and command settings.

  • Shard item protection against drops, containers, death loss, and inventory movement.

  • Respawn restoration and first-join assignment flow.

  • Per-second cooldown HUD.

  • /vexissmp give, info, reset, and reload commands with tab completion.

  • Separate configuration, shard, listener, command, utility, and task classes.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
11 1,041
src/main/java/com/vexissmp/VexisShards.java
package com.vexissmp;

import com.vexissmp.command.VexisCommand;
import com.vexissmp.config.ConfigManager;
import com.vexissmp.listener.ShardListener;
import com.vexissmp.shard.ShardManager;
import com.vexissmp.task.HudTask;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class VexisShards extends JavaPlugin {
    private ConfigManager configManager;
    private ShardManager shardManager;

    @Override
    public void onEnable() {
        configManager = new ConfigManager(this);
        configManager.load();
        shardManager = new ShardManager(this, configManager);
        shardManager.loadData();

        Bukkit.getPluginManager().registerEvents(new ShardListener(this), this);
        VexisCommand command = new VexisCommand(this);
        if (getCommand("vexissmp") != null) {
            getCommand("vexissmp").setExecutor(command);
            getCommand("vexissmp").setTabCompleter(command);
        }
        new HudTask(this).runTaskTimer(this, 20L, 20L);
    }

    @Override
    public void onDisable() {
        if (shardManager != null) {
            shardManager.saveData();
            shardManager.clearTemporaryState();
        }
    }

    public void reloadPlugin() {
        configManager.reload();
        shardManager.reloadTypes();
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public ShardManager getShardManager() {
        return shardManager;
    }
}