noobrun

Create a Minecraft Paper plugin (Java, API version 1.21) with the following features:

---

🔱 CORE SYSTEM: SPEAR PROGRESSION

* Each player receives a starter Wooden Spear when:

* The SMP starts * OR player joins for the first time after start * Spear must be a custom item using PersistentDataContainer.

---

⬆️ PROGRESSION SYSTEM

* On player kill:

* Killer’s spear upgrades to next tier

📊 Spear Tier Order:

  1. Wooden Spear
  2. Stone Spear
  3. Copper Spear
  4. Gold Spear
  5. Iron Spear
  6. Diamond Spear
  7. Netherite Spear

---

⚔️ SPEAR STATS

* Each tier must:

* Increase attack damage progressively * Have unique name & lore * Use AttributeModifier for damage

---

✨ ENCHANTMENT SYSTEM (IMPORTANT)

* Spears must be enchantable using:

* Enchanting Table * Anvil * Enchanted Books

✔️ Allow:

* Sharpness * Unbreaking * Mending * Fire Aspect * Knockback * Looting (optional)

❌ Restrictions:

* Prevent enchantments that break balance (configurable blacklist)

🔁 Upgrade Behavior:

* When spear upgrades:

* Keep all existing enchantments * Keep durability if possible * Replace only tier stats (damage, name, model)

---

🛠️ SPEAR UPGRADER ITEM

* Custom item: "Spear Upgrader" * Recipe configurable in config.yml * Right-click:

* Upgrade spear by 1 tier * Consume item * Cannot exceed Netherite

---

🔒 RESTRICTIONS

* Spear is soulbound:

* Cannot be dropped * Cannot be placed in containers * Cannot be used in crafting * BUT:

* Must still work in:

* Enchanting Table * Anvil

🚫 Block:

* Crafting table * Inventory crafting * Crafter block (1.21)

---

▶️ SMP START SYSTEM

Command: /startsmp

Behavior:

  1. Show 5-second countdown (Title or ActionBar)
  2. After countdown:

* Countdown disappears * Give all players Wooden Spear * Mark SMP as started

---

🌍 WORLD BORDER SYSTEM

* At SMP start:

* Border = 1 chunk (16x16) * After countdown:

* Expand smoothly to:

* 5000 x 5000 * Duration configurable

---

⚙️ CONFIG (config.yml)

Include:

* Spear Upgrader recipe * Damage per tier * Border expansion time * Messages * Enchantment blacklist (optional)

---

🧩 TECHNICAL REQUIREMENTS

* Use:

* PersistentDataContainer (identify spear + tier) * AttributeModifier (damage scaling) * Handle events:

* PlayerJoinEvent * PlayerDeathEvent * PlayerInteractEvent * InventoryClickEvent * InventoryDragEvent * PlayerDropItemEvent * CraftItemEvent * PrepareItemCraftEvent * EnchantItemEvent * PrepareAnvilEvent

---

📦 OUTPUT

Provide:

  1. Full Java source code
  2. plugin.yml
  3. config.yml
  4. Maven/Gradle setup
  5. Instructions to compile & run

---

🎯 GOAL

* Smooth progression system * Enchantable but balanced * Exploit-proof * Perfect for SMP videos

Kodari AI
KodariMay 1 at 8:50 am 36,546 (v2)
RivalSpears
A Minecraft SMP plugin built around spear progression. Players receive a soulbound Wooden Spear at SMP start and upgrade through 7 tiers (Wooden → Netherite) by getting kills. Spears support enchanting via table and anvil with a configurable blacklist, preserve enchantments on upgrade, and cannot be dropped, stored in containers, or used in crafting. Includes a craftable Spear Upgrader item, a /startsmp command with countdown, and automatic world border expansion from 1 chunk to 5000x5000.
  • Plan: SpearTier enum → SpearManager (item builder/upgrader) → ConfigManager → SMPManager (state + border) → listeners → command

  • All PDC-identified spears are soulbound: blocked from drops, containers, and crafting, but allowed in enchanting table and anvil

  • Enchantments preserved on tier upgrade; material-matching tiers also preserve durability

Hmm, I accidentally added a fake inner ItemStack class. Let me rewrite SMPManager cleanly.


How to Compile & Run

Prerequisites

  • Java 21 JDK

  • Paper 1.21 server jar

Build

Shell
./gradlew jar
# Output: build/libs/RivalSpears-1.0.0.jar

Install

Place the jar in your Paper server’s plugins/ folder and restart.

Usage

Action
Result
/startsmp
Starts 5-second countdown, gives all players a Wooden Spear, expands border from 16→5000 over configured duration
Kill a player
Your spear upgrades one tier, keeping all enchantments
Right-click Spear Upgrader with spear in offhand
Upgrades spear by 1 tier, consumes upgrader
Enchanting Table / Anvil + book
Works normally; blacklisted enchants are filtered from the result

Default Spear Upgrader Recipe (shapeless)

3× Diamond + 1× Nether Star → Spear Upgrader (configurable in config.yml under spear-upgrader.recipe)

Spear Tier Progression

Tier
Item
Attack Bonus (default)
Wooden
Wooden Hoe
+3.0
Stone
Stone Hoe
+4.0
Copper
Iron Hoe (copper-colored name)
+5.0
Gold
Golden Hoe
+6.0
Iron
Iron Hoe
+7.0
Diamond
Diamond Hoe
+8.0
Netherite
Netherite Hoe
+9.0

All values, enchantment blacklist, border duration, and messages are configurable in config.yml.

noobrun

why spear material is hoe keep it spear

Kodari AI
KodariMay 1 at 8:54 am 7,750 (v2)

The cleanest “spear” material in vanilla Minecraft is the Trident — it’s the only actual polearm/spear shape in the game. I’ll switch all tiers to use TRIDENT (the PDC already identifies tier, name, damage, and lore, so they’re all distinct at runtime).

Now fix the fallback material in SpearManager and remove the stale comment about hoe sharing:

All 7 spear tiers now use TRIDENT as their base material — the actual spear/polearm item in Minecraft. Since every tier is differentiated by PDC tier key, display name, lore, and damage modifier rather than by material, nothing else in the plugin needed to change. The durability-carry logic in upgradeSpear also simplifies naturally since all tiers now share the same material.

noobrun

config.yml cannot be accesed

Kodari AI
KodariMay 1 at 8:55 am 6,063 (v2)

The issue is that saveDefaultConfig() writes the file to disk, but plugin.getConfig() reads from what Bukkit already loaded into memory before our ConfigManager runs. A reloadConfig() call after saveDefaultConfig() ensures the file is actually read into memory.

Added plugin.reloadConfig() after saveDefaultConfig() in ConfigManager so the config file is fully read into memory before any value is accessed.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
12 897
src/main/java/com/rivalmc/rivalspears/RivalSpears.java
package com.rivalmc.rivalspears;

import com.rivalmc.rivalspears.commands.StartSMPCommand;
import com.rivalmc.rivalspears.listeners.DropListener;
import com.rivalmc.rivalspears.listeners.InventoryListener;
import com.rivalmc.rivalspears.listeners.SpearListener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class RivalSpears extends JavaPlugin {

    private ConfigManager configManager;
    private SpearManager spearManager;
    private SMPManager smpManager;

    // Holds spears removed from death drops so they can be restored on respawn
    private final Map<UUID, ItemStack> pendingRespawnSpears = new HashMap<>();

    @Override
    public void onEnable() {
        configManager = new ConfigManager(this);
        spearManager = new SpearManager(this);
        smpManager = new SMPManager(this);

        spearManager.registerUpgraderRecipe();

        getServer().getPluginManager().registerEvents(new SpearListener(this), this);
        getServer().getPluginManager().registerEvents(new InventoryListener(this), this);
        getServer().getPluginManager().registerEvents(new DropListener(this), this);

        getCommand("startsmp").setExecutor(new StartSMPCommand(this));

        getLogger().info("RivalSpears enabled.");
    }

    @Override
    public void onDisable() {
        getLogger().info("RivalSpears disabled.");
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public SpearManager getSpearManager() {
        return spearManager;
    }

    public SMPManager getSmpManager() {
        return smpManager;
    }

    public Map<UUID, ItemStack> getPendingRespawnSpears() {
        return pendingRespawnSpears;
    }
}