Abhi

create plugin

📎 1 file 6,980 chars
📄
pasted-code-1788842294096.txt
txt 75 lines
▶
# Gems Minecraft Plugin — Generation Prompt

Build a Minecraft Paper/Spigot plugin (Java, Paper API 1.20+) called **"Gemstone"** — a gem-collection RPG plugin where players acquire elemental gems, each granting unique Passive/Active/Custom abilities, socketable into gear. Pure vanilla + Bukkit/Paper API only, no external dependencies required (but structure it so it can optionally hook into MythicMobs/ItemsAdder later if present).

## Core Concept
Players collect elemental Gems of varying rarity. Each gem grants 3 abilities (1 Passive, 1 Active, 1 Custom/Ultimate) when held/socketed. New players get an exciting animated "Gem Roll" (gacha-style) on first join to receive their starter gem.

## 1. Gem Types (Elements)
Implement 8 elemental gem types, each with its own theme and ability kit:

| Gem | Theme | Passive (example) | Active (example) | Custom/Ultimate (example) |
|---|---|---|---|---|
| Fire | Damage/burn | Chance to ignite target on hit | Throw Fireball (cooldown) | "Inferno Zone" — AOE burning ground, long cooldown |
| Ice | Slow/control | Chance to slow target on hit | "Frost Nova" — freeze nearby enemies | "Absolute Zero" — long AOE freeze + shatter damage |
| Earth | Defense/tank | Passive damage reduction | "Stone Wall" — temporary barrier/knockback resist | "Earthquake" — AOE stun + damage |
| Wind | Speed/mobility | Passive speed boost | "Gust Dash" — short forward dash | "Cyclone" — pull enemies in + launch |
| Lightning | Chain damage | Chance to chain-hit nearby enemy | "Chain Bolt" — jumps between enemies | "Storm Call" — repeated lightning strikes in area |
| Void/Shadow | Stealth/mobility | Brief invisibility after taking damage | "Shadow Step" — short teleport | "Umbral Prison" — trap + damage over time |
| Life | Healing/regen | Passive HP regen boost | "Healing Pulse" — heal self/allies nearby | "Sanctuary" — AOE heal-over-time zone |
| Blood | Lifesteal/sacrifice | Lifesteal % on melee hits | "Blood Pact" — sacrifice HP for damage boost | "Hemorrhage" — AOE bleed + self-heal from damage dealt |

## 2. Rarity Tiers
- Common, Rare, Epic, Legendary.
- Higher rarity = stronger ability values (more damage, shorter cooldowns, longer durations) — scale via config-driven multipliers, not separate code paths.
- Drop weight table configurable in config.yml (Common most common, Legendary near-impossible).

## 3. Gem Acquisition
- **Mob drops**: specific mobs drop specific elemental gems (e.g., Blaze → Fire Gem, Stray → Ice Gem, Enderman → Void Gem).
- **Mining**: custom "Gem Ore" block variant that can spawn/be placed in the world, drops random gem on break.
- **Dungeon/chest loot tables**.
- **Fusion/Crafting**: combine 3 gems of the same rarity to guarantee 1 gem of the next rarity tier up (custom crafting recipe via a Fusion Table GUI, not vanilla crafting table).

## 4. New Player Gem Roll (Gacha Onboarding)
- On a player's **first ever join**, automatically open a custom GUI showing a slot-machine-style "rolling" animation:
  - Cycle through gem icons rapidly (scheduler task updating GUI slot every 2-3 ticks) for ~3-4 seconds, then slow down and land on the rewarded gem.
  - Play sound effects during the roll (e.g., experience orb pickup sound on each cycle tick) and a distinct "win" sound when it lands.
  - Show a Title/Subtitle reveal of the won gem (e.g., "🔥 FIRE GEM 🔥" with rarity color).
  - Final gem is weighted-random per the rarity table and automatically added to the player's inventory.
  - Send a System-style chat message: `[Gem System]: You rolled a Fire Gem (Rare)!`
  - Persist a `hasRolled` flag per player (SQLite/YAML) so this only triggers once automatically.
- **Paid Reroll**: players can manually trigger the same roll animation again via `/gems reroll`, at the cost of a custom currency (**Gem Shards**), earned from mob kills, quests, or selling duplicate gems. Reroll uses the same weighted table and animation.

## 5. Gem Socketing System
- Gear (weapons, armor, accessories) has socket slots based on item rarity (e.g., Common = 1 slot, Legendary = 3 slots), tracked via NBT/PersistentDataContainer.
- `/gems socket ` and `/gems unsocket` commands, or a dedicated Socketing Table GUI (drag gem + item in, confirm).
- Socketed gem's abilities become usable while that item is held/worn.
- Multiple gems socketed on the same item = access to multiple ability sets (with independent cooldowns).

## 6. Gem Mastery/Leveling
- Each gem instance tracks its own XP (gained from kills/damage dealt while its abilities are used).
- Gem leveling increases ability power (higher damage, shorter cooldown, longer duration) via config-driven scaling formulas.
- At max mastery level, gem becomes "Awakened": visual upgrade (custom model data / enchant glint override) + stat boost.

## 7. Gem Synergies
- Socketing 2+ gems of the same element on one item grants a bonus effect (e.g., 2x Fire = increased burn duration).
- Socketing specific opposite/complementary elements together unlocks a special hybrid passive (e.g., Fire + Ice = "Steam Burst" — AOE knockback proc on hit).
- Synergy table should be config-driven (element pair → bonus effect ID) so it's easy to expand.

## 8. Economy & Progression Extras
- **Gem Shards**: custom currency item, earned from combat/quests, spent on `/gems reroll` and in a **Gem Shop** (`/gems shop`) to directly buy specific low-rarity gems or cosmetic effects.
- **Gem Trials**: optional special mini-dungeon/arena (instanced) with high difficulty but guaranteed higher-rarity gem reward on completion.
- **PvP Balance flag**: config option per-gem or per-ability to disable/nerf specific abilities in PvP-flagged regions/worlds.

## Technical Requirements
- Java 17+, Paper API 1.20+, Maven project structure.
- Per-player and per-gem-instance data persisted in SQLite (preferred) or YAML.
- Modular code: separate managers for GemManager, RollManager (roll/reroll GUI + animation), SocketManager, MasteryManager, SynergyManager, EconomyManager, DataManager.
- config.yml for all tunable values: rarity weights, ability scaling per rarity/mastery level, synergy pairs, mob-to-gem drop mappings, currency costs.
- Cooldowns managed via a scheduler-based CooldownManager, displayed on the action bar.
- All player-facing text should use a consistent bracketed "System" tone (e.g., `[Gem System]: Fusion successful — you received an Epic Ice Gem!`).
- Include a `/gems help` command listing all subcommands (roll, reroll, socket, unsocket, shop, fuse, mastery).
- Build as a standalone plugin, but keep class/package structure decoupled enough that it could later be merged into a larger RPG plugin (e.g., a Solo Leveling-style hunter plugin) without major rework.

## Deliverable
Provide the full plugin source code (Maven project: pom.xml + all Java classes organized in packages) plus a plugin.yml, ready to compile and drop into a Paper server's plugins folder.
Kodari AI
KodariSep 8 at 4:50 am 3
GemstoneRPG
A comprehensive gem-collection RPG plugin for Paper 1.20+ featuring 8 elemental gem types with unique Passive/Active/Ultimate abilities. Players acquire gems through mob drops, mining, chests, and a gacha-style Gem Roll animation on first join. Includes socketing system for gear, gem mastery/leveling with XP tracking, config-driven synergies between elements, Gem Shards economy with shop and reroll functionality, and a Fusion Table GUI for crafting higher rarity gems. Features modular managers for gems, rolling, socketing, mastery, synergies, economy, and data persistence via SQLite/YAML, with cooldown management and action bar displays.
  1. Create the Maven/Paper project metadata and configurable plugin resources.

  2. Add gem models, persistence, economy, cooldown, gem/socket/mastery/synergy services.

  3. Implement rolling, fusion, shop, abilities, commands, and event listeners.

  4. Register all services and commands in the main plugin class.

Created the Gemstone Paper plugin project with:

  • Maven Java 17 setup using Paper API 1.20.6

  • Eight elemental gem types and four rarity tiers

  • Weighted first-join gem roll animation

  • Rerolls using persistent Gem Shards

  • YAML player persistence

  • Socketing and unsocketing system using PersistentDataContainer

  • Gem mastery XP and leveling

  • Passive combat effects for gems

  • Active and ultimate abilities with cooldowns

  • Mob gem drops and Gem Ore mining drops

  • Fusion Table GUI

  • Gem Shop GUI

  • Configurable rarity scaling, mastery, economy, mob drops, ore, and PvP-disabled worlds

  • /gems command with help, roll, reroll, socket, unsocket, shop, fuse, mastery, ability, shards, and admin give subcommands

  • Modular managers and listeners prepared for future MythicMobs or ItemsAdder integrations

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
25 1,213
src/main/java/com/kodari/gemstone/GemstonePlugin.java
package com.kodari.gemstone;

import com.kodari.gemstone.command.GemsCommand;
import com.kodari.gemstone.data.DataManager;
import com.kodari.gemstone.listener.BlockListener;
import com.kodari.gemstone.listener.CombatListener;
import com.kodari.gemstone.listener.EntityListener;
import com.kodari.gemstone.listener.InventoryListener;
import com.kodari.gemstone.listener.PlayerListener;
import com.kodari.gemstone.manager.AbilityManager;
import com.kodari.gemstone.manager.EconomyManager;
import com.kodari.gemstone.manager.FusionManager;
import com.kodari.gemstone.manager.GemManager;
import com.kodari.gemstone.manager.MasteryManager;
import com.kodari.gemstone.manager.RollManager;
import com.kodari.gemstone.manager.ShopManager;
import com.kodari.gemstone.manager.SocketManager;
import com.kodari.gemstone.manager.SynergyManager;
import com.kodari.gemstone.util.Text;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.NamespacedKey;
import org.bukkit.persistence.PersistentDataType;

public class GemstonePlugin extends JavaPlugin {
    private DataManager dataManager;
    private GemManager gemManager;
    private EconomyManager economyManager;
    private SocketManager socketManager;
    private MasteryManager masteryManager;
    private SynergyManager synergyManager;
    private RollManager rollManager;
    private FusionManager fusionManager;
    private ShopManager shopManager;
    private AbilityManager abilityManager;
    private NamespacedKey gemItemKey, elementKey, rarityKey, levelKey, experienceKey, shardKey, socketCountKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        gemItemKey = new NamespacedKey(this, "gem-item");
        elementKey = new NamespacedKey(this, "element");
        rarityKey = new NamespacedKey(this, "rarity");
        levelKey = new NamespacedKey(this, "mastery-level");
        experienceKey = new NamespacedKey(this, "mastery-xp");
        shardKey = new NamespacedKey(this, "gem-shards");
        socketCountKey = new NamespacedKey(this, "socket-count");

        dataManager = new DataManager(this);
        gemManager = new GemManager(this);
        economyManager = new EconomyManager(this, dataManager);
        socketManager = new SocketManager(this, gemManager);
        masteryManager = new MasteryManager(this, gemManager);
        synergyManager = new SynergyManager();
        rollManager = new RollManager(this, gemManager, dataManager);
        fusionManager = new FusionManager(this, gemManager);
        shopManager = new ShopManager(this, gemManager, economyManager);
        abilityManager = new AbilityManager(this, gemManager);

        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
        getServer().getPluginManager().registerEvents(new InventoryListener(this), this);
        getServer().getPluginManager().registerEvents(new CombatListener(this), this);
        getServer().getPluginManager().registerEvents(new EntityListener(this), this);
        getServer().getPluginManager().registerEvents(new BlockListener(this), this);
        GemsCommand command = new GemsCommand(this);
        getCommand("gems").setExecutor(command);
        getCommand("gems").setTabCompleter(command);
        getLogger().info("Gemstone enabled with eight elemental gem types.");
    }

    public String prefix() { return Text.color(getConfig().getString("messages.prefix", "&8[&dGem System&8] &f")); }
    public String message(String key) { return prefix() + Text.color(getConfig().getString("messages." + key, key)); }
    public boolean isPvpDisabled(World world) { return getConfig().getStringList("pvp-disabled-worlds").contains(world.getName()); }
    public FileConfiguration config() { return getConfig(); }

    public NamespacedKey gemItemKey() { return gemItemKey; }
    public NamespacedKey elementKey() { return elementKey; }
    public NamespacedKey rarityKey() { return rarityKey; }
    public NamespacedKey levelKey() { return levelKey; }
    public NamespacedKey experienceKey() { return experienceKey; }
    public NamespacedKey shardKey() { return shardKey; }
    public NamespacedKey socketCountKey() { return socketCountKey; }
    public NamespacedKey socketElementKey(int slot) { return new NamespacedKey(this, "socket-" + slot + "-element"); }
    public NamespacedKey socketRarityKey(int slot) { return new NamespacedKey(this, "socket-" + slot + "-rarity"); }
    public NamespacedKey socketLevelKey(int slot) { return new NamespacedKey(this, "socket-" + slot + "-level"); }
    public NamespacedKey socketExperienceKey(int slot) { return new NamespacedKey(this, "socket-" + slot + "-xp"); }

    public DataManager data() { return dataManager; }
    public GemManager gems() { return gemManager; }
    public EconomyManager economy() { return economyManager; }
    public SocketManager sockets() { return socketManager; }
    public MasteryManager mastery() { return masteryManager; }
    public SynergyManager synergies() { return synergyManager; }
    public RollManager rolls() { return rollManager; }
    public FusionManager fusion() { return fusionManager; }
    public ShopManager shop() { return shopManager; }
    public AbilityManager abilities() { return abilityManager; }
}