rick943kkk
📎 1 file 1,195 chars
📄
pasted-code-1773211429013.txt
txt 57 lines
▶
Create a Minecraft Paper plugin (Java, 1.20+) called PepeEconomy.

The plugin must connect to a SQLite database called pepe.db used by a Discord bot.

Database tables already exist:

accounts:
discord_id TEXT
uuid TEXT
balance INTEGER

link_codes:
code TEXT
discord_id TEXT
expire INTEGER

Commands required:

/pepe link 
- Player enters the code generated from Discord
- Check link_codes table
- Verify the code exists and has not expired
- Link the player's UUID to the discord_id in the accounts table
- Delete the code after linking
- Send success message

/pepe unlink
- Remove the discord_id connection from the player
- Keep the balance attached to the UUID

/pepe balance
- Show player balance

/pepe pay  
- Transfer money between two Minecraft players

Requirements:

- Use SQLite JDBC
- Work on Paper
- Prevent negative balances
- Prevent paying yourself
- Support offline players
- Clean command handling
- Use async database queries
- Config.yml for database path
- Messages.yml for messages

Structure:

PepeEconomy
├ commands
├ database
├ link system
├ economy system

Make the plugin production ready.
Kodari AI
KodariMar 11 at 6:45 am 15,804 (v2)

I’ll create a production-ready PepeEconomy plugin with Discord integration through SQLite.

PepeEconomy
A production-ready Paper plugin that bridges Minecraft economy with Discord through SQLite database integration. Features include Discord account linking via temporary codes, balance management, and player-to-player transactions. Supports async database operations, offline player transactions, and comprehensive message customization. Designed to work seamlessly with an external Discord bot sharing the same database.

Production-ready PepeEconomy plugin created with Discord integration, async SQLite operations, comprehensive error handling, and full message customization.

rick943kkk
📎 1 file 1,820 chars
📄
pasted-code-1773212689906.txt
txt 82 lines
▶
update it 
**PepeEconomy** (Java, Paper 1.21+).
Currently the plugin only connects to **SQLite (pepe.db)**, but I want it to support **MySQL instead**, because the database will be shared with a Discord bot.

Please modify the plugin so the **database system supports MySQL**.

Requirements:

1. Replace the SQLite-only system with a **database manager that supports both MySQL and SQLite**, selected through `config.yml`.

2. The config.yml should look like this:

database:
type: mysql
host: india-01.uvm.buzz
port: 12100
database: pepe_economy
username: USERNAME
password: PASSWORD

settings:
min-payment: 1
max-payment: 1000000

If `type` is `sqlite`, then use:
database:
type: sqlite
path: plugins/PepeEconomy/pepe.db

3. The plugin must connect using JDBC.

MySQL connection example:

jdbc:mysql://HOST:PORT/DATABASE?useSSL=false&autoReconnect=true

4. Use **PreparedStatements** for all queries.

5. Database operations must run **asynchronously using BukkitScheduler** to prevent server lag.

6. Tables must automatically create if they do not exist.

Tables:

accounts:
uuid VARCHAR(36) PRIMARY KEY
discord_id VARCHAR(32)
balance INT DEFAULT 0

link_codes:
code VARCHAR(16)
discord_id VARCHAR(32)
expire BIGINT

7. The existing commands must still work:

/pepe link 
/pepe unlink
/pepe balance
/pepe pay  

8. The plugin must log:

[PepeEconomy] Connected to MySQL database

or

[PepeEconomy] Connected to SQLite database

depending on config.

9. The plugin must be compatible with **Paper 1.21+**.

10. Keep the current plugin structure:

PepeEconomy
├ commands
├ database
├ link
├ economy

Return the **updated Java classes**, especially the **DatabaseManager.java** and any code that needs modification.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
11 752
src/main/java/com/pepeeconomy/PepeEconomy.java
package com.pepeeconomy;

import com.pepeeconomy.commands.PepeCommand;
import com.pepeeconomy.database.DatabaseManager;
import com.pepeeconomy.economy.EconomyManager;
import com.pepeeconomy.link.LinkManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class PepeEconomy extends JavaPlugin {
    private DatabaseManager databaseManager;
    private EconomyManager economyManager;
    private LinkManager linkManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("messages.yml", false);
        
        databaseManager = new DatabaseManager(this);
        databaseManager.initialize();
        
        economyManager = new EconomyManager(this);
        linkManager = new LinkManager(this);
        
        PepeCommand pepeCommand = new PepeCommand(this);
        getCommand("pepe").setExecutor(pepeCommand);
        getCommand("pepe").setTabCompleter(pepeCommand);
        
        getLogger().info("PepeEconomy has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (databaseManager != null) {
            databaseManager.close();
        }
        getLogger().info("PepeEconomy has been disabled!");
    }
    
    public void reloadConfigs() {
        reloadConfig();
        databaseManager.reloadMessages();
    }
}