chxso_
📎 1 file 13,252 chars
📄
pasted-code-1790211060850.txt
txt 522 lines
▶
Create a complete Minecraft Paper plugin for my SMP called "HeartLives".

TARGET:
- Minecraft Java Edition 1.21.11
- Paper 1.21.11
- Java 21
- Use Gradle or Maven and make the project compile successfully.
- Give me the COMPLETE plugin source code, including every Java class, plugin.yml, config.yml, and build configuration.
- Do not give me pseudocode or incomplete examples.
- Make sure all code uses APIs compatible with Minecraft/Paper 1.21.11.

========================================
1. TWO-LIFE SYSTEM
========================================

Every player has exactly 2 lives when they first join.

Players start with:
- 2 lives
- 2 visible heart icons floating on/next to their face

The lives must persist through:
- Server restarts
- Player disconnects
- Deaths

Store lives safely in a file such as lives.yml or players.yml.

Commands:

/lives
- Shows your current number of lives.

/lives 
- Shows another player's lives.

/setlives  
- OP/admin only.

/addlife 
- OP/admin only.

/removelife 
- OP/admin only.

Do NOT allow normal players to modify lives with commands.

When a player dies:
- Remove exactly 1 life.
- Update their visible face hearts immediately.
- If they still have 1 life, they continue playing normally.
- If they reach 0 lives, put them into Spectator mode.
- Prevent the player from simply respawning and continuing normally after reaching 0 lives.
- Make sure the death event cannot accidentally remove multiple lives.
- Make sure commands/admin changes update the display immediately.

========================================
2. HEARTS ON THE PLAYER'S FACE
========================================

This is VERY important.

I do NOT want a normal Minecraft bossbar, scoreboard, actionbar, nametag, or health bar.

I want the player's lives represented by TWO HEART-SHAPED PARTICLES floating next to/on their face.

Conceptually:

[ ❤️ ❤️ ]

The hearts should appear around the player's face/head, similar to the reference image I provided.

The heart particles must:
- Follow the player's head.
- Rotate with the player's looking direction.
- Stay at approximately face level.
- Have two separate heart particles for 2 lives.
- Have one heart particle for 1 life.
- Have zero heart particles for 0 lives.

Use Minecraft heart particles or the closest appropriate vanilla heart particle.

IMPORTANT:
Do NOT make the hearts float at a fixed world location.
They must constantly follow the player's head position and orientation.

The two hearts should be separated horizontally so they look like two small heart icons beside the face.

Make their:
- Height
- Distance from face
- Horizontal spacing
- Particle size/count
configurable in config.yml.

The heart display should work for all players.

Optimize the particle system so it does not create unnecessary lag.
Do not spawn hundreds of particles per player every tick.

========================================
3. HEART SHARD
========================================

Create a custom item called:

"Heart Shard"

This is one of the main items in the plugin.

Use a normal Minecraft item as its base, such as an amethyst shard.

Give it:
- Custom name: Heart Shard
- Nice lore explaining that it restores a lost life.
- A custom visual/model-ready setup if possible using PersistentDataContainer.

Behavior:

When a player right-clicks while holding the Heart Shard:
- If they have fewer than 2 lives:
  - Restore exactly 1 life.
  - Consume the Heart Shard.
  - Update their face hearts immediately.
  - Play a heart/recovery particle effect.
  - Play an appropriate vanilla sound.
- If they already have 2 lives:
  - Do not consume the item.
  - Tell them they already have maximum lives.

If a player has 0 lives and is in Spectator mode, using a Heart Shard should NOT be possible unless the item is specifically given to them by an admin and the configuration allows revival.

Make this configurable.

Admin command:

/heartshard 

Give the player one Heart Shard.

========================================
4. CUSTOM ITEMS
========================================

The plugin should also contain several normal Minecraft items that have ONE unique built-in gimmick.

IMPORTANT:
These are NOT separate player abilities.

They are actual Minecraft items/weapons.

Each item should:
- Have a custom name.
- Have lore.
- Have a unique mechanic.
- Have a reasonable cooldown.
- Use PersistentDataContainer to identify the custom item.
- Work independently.
- Not require a separate /ability1 or /ability2 system.
- Feel like an SMP item rather than an overpowered RPG ability.

The items should be balanced and relatively "chill."

========================================
ITEM 1: HUNTER'S DAGGER
========================================

Base item:
- Iron sword or another suitable weapon.

Name:
"Hunter's Dagger"

Mechanic:
- The dagger can be thrown.
- Right-click while holding it to throw the dagger forward.
- It travels like a projectile.
- If it hits a player, it deals reasonable damage.
- After hitting something or reaching its maximum distance, it returns to the owner.
- It should behave somewhat like a returning throwing dagger.
- Do NOT make it absurdly powerful.

Add a cooldown so it cannot be spammed.

========================================
ITEM 2: TIDE SPEAR
========================================

Base item:
- Minecraft spear if available in Paper 1.21.11.
- If the API requires another implementation, use the closest suitable item.

Name:
"Tide Spear"

Mechanic:
- It functions normally as a spear.
- Right-click fires a small water projectile/spear forward.
- The projectile travels in the direction the player is looking.
- On hitting a player, deal moderate damage and slight knockback.
- Give the projectile a water-themed particle effect.
- It should NOT be an enormous beam.
- Keep it clean and simple.

Cooldown:
- Around 10-20 seconds, configurable.

========================================
ITEM 3: CHAIN AXE
========================================

Base item:
- Netherite axe or another axe.

Name:
"Chain Axe"

Mechanic:
- When the player hits another player with it:
  - Create a temporary chain/link effect between the attacker and target.
  - The target cannot get extremely far away from the attacker while the effect is active.
  - Do not completely freeze the target.
  - Keep it useful for preventing escapes.
- Effect lasts only a few seconds.
- Add particles/sound to make the chain visible.

Cooldown:
- Around 20-30 seconds.

========================================
ITEM 4: SPLITBOW
========================================

Base item:
- Bow.

Name:
"Splitbow"

Mechanic:
- When an arrow is fired:
  - After a short delay, split the shot into 3 arrows/projectiles.
- The three arrows should spread slightly rather than all going in exactly the same direction.
- Do not make it massively overpowered.
- Normal bow mechanics should still work as much as possible.

Add a reasonable cooldown if needed.

========================================
ITEM 5: BREACHER
========================================

Base item:
- Pickaxe.

Name:
"Breacher"

Mechanic:
- Right-click with the Breacher.
- Break a small 1x3 tunnel/section of appropriate blocks in the direction the player is looking.
- Do not break protected/indestructible blocks such as bedrock.
- Do not allow it to grief huge areas.
- Keep the tunnel small.
- Add a cooldown.
- Play block-breaking particles/sounds.

This should be a utility item rather than a weapon.

========================================
ITEM 6: RETURNING BLADE
========================================

Base item:
- Sword.

Name:
"Returning Blade"

Mechanic:
- Right-click throws the sword forward like a boomerang.
- It damages the first valid target it hits.
- It then returns to the player.
- Make sure the actual item is not permanently lost.
- The player should get the item back after the throw.
- Add a cooldown.
- Add a small trail of particles while flying.

========================================
ITEM 7: KNOCKBACK GLOVE
========================================

Base item:
- Suitable item such as leather item/custom model-ready item.

Name:
"Knockback Glove"

Mechanic:
- When hitting a player, deal relatively low damage but significantly more knockback than a normal attack.
- It should be useful for pushing players away or off ledges.
- Do NOT make the knockback ridiculous.
- Add a short cooldown between special knockback hits if necessary.

========================================
ITEM 8: BAT
========================================

Base item:
- Stick or another suitable item.

Name:
"Bat"

Mechanic:
- It behaves like a melee weapon.
- Hits deal relatively low/moderate damage.
- Its main gimmick is increased knockback.
- Make the knockback noticeable but balanced.
- Add an appropriate hit sound.

========================================
ITEM 9: HARPOON
========================================

Base item:
- Crossbow or fishing-rod-like item.

Name:
"Harpoon"

Mechanic:
- Fire a harpoon projectile.
- When it hits a player, it pulls that player toward the person who fired it.
- It should not instantly teleport the target.
- It should visibly pull them.
- Add chain/rope-like particles if possible.
- Moderate cooldown.
- No massive damage.

========================================
5. ITEM GIVING COMMANDS
========================================

Create admin-only commands:

/heartshard 
/hunterdagger 
/tidespear 
/chainaxe 
/splitbow 
/breacher 
/returningblade 
/knockbackglove 
/bat 
/harpoon 

Also create:

/heartlives help

Show all commands.

Only OPs or a configurable permission such as:
heartlives.admin

can use these commands.

========================================
6. CUSTOM ITEM IDENTIFICATION
========================================

Do NOT identify custom items only by their display name.

Use PersistentDataContainer with unique keys such as:

heartlives:heart_shard
heartlives:hunter_dagger
heartlives:tide_spear
heartlives:chain_axe
heartlives:splitbow
heartlives:breacher
heartlives:returning_blade
heartlives:knockback_glove
heartlives:bat
heartlives:harpoon

This prevents renamed normal items from accidentally becoming custom items.

========================================
7. CONFIGURATION
========================================

Create a clean config.yml containing settings for:

Starting lives:
2

Maximum lives:
2

Spectator at 0 lives:
true

Heart particle:
heart

Heart display:
- height
- distance from face
- spacing
- update interval

Every item should have configurable:
- damage
- cooldown
- duration
- knockback
- range
- particle settings where appropriate

Do not hard-code everything.

========================================
8. IMPORTANT BALANCE RULE
========================================

The plugin should NOT feel like an ability plugin.

The main concept is:

NORMAL MINECRAFT ITEM
+
ONE COOL MECHANIC

Examples:

Spear → shoots a water projectile.
Axe → temporarily chains someone.
Bow → splits its arrows.
Pickaxe → breaches a small tunnel.
Sword → can be thrown and returned.
Bat → strong knockback.
Harpoon → pulls players.
Heart Shard → restores a life.

Keep the mechanics understandable and fun.

Do NOT add:
- random powers
- player abilities
- /ability1
- /ability2
- skill trees
- mana
- RPG stats
- huge ultimate attacks
- giant explosions
- overpowered one-shot abilities
- unnecessary complicated systems.

========================================
9. CODE QUALITY
========================================

Organize the project properly.

Suggested structure:

src/main/java/
    your/package/
        HeartLivesPlugin.java
        commands/
        items/
        listeners/
        lives/
        particles/
        utilities/

Use separate classes where appropriate.

Register all listeners and commands correctly.

Handle:
- player join
- player quit
- player death
- respawn
- right click
- projectile hit
- entity damage
- item interaction
- cooldowns

Make sure there are no duplicate event handlers causing damage/lives to trigger twice.

========================================
10. FINAL OUTPUT
========================================

Give me the COMPLETE project.

I want:
- Full folder structure.
- Every Java file.
- plugin.yml.
- config.yml.
- build.gradle or pom.xml.
- README explaining how to compile and install.
- Commands and permissions.
- Explanation of how each custom item works.

Most importantly:

MAKE SURE THIS ACTUALLY COMPILES FOR PAPER 1.21.11 / JAVA 21.

Do not leave placeholders like:
"implement this later"
"add your code here"
"etc."

Write the actual working code for everything above.
Kodari AI
KodariSep 24 at 1:02 am 2
HeartLives
HeartLives is a Paper 1.21.11 SMP plugin introducing a two-life system with floating heart particles above players' heads, persistent life storage, and nine unique custom items. Each item (Hunter's Dagger, Tide Spear, Chain Axe, Splitbow, Breacher, Returning Blade, Knockback Glove, Bat, Harpoon) adds one balanced mechanic to a vanilla item, identified via PersistentDataContainer. Includes admin commands for life management and item distribution, configurable cooldowns, damage, and particle settings.
  1. Set up the Paper 1.21.11 / Java 21 Gradle project and plugin metadata.

  2. Implement persistent lives, face-level heart particles, commands, and configurable custom items.

  3. Add installation and gameplay documentation.

Created the complete HeartLives project: Gradle configuration, plugin metadata, default config, README, and all Java classes for persistent lives, heart particles, commands, and the custom items.

Build with gradle build; the project targets Java 21 and Paper 1.21.11. XSeries is a runtime dependency, as noted in the README.

chxso_

The heart particals arent supposed to move their is just supposed to be 2 next to ur head above ur shoulders, also when they die make it say the player has lost a Live but if they get eliminated, itll say has had a good run in red,

Kodari AI
KodariSep 24 at 1:16 am 1
  1. Fix the heart particles so two stay beside the player’s head/shoulders.

  2. Update death messaging for losing a life versus being eliminated.

  • Heart particles now spawn in two fixed shoulder-side positions above the player, regardless of remaining lives; removed the unused face-distance setting.

  • Death messages now say a player lost a life, and when their last life is lost, show “has had a good run” in red.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
11 1,314
src/main/java/com/heartlives/HeartLivesPlugin.java
package com.heartlives;

import com.heartlives.commands.HeartLivesCommand;
import com.heartlives.items.CustomItems;
import com.heartlives.listeners.GameplayListener;
import com.heartlives.lives.LifeManager;
import com.heartlives.particles.HeartDisplay;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class HeartLivesPlugin extends JavaPlugin {
    private LifeManager lifeManager;
    private CustomItems customItems;
    private HeartDisplay heartDisplay;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        lifeManager = new LifeManager(this);
        customItems = new CustomItems(this);
        heartDisplay = new HeartDisplay(this, lifeManager);
        Bukkit.getPluginManager().registerEvents(new GameplayListener(this, lifeManager, customItems), this);

        HeartLivesCommand commandHandler = new HeartLivesCommand(this, lifeManager, customItems);
        String[] commands = {
                "lives", "setlives", "addlife", "removelife", "heartshard", "hunterdagger",
                "tidespear", "chainaxe", "splitbow", "breacher", "returningblade",
                "knockbackglove", "bat", "harpoon", "heartlives"
        };
        for (String name : commands) {
            if (getCommand(name) == null) {
                getLogger().severe("Command '" + name + "' is missing from plugin.yml.");
                continue;
            }
            getCommand(name).setExecutor(commandHandler);
        }
        heartDisplay.start();
        getLogger().info("HeartLives enabled.");
    }

    @Override
    public void onDisable() {
        if (lifeManager != null) {
            lifeManager.save();
        }
    }

    public LifeManager getLifeManager() {
        return lifeManager;
    }

    public CustomItems getCustomItems() {
        return customItems;
    }

    public HeartDisplay getHeartDisplay() {
        return heartDisplay;
    }
}