cloudgamingyt66-ctrl

πŸ“Ž Attached 1 file(s):

File: pasted-code-1787298331394.txt

txt
Create a complete, production-ready Minecraft plugin for **Paper 1.21.11** using **Java** and **Maven**.

## Plugin Concept

Create a custom **Mace Progression System**.

Every new player should receive a starting mace called:

**Normal Mace**

The player's mace upgrades automatically based on the number of valid player kills made while using the mace.

The progression must be persistent. If a player leaves the server, dies, reconnects, or the server restarts, their kill count and current mace stage must not reset.

---

# Mace Progression

There are exactly **6 mace stages**:

### Stage 1 β€” Normal Mace

Requirement:

* Given to a new player when they first join.
* 0 kills required.

Item:

* Vanilla Minecraft Mace
* Name: `Normal Mace`
* No enchantments
* No special effects

---

### Stage 2 β€” Wood Mace

Requirement:

* **1 kill**

Item:

* Mace
* Name: `Wood Mace`
* Enchantments:

  * Wind Burst I
  * Density I

When the player gets their first valid kill, automatically upgrade their current mace to the Wood Mace.

---

### Stage 3 β€” Stone Mace

Requirement:

* **1 additional kill**

Total kills: **2**

Item:

* Mace
* Name: `Stone Mace`
* Enchantments:

  * Wind Burst III
  * Density III

---

### Stage 4 β€” Diamond Mace

Requirement:

* **1 additional kill**

Total kills: **3**

Item:

* Mace
* Name: `Diamond Mace`
* Enchantments:

  * Wind Burst V
  * Density X

Use Minecraft's valid enchantment API behavior. If Density X is supported on Paper 1.21.11, apply it normally.

---

### Stage 5 β€” GOD Mace

Requirement:

* **2 additional kills**

Total kills: **5**

Item:

* Mace
* Name: `GOD Mace`
* Enchantments:

  * Wind Burst X
  * Density XX

---

### Stage 6 β€” SHADOW MACE

Requirement:

* **10 additional kills**

Total kills: **15**

Item:

* Mace
* Name: `SHADOW MACE`
* Enchantments:

  * Density XL
  * Breach V
  * Wind Burst X

This is the final mace.

Once a player reaches SHADOW MACE, they cannot progress any further.

---

# Progression Table

Implement this exact progression:

| Total Kills | Mace         | Enchantments                       |
| ----------: | ------------ | ---------------------------------- |
|           0 | Normal Mace  | None                               |
|           1 | Wood Mace    | Wind Burst I, Density I            |
|           2 | Stone Mace   | Wind Burst III, Density III        |
|           3 | Diamond Mace | Wind Burst V, Density X            |
|           5 | GOD Mace     | Wind Burst X, Density XX           |
|          15 | SHADOW MACE  | Density XL, Breach V, Wind Burst X |

The kill requirements must be based on **total valid kills**, not deaths.

---

# Important Kill System

A kill should only count when:

* A player kills another player.
* The killer is a real player.
* The victim is a real player.
* The killer is actually using/holding their progression mace.
* The victim is not the same player.
* The kill is not cancelled.
* The victim is not in a configured exempt world.
* The killer is not in a configured exempt world.

Do not count:

* Mob kills
* Animal kills
* NPC kills
* Fake entities
* Self-kills
* `/kill`
* Environmental kills
* Fall damage kills
* Fire/lava kills
* Void kills
* Kills where the player did not use their mace
* Duplicate kill events

Use `PlayerDeathEvent` and determine the killer correctly.

If the killer's mace is required to be in their main hand, only count the kill when the correct mace is in the main hand.

Make this behavior configurable.

---

# Mace Identification

Do NOT identify progression maces only by their display name.

Use a persistent item identifier such as:

`PersistentDataContainer`

Store a unique key like:

`custom_mace_type`

with values such as:

* normal
* wood
* stone
* diamond
* god
* shadow

This prevents players from renaming ordinary vanilla maces and abusing the progression system.

---

# Upgrade Behavior

When a player reaches an upgrade requirement:

1. Detect the new progression stage.
2. Remove/replace the old progression mace.
3. Give the player the new mace.
4. Preserve the player's kill count.
5. Send a configurable upgrade message.
6. Optionally play a configurable sound.
7. Optionally display a title.
8. Optionally send an action-bar message.

The plugin must avoid accidentally deleting unrelated items.

If the progression mace is not in the player's main hand when the upgrade happens, safely handle the situation.

The plugin should be designed so the upgraded mace can be placed into the player's inventory without deleting other inventory items.

If the inventory is full, use a safe fallback such as dropping the upgraded mace at the player's location and send a configurable message.

---

# New Player System

When a player joins for the first time:

* Create their player data.
* Set kills to 0.
* Give them a Normal Mace.
* Do not give another starting mace every time they reconnect.

Use persistent storage.

Prefer **SQLite** by default so the plugin works without requiring MySQL.

Optionally support MySQL if practical.

---

# Data Storage

Store at minimum:

* UUID
* Player name
* Kill count
* Current mace stage

The data must survive:

* Server restart
* Player disconnect
* Plugin reload
* Server crash as safely as possible

Save data whenever important changes occur and safely save all data when the plugin disables.

Do not use unsafe asynchronous Bukkit API calls.

---

# Commands

Implement useful commands automatically.

### `/mace`

Show the player's current mace information:

* Current mace
* Current kills
* Kills required for next upgrade
* Next mace
* Progress

Example:

`Mace: Diamond Mace`
`Kills: 3`
`Next: GOD Mace`
`Kills Needed: 2`

If the player has SHADOW MACE:

`Mace: SHADOW MACE`
`Kills: 15`
`Status: MAX LEVEL`

---

### `/mace stats [player]`

Show mace statistics for a player.

Permission:

`custommace.stats`

Players should be able to use `/mace stats` for themselves.

Administrators can use `/mace stats <player>`.

---

### `/mace give <player> <stage>`

Give a specific progression mace to a player.

Stages:

* normal
* wood
* stone
* diamond
* god
* shadow

Permission:

`custommace.admin`

---

### `/mace setkills <player> <amount>`

Set a player's kill count.

Permission:

`custommace.admin`

After changing kills, recalculate their mace stage.

---

### `/mace reset <player>`

Reset a player back to:

* 0 kills
* Normal Mace

Permission:

`custommace.admin`

---

### `/mace reload`

Reload `config.yml`.

Permission:

`custommace.admin`

Do not require a full server restart for normal configuration changes.

---

# Tab Completion

Add tab completion for:

* Commands
* Player names
* Mace stages
* Numeric arguments where practical

---

# Config.yml

Make the plugin highly configurable.

The following should be configurable:

* Mace names
* Kill requirements
* Enchantments
* Enchantment levels
* Upgrade messages
* Join message
* Kill message
* Sounds
* Titles
* Action bars
* Prefix
* Whether upgrades automatically replace the mace
* Whether the mace must be in the main hand
* Whether kills in specific worlds count
* SQLite/MySQL settings
* Debug mode

Example structure:
yaml prefix: "&8[&6Mace&8] "

settings: require-main-hand: true automatic-upgrade: true debug: false

database: type: "sqlite"

maces:

normal: display-name: "&fNormal Mace" kills: 0 enchantments: {}

wood: display-name: "&6Wood Mace" kills: 1 enchantments:

WIND_BURST: 1 DENSITY: 1

stone: display-name: "&7Stone Mace" kills: 2 enchantments:

WIND_BURST: 3 DENSITY: 3

diamond: display-name: "&bDiamond Mace" kills: 3 enchantments:

WIND_BURST: 5 DENSITY: 10

god: display-name: "&cGOD Mace" kills: 5 enchantments:

WIND_BURST: 10 DENSITY: 20

shadow: display-name: "&5&lSHADOW MACE" kills: 15 enchantments:

DENSITY: 40 BREACH: 5 WIND_BURST: 10

messages: first-join: "&aYou received your &fNormal Mace&a!" kill: "&eYou got a kill! &7Kills: &f%kills%" upgrade: "&6Your mace has upgraded to &f%mace%&6!" max-level: "&5You have reached the &lSHADOW MACE&5!" no-permission: "&cYou don't have permission." player-not-found: "&cPlayer not found." reload: "&aConfiguration reloaded."

yaml
lore:
  - "&7Kills: &f%kills%"
  - "&7Level: &f%level%"

πŸ“Ž 1 file 12,541 chars
πŸ“„
pasted-code-1787298416791.txt
txt 651 lines
β–Ά
Create a complete, production-ready Minecraft plugin for **Paper 1.21.11** using **Java** and **Maven**.

## Plugin Concept

Create a custom **Mace Progression System**.

Every new player should receive a starting mace called:

**Normal Mace**

The player's mace upgrades automatically based on the number of valid player kills made while using the mace.

The progression must be persistent. If a player leaves the server, dies, reconnects, or the server restarts, their kill count and current mace stage must not reset.

---

# Mace Progression

There are exactly **6 mace stages**:

### Stage 1 β€” Normal Mace

Requirement:

* Given to a new player when they first join.
* 0 kills required.

Item:

* Vanilla Minecraft Mace
* Name: `Normal Mace`
* No enchantments
* No special effects

---

### Stage 2 β€” Wood Mace

Requirement:

* **1 kill**

Item:

* Mace
* Name: `Wood Mace`
* Enchantments:

  * Wind Burst I
  * Density I

When the player gets their first valid kill, automatically upgrade their current mace to the Wood Mace.

---

### Stage 3 β€” Stone Mace

Requirement:

* **1 additional kill**

Total kills: **2**

Item:

* Mace
* Name: `Stone Mace`
* Enchantments:

  * Wind Burst III
  * Density III

---

### Stage 4 β€” Diamond Mace

Requirement:

* **1 additional kill**

Total kills: **3**

Item:

* Mace
* Name: `Diamond Mace`
* Enchantments:

  * Wind Burst V
  * Density X

Use Minecraft's valid enchantment API behavior. If Density X is supported on Paper 1.21.11, apply it normally.

---

### Stage 5 β€” GOD Mace

Requirement:

* **2 additional kills**

Total kills: **5**

Item:

* Mace
* Name: `GOD Mace`
* Enchantments:

  * Wind Burst X
  * Density XX

---

### Stage 6 β€” SHADOW MACE

Requirement:

* **10 additional kills**

Total kills: **15**

Item:

* Mace
* Name: `SHADOW MACE`
* Enchantments:

  * Density XL
  * Breach V
  * Wind Burst X

This is the final mace.

Once a player reaches SHADOW MACE, they cannot progress any further.

---

# Progression Table

Implement this exact progression:

| Total Kills | Mace         | Enchantments                       |
| ----------: | ------------ | ---------------------------------- |
|           0 | Normal Mace  | None                               |
|           1 | Wood Mace    | Wind Burst I, Density I            |
|           2 | Stone Mace   | Wind Burst III, Density III        |
|           3 | Diamond Mace | Wind Burst V, Density X            |
|           5 | GOD Mace     | Wind Burst X, Density XX           |
|          15 | SHADOW MACE  | Density XL, Breach V, Wind Burst X |

The kill requirements must be based on **total valid kills**, not deaths.

---

# Important Kill System

A kill should only count when:

* A player kills another player.
* The killer is a real player.
* The victim is a real player.
* The killer is actually using/holding their progression mace.
* The victim is not the same player.
* The kill is not cancelled.
* The victim is not in a configured exempt world.
* The killer is not in a configured exempt world.

Do not count:

* Mob kills
* Animal kills
* NPC kills
* Fake entities
* Self-kills
* `/kill`
* Environmental kills
* Fall damage kills
* Fire/lava kills
* Void kills
* Kills where the player did not use their mace
* Duplicate kill events

Use `PlayerDeathEvent` and determine the killer correctly.

If the killer's mace is required to be in their main hand, only count the kill when the correct mace is in the main hand.

Make this behavior configurable.

---

# Mace Identification

Do NOT identify progression maces only by their display name.

Use a persistent item identifier such as:

`PersistentDataContainer`

Store a unique key like:

`custom_mace_type`

with values such as:

* normal
* wood
* stone
* diamond
* god
* shadow

This prevents players from renaming ordinary vanilla maces and abusing the progression system.

---

# Upgrade Behavior

When a player reaches an upgrade requirement:

1. Detect the new progression stage.
2. Remove/replace the old progression mace.
3. Give the player the new mace.
4. Preserve the player's kill count.
5. Send a configurable upgrade message.
6. Optionally play a configurable sound.
7. Optionally display a title.
8. Optionally send an action-bar message.

The plugin must avoid accidentally deleting unrelated items.

If the progression mace is not in the player's main hand when the upgrade happens, safely handle the situation.

The plugin should be designed so the upgraded mace can be placed into the player's inventory without deleting other inventory items.

If the inventory is full, use a safe fallback such as dropping the upgraded mace at the player's location and send a configurable message.

---

# New Player System

When a player joins for the first time:

* Create their player data.
* Set kills to 0.
* Give them a Normal Mace.
* Do not give another starting mace every time they reconnect.

Use persistent storage.

Prefer **SQLite** by default so the plugin works without requiring MySQL.

Optionally support MySQL if practical.

---

# Data Storage

Store at minimum:

* UUID
* Player name
* Kill count
* Current mace stage

The data must survive:

* Server restart
* Player disconnect
* Plugin reload
* Server crash as safely as possible

Save data whenever important changes occur and safely save all data when the plugin disables.

Do not use unsafe asynchronous Bukkit API calls.

---

# Commands

Implement useful commands automatically.

### `/mace`

Show the player's current mace information:

* Current mace
* Current kills
* Kills required for next upgrade
* Next mace
* Progress

Example:

`Mace: Diamond Mace`
`Kills: 3`
`Next: GOD Mace`
`Kills Needed: 2`

If the player has SHADOW MACE:

`Mace: SHADOW MACE`
`Kills: 15`
`Status: MAX LEVEL`

---

### `/mace stats [player]`

Show mace statistics for a player.

Permission:

`custommace.stats`

Players should be able to use `/mace stats` for themselves.

Administrators can use `/mace stats `.

---

### `/mace give  `

Give a specific progression mace to a player.

Stages:

* normal
* wood
* stone
* diamond
* god
* shadow

Permission:

`custommace.admin`

---

### `/mace setkills  `

Set a player's kill count.

Permission:

`custommace.admin`

After changing kills, recalculate their mace stage.

---

### `/mace reset `

Reset a player back to:

* 0 kills
* Normal Mace

Permission:

`custommace.admin`

---

### `/mace reload`

Reload `config.yml`.

Permission:

`custommace.admin`

Do not require a full server restart for normal configuration changes.

---

# Tab Completion

Add tab completion for:

* Commands
* Player names
* Mace stages
* Numeric arguments where practical

---

# Config.yml

Make the plugin highly configurable.

The following should be configurable:

* Mace names
* Kill requirements
* Enchantments
* Enchantment levels
* Upgrade messages
* Join message
* Kill message
* Sounds
* Titles
* Action bars
* Prefix
* Whether upgrades automatically replace the mace
* Whether the mace must be in the main hand
* Whether kills in specific worlds count
* SQLite/MySQL settings
* Debug mode

Example structure:

```yaml
prefix: "&8[&6Mace&8] "

settings:
  require-main-hand: true
  automatic-upgrade: true
  debug: false

database:
  type: "sqlite"

maces:

  normal:
    display-name: "&fNormal Mace"
    kills: 0
    enchantments: {}

  wood:
    display-name: "&6Wood Mace"
    kills: 1
    enchantments:
      WIND_BURST: 1
      DENSITY: 1

  stone:
    display-name: "&7Stone Mace"
    kills: 2
    enchantments:
      WIND_BURST: 3
      DENSITY: 3

  diamond:
    display-name: "&bDiamond Mace"
    kills: 3
    enchantments:
      WIND_BURST: 5
      DENSITY: 10

  god:
    display-name: "&cGOD Mace"
    kills: 5
    enchantments:
      WIND_BURST: 10
      DENSITY: 20

  shadow:
    display-name: "&5&lSHADOW MACE"
    kills: 15
    enchantments:
      DENSITY: 40
      BREACH: 5
      WIND_BURST: 10

messages:
  first-join: "&aYou received your &fNormal Mace&a!"
  kill: "&eYou got a kill! &7Kills: &f%kills%"
  upgrade: "&6Your mace has upgraded to &f%mace%&6!"
  max-level: "&5You have reached the &lSHADOW MACE&5!"
  no-permission: "&cYou don't have permission."
  player-not-found: "&cPlayer not found."
  reload: "&aConfiguration reloaded."
```

The configuration should actually be read and used by the plugin. Do not create configuration options that are not implemented.

---

# Enchantments

Use the correct modern Paper 1.21.11 enchantment API.

Important:

* Do not use deprecated APIs unnecessarily.
* Correctly handle enchantments whose maximum vanilla level is lower than the configured custom level.
* Since the plugin requires levels such as Density 40 and Wind Burst 10, implement the enchantment application in a way compatible with Paper 1.21.11.
* Do not silently fail.
* Log a clear warning if an enchantment cannot be applied.

The plugin should allow high/custom enchantment levels where the Paper API permits them.

---

# Visual Customization

Make the maces visually distinct through:

* Display names
* Lore
* Enchantments
* Optional custom model data

Add configurable lore for every mace.

Example:

```yaml
lore:
  - "&7Kills: &f%kills%"
  - "&7Level: &f%level%"
```

Allow each mace to have its own lore.

---

# Anti-Abuse

Prevent easy kill farming.

Add configurable options for:

* Same-player kill cooldown
* Minimum distance if practical
* World blacklist
* World whitelist
* Whether kills count in specified gamemodes
* Preventing duplicate death-event processing

For example:

```yaml
anti-abuse:
  enabled: true
  same-player-cooldown-seconds: 60
```

If the same player kills the same victim repeatedly within the cooldown, do not award another progression kill.

---

# Permissions

Create:

```text
custommace.use
custommace.stats
custommace.admin
custommace.give
custommace.setkills
custommace.reset
custommace.reload
```

Configure sensible default permissions in `plugin.yml`.

---

# Plugin.yml

Generate a complete `plugin.yml` compatible with Paper 1.21.11.

Include:

* Plugin name
* Version
* Main class
* API version
* Commands
* Permissions

---

# Project Structure

Create a clean Maven project.

Use a package structure similar to:

```text
src/main/java/
└── your/package/name/
    β”œβ”€β”€ CustomMacePlugin.java
    β”œβ”€β”€ command/
    β”‚   └── MaceCommand.java
    β”œβ”€β”€ listener/
    β”‚   β”œβ”€β”€ PlayerJoinListener.java
    β”‚   └── PlayerKillListener.java
    β”œβ”€β”€ manager/
    β”‚   β”œβ”€β”€ MaceManager.java
    β”‚   └── PlayerDataManager.java
    β”œβ”€β”€ model/
    β”‚   β”œβ”€β”€ MaceStage.java
    β”‚   └── PlayerData.java
    └── util/
        └── ItemUtil.java
```

You may improve this architecture if you have a better professional design.

---

# Code Quality Requirements

The final project must:

* Compile successfully.
* Target Paper 1.21.11.
* Use Java 21 if required by Paper 1.21.11.
* Use Maven.
* Have no placeholder methods.
* Have no TODO sections.
* Have no pseudocode.
* Have proper exception handling.
* Avoid unnecessary dependencies.
* Avoid deprecated APIs where modern alternatives exist.
* Be thread-safe where appropriate.
* Never block the server main thread with database operations if avoidable.
* Never duplicate event listeners.
* Never give duplicate starting maces.
* Never reset player data accidentally.

---

# Final Output Required

Generate the **complete plugin source code**, not just an explanation.

Provide:

1. `pom.xml`
2. `plugin.yml`
3. `config.yml`
4. Every Java source file
5. Complete package structure
6. Installation instructions
7. Build instructions
8. All commands
9. All permissions
10. Example configuration
11. Explanation of how the kill progression works

The final result should be ready to compile into a `.jar` and place directly into a **Paper 1.21.11** server's `plugins` folder.

Do not simplify the requirements. Implement the complete system.
Kodari AI
KodariAug 21 at 7:52 am 3
  1. Create the Maven/Paper project and default configuration.

  2. Add persistent SQLite player data and configurable mace/item handling.

  3. Add join, kill, progression, anti-abuse, upgrade effects, and inventory safety.

  4. Add /mace commands, permissions, and tab completion.

Created the complete Paper 1.21.11 Maven plugin.

Project contents

  • pom.xml

  • src/main/resources/plugin.yml

  • src/main/resources/config.yml

  • CustomMacePlugin

  • SQLite-backed PlayerDataManager

  • Configurable MaceManager

  • Persistent PDC mace identification

  • Six mace stages with configurable enchantments, lore, names, and model data

  • Player join and kill listeners

  • Anti-abuse protections:

    • Same-player cooldown

    • World blacklist/whitelist

    • Gamemode restrictions

    • Minimum distance

    • Duplicate death-event protection

  • Safe mace replacement and full-inventory drops

  • Upgrade sounds, titles, action bars, and messages

  • Tab completion

  • Lombok player data model

  • SQLite JDBC bundled into the plugin JAR

Build

Requirements:

  • Java 21

  • Maven

Run:

Shell
mvn clean package

The finished plugin will be located at:

Plain Text
target/custom-mace-1.0.0.jar

Place it in:

Plain Text
/plugins

The SQLite database is created at:

Plain Text
/plugins/CustomMace/players.db

Commands

Plain Text
/mace
/mace stats
/mace stats <player>
/mace give <player> <stage>
/mace setkills <player> <amount>
/mace reset <player>
/mace reload

Available stages:

Plain Text
normal
wood
stone
diamond
god
shadow

Permissions

Plain Text
custommace.use
custommace.stats
custommace.admin
custommace.give
custommace.setkills
custommace.reset
custommace.reload

Progression is based on total valid player kills while holding a tagged progression mace. The player’s UUID, name, kill count, and current stage are persisted in SQLite and restored after reconnects and server restarts.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
12 1,160
src/main/java/com/kodari/custommace/CustomMacePlugin.java
package com.kodari.custommace;

import com.kodari.custommace.command.MaceCommand;
import com.kodari.custommace.listener.PlayerJoinListener;
import com.kodari.custommace.listener.PlayerKillListener;
import com.kodari.custommace.manager.MaceManager;
import com.kodari.custommace.manager.PlayerDataManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.sql.SQLException;

public final class CustomMacePlugin extends JavaPlugin {
    private PlayerDataManager playerDataManager;
    private MaceManager maceManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        playerDataManager = new PlayerDataManager(this);
        try {
            playerDataManager.initialize();
        } catch (SQLException exception) {
            getLogger().log(java.util.logging.Level.SEVERE, "Could not initialize the SQLite database.", exception);
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        maceManager = new MaceManager(this, playerDataManager);
        Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(this, maceManager), this);
        Bukkit.getPluginManager().registerEvents(new PlayerKillListener(this, maceManager), this);
        MaceCommand command = new MaceCommand(this, maceManager, playerDataManager);
        if (getCommand("mace") != null) {
            getCommand("mace").setExecutor(command);
            getCommand("mace").setTabCompleter(command);
        }
    }

    @Override
    public void onDisable() {
        if (playerDataManager != null) {
            playerDataManager.close();
        }
    }

    public PlayerDataManager getPlayerDataManager() {
        return playerDataManager;
    }

    public MaceManager getMaceManager() {
        return maceManager;
    }
}