Enes
📎 1 file 6,068 chars
📄
pasted-code-1789300432419.txt
txt 152 lines
▶
"I want you to create a fully customizable Minecraft plugin for version 1.20.1 using the Paper API. The plugin is a roguelike shop system. Here are the full requirements:

Core System:
The shop is a chest GUI (3 rows) that generates random items each time it opens. Items are pulled from a pool divided into 5 rarity tiers: Common, Uncommon, Rare, Epic, and Legendary. Each rarity has its own price range and drop weight. The shop shows between a configurable minimum and maximum number of items per session (default 3-6). Each item can only be purchased once per session. After purchase, the slot updates to show a barrier named 'Sold Out' without closing the GUI.

Rarity Weights and Price Ranges (all configurable in config.yml):

Common (40% chance): 5-15 currency
Uncommon (25% chance): 20-40 currency
Rare (15% chance): 50-80 currency
Epic (12% chance): 90-130 currency
Legendary (8% chance): 150-250 currency

Item Pool:
Items are loaded from a separate items.yml file at startup. Each item has the following properties: mmoitems type (SWORD, BOW, SPEAR, CROSSBOW, HAMMER, GAUNTLET, LUTE or any other MMOItems type), mmoitems item ID, display material (any valid Bukkit Material), custom model data (integer, optional, 0 means none), display name (supports & color codes and hex colors like <#RRGGBB>), rarity tier (common/uncommon/rare/epic/legendary). Items are given to players using the MMOItems API: MMOItems.plugin.getMMOItem(Type, ID) then give to player inventory. If MMOItems API fails, fall back to console command: /mmoitems give [TYPE] [ID] [PLAYER] 1

Currency:
The plugin uses GemsEconomy API with a custom currency. The currency name is configurable in config.yml (default: 'Cevher'). Balance checking and withdrawing must use GemsEconomy API directly: EconomyManager.get().getAccount(uuid) and account.withdraw(amount, currency). Never use console commands for currency.

GUI Layout (all customizable in config.yml):

Background material configurable (default: GRAY_STAINED_GLASS_PANE)
Background display name configurable (default: single space)
Item display slots configurable as a list (default: 10,11,12,13,14,15,16,19,20,21,22,23,24,25)
Reroll button slot configurable (default: 22 of bottom row = slot 49 in a 6-row, or slot 22 in 3-row)
Reroll button material, name and lore configurable
Each item displayed with its correct Bukkit material and custom model data
Item lore format fully configurable with placeholders: {price}, {rarity}, {type}
HideFlags NBT set to 63 on all display items to hide attributes and enchantments
All inventory clicks cancelled to prevent item theft

Reroll System (all configurable):

Reroll cost configurable (default: 50)
Reroll cooldown configurable in seconds (default: 15)
Cooldown message configurable with {remaining} placeholder
Insufficient funds message configurable
Reroll success message configurable

Messages (all configurable in config.yml with & color code support):

Shop open message
Purchase success message with {item} and {price} placeholders
Already purchased message
Insufficient funds message with {price} placeholder
Reroll cooldown message with {remaining} placeholder
Reroll success message
Sold out message

Data Management:

All per-player shop data stored in a HashMap, cleared on quit
Item pool loaded from items.yml on startup and on /shopreload
No database or file persistence needed for player data

items.yml Structure:

yaml
items:
  - id: WORNDAGGER
    type: SWORD
    material: IRON_SWORD
    custom-model-data: 180
    display-name: '&f뀍 &7Worn Dagger'
    rarity: common
  - id: GRIMCLAW
    type: SWORD
    material: STONE_SWORD
    custom-model-data: 0
    display-name: '&f뀐 &aGrimclaw'
    rarity: uncommon

config.yml Structure:

yaml
shop:
  title: '&8Roguelike Shop'
  min-items: 3
  max-items: 6
  currency: 'Cevher'
  reroll-cost: 50
  reroll-cooldown: 15
  background-material: GRAY_STAINED_GLASS_PANE
  item-slots: [10,11,12,13,14,15,16,19,20,21,22,23,24,25]
  reroll-slot: 49

rarities:
  common:
    weight: 40
    min-price: 5
    max-price: 15
    display-name: '&7Common'
  uncommon:
    weight: 25
    min-price: 20
    max-price: 40
    display-name: '&aUncommon'
  rare:
    weight: 15
    min-price: 50
    max-price: 80
    display-name: '&9Rare'
  epic:
    weight: 12
    min-price: 90
    max-price: 130
    display-name: '&5Epic'
  legendary:
    weight: 8
    min-price: 150
    max-price: 250
    display-name: '&6Legendary'

messages:
  purchase-success: '&aPurchased {item} for {price} Cevher!'
  insufficient-funds: '&cInsufficient funds! Need {price} Cevher.'
  already-purchased: '&cYou already bought this item!'
  reroll-cooldown: '&cReroll on cooldown! Wait {remaining} seconds.'
  reroll-success: '&aShop rerolled for {cost} Cevher!'
  sold-out: '&cSold out!'

Commands:

/shop — opens the shop for the executing player, permission: roguelikeshop.use
/shopreload — reloads config.yml and items.yml without restart, permission: roguelikeshop.admin

Dependencies (provide correct Maven repository URLs and versions):

Paper API 1.20.1-R0.1-SNAPSHOT (repo: papermc)
MMOItems 6.9.5 (repo: https://nexus.phoenixdevt.fr/repository/maven-public/)
GemsEconomy 4.9 (repo: https://repo.auxilor.io/repository/maven-public/)

Plugin.yml:

name: RoguelikeShop
version: 1.0.0
api-version: 1.20
main class path: me.yourname.roguelikeshop.RoguelikeShop
softdepend: [MMOItems, GemsEconomy]

Java Class Structure:

RoguelikeShop.java (main class)
ShopManager.java (handles item pool, player sessions, random generation)
ShopGUI.java (handles inventory creation and display)
ShopListener.java (handles inventory click events)
ConfigManager.java (handles config.yml and items.yml loading)
ShopItem.java (data class for pool items)
PlayerSession.java (data class for per-player shop state)
ShopCommand.java (handles /shop and /shopreload)

Please generate every class completely with no placeholders or TODO comments. Include full pom.xml with all dependencies and repositories. Include sample items.yml with at least 5 items per rarity covering all MMO
Kodari AI
KodariSep 13 at 11:56 am 13
RoguelikeShop
A fully customizable Paper plugin for Minecraft 1.20.1 that implements a roguelike shop system with a chest GUI. Players open a 3-row inventory GUI displaying randomly generated items from a configurable pool divided into five rarity tiers (Common, Uncommon, Rare, Epic, Legendary), each with weighted drop chances and price ranges. Items are purchased using GemsEconomy currency, with per-session purchase tracking, sold-out slot updates, and a configurable reroll system with cooldown. All aspects—rarities, prices, messages, GUI layout, item pool, and reroll mechanics—are fully configurable via config.yml and items.yml files. The plugin integrates with MMOItems for item generation and supports custom model data, display names, and lore formatting.
  • Establish Maven, Paper metadata, defaults, and the MMO item pool.

  • Add configurable shop/session generation with weighted rarities and GemsEconomy payments.

  • Build the protected 3-row GUI, commands, listener, and MMOItems delivery fallback.

Created the complete Paper 1.20.1 RoguelikeShop project with:

  • Maven build configuration, Paper/MMOItems/GemsEconomy repositories, and plugin metadata.

  • Configurable weighted rarity pool, prices, item count, GUI layout, rerolls, cooldowns, and messages.

  • Separate items.yml with five sample entries for every rarity tier.

  • Per-player in-memory shop sessions cleared on quit.

  • Protected 3-row GUI with sold-out replacements and reroll support.

  • MMOItems API item delivery with command fallback.

  • GemsEconomy balance checks and withdrawals.

  • /shop and /shopreload commands with permissions.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
14 879
src/main/java/me/yourname/roguelikeshop/RoguelikeShop.java
package me.yourname.roguelikeshop;

import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public final class RoguelikeShop extends JavaPlugin {
    private ConfigManager configManager;
    private ShopManager shopManager;

    @Override
    public void onEnable() {
        this.saveDefaultConfig();
        this.saveResource("items.yml", false);
        this.configManager = new ConfigManager(this);
        this.shopManager = new ShopManager(this, this.configManager);
        Bukkit.getPluginManager().registerEvents(new ShopListener(this.shopManager), this);

        ShopCommand command = new ShopCommand(this);
        this.getCommand("shop").setExecutor(command);
        this.getCommand("shop").setTabCompleter(command);
        this.getCommand("shopreload").setExecutor(command);
    }
}