A

22. SPECIAL HAY SEED SYSTEM

Add a special item obtainable with:

/siano

The command should give the player a special Hay Seed.

The item must have:

* A configurable material. * A unique internal identifier using PersistentDataContainer. * A configurable custom name, for example &e&lSpecjalne Nasionko Siana. * Configurable lore. * It must NOT be possible to use a normal item renamed to the same name as a replacement.

PLANTING

When the player plants the special Hay Seed:

* It should immediately create/grow the configured crop. * The planted crop should become a permanent GenCash farming block. * The player should NOT be able to permanently destroy it. * The special crop should work with the GenCash hoe system.

INSTANT REGENERATION

When a player breaks/harvests the special Hay crop:

* Give the configured Cash reward. * Immediately regenerate/replant the crop in the exact same location. * The regeneration should happen essentially instantly. * The block must never remain permanently destroyed. * Normal Minecraft item drops should be disabled unless configured otherwise.

Example:

/siano → player receives Special Hay Seed → plants it → crop immediately grows → player harvests it → receives Cash → crop instantly comes back.

The system must prevent duplication and double rewards.

ADMIN CONTROL

Add configurable permissions and commands:

/siano — give the special seed.

/siano give <player> <amount> — give seeds to another player.

/siano reload — reload the system.

Only players with the appropriate permission should be able to give seeds to other players.

Make all names, lore, rewards and behavior configurable in config.yml.

Kodari AI
KodariAug 28 at 10:20 am 1
SpecialHaySeedSystem
A Minecraft plugin adding a special Hay Seed obtainable via /siano command. The seed plants a permanent GenCash farming crop that instantly regenerates when harvested, granting configurable Cash rewards. Features PersistentDataContainer-based item identification preventing renamed-item exploits, configurable materials, names, lore, and rewards in config.yml. Includes admin commands for giving seeds to players and reloading configuration, with permission-based access control. Prevents duplication and double rewards while integrating with the GenCash hoe system.

[Generation stopped]

A
📎 1 file 17,351 chars
📄
pasted-code-1787912459439.txt
txt 1042 lines
▶
Create a **fully working, production-ready Minecraft Paper plugin** named **GenCash** for **Paper 1.20.1** using **Java 21** and **Maven**.

This is NOT a prototype, example, pseudocode project, or simplified version.

The final project must be **complete, compilable, tested for consistency, and ready to put directly into a Paper 1.20.1 server**.

---

# CRITICAL DEVELOPMENT RULES

Before generating the final code:

1. Design the complete architecture.
2. Make sure every class, method, import, dependency, command and configuration key exists and matches the rest of the project.
3. Check all Bukkit/Paper 1.20.1 APIs used in the code.
4. Do NOT use APIs that do not exist in Paper 1.20.1.
5. Do NOT mix APIs from newer Minecraft versions.
6. Use Java 21 syntax only where appropriate.
7. Make sure `pom.xml` contains every required dependency.
8. Make sure `plugin.yml` contains every command and permission.
9. Make sure every command registered in `plugin.yml` actually exists.
10. Make sure every permission used by the Java code is declared or intentionally handled.
11. Make sure every configuration value used by Java exists in `config.yml`.
12. Make sure there are no missing classes or methods.
13. Make sure there are no duplicate class names.
14. Make sure there are no package/import errors.
15. Make sure the plugin does not require unnecessary external plugins.
16. Do not use Vault for the internal GenCash currencies.
17. Do not use NMS unless absolutely necessary.
18. Prefer the official Bukkit/Paper API.
19. Handle null values safely.
20. Validate all player input.
21. Prevent exploits and duplicate rewards.
22. Keep all database operations safe and efficient.
23. The final code must compile with Maven without errors.

At the end, perform a **full consistency check of the entire project** before presenting the final files.

---

# PLUGIN INFORMATION

Plugin name:

**GenCash**

Minecraft:

**Paper 1.20.1**

Java:

**Java 21**

Build system:

**Maven**

Main package:

`pl.gencash`

Use a clean modular architecture.

---

# 1. TWO CURRENCIES

The plugin has two completely separate currencies.

## GROSZE

Grosze are the normal farming currency.

Players receive Grosze when harvesting GenCash crops.

## VPLN

VPLN is a rare bonus currency.

VPLN should NOT be awarded on every harvest.

VPLN must be stored separately from Grosze.

Do not mix the two currencies.

Use `BigDecimal` or another safe decimal system for VPLN because values such as `0.01` must be represented accurately.

Do not use floating-point calculations for financial-style VPLN balances where precision could cause problems.

---

# 2. GROSZE

Create a persistent Grosze economy.

Players can earn Grosze from crops.

Example:

```yaml
crops:
  WHEAT:
    enabled: true
    grosze: 1
  CARROTS:
    enabled: true
    grosze: 2
  POTATOES:
    enabled: true
    grosze: 2
  BEETROOTS:
    enabled: true
    grosze: 3
```

Every crop reward must be configurable.

---

# 3. SUPPORTED CROPS

Support at minimum:

* WHEAT
* CARROTS
* POTATOES
* BEETROOTS
* NETHER_WART
* SUGAR_CANE
* MELON
* PUMPKIN

The system must only process crops explicitly enabled in the configuration.

---

# 4. NO PHYSICAL FARMING DROPS

This is extremely important.

When a GenCash crop is harvested:

**NO normal Minecraft farming items may drop.**

For example:

Wheat:

* No Wheat
* No Wheat Seeds

Carrots:

* No Carrots

Potatoes:

* No Potatoes
* No Potato Seeds

Beetroot:

* No Beetroot
* No Beetroot Seeds

The player receives the configured **Grosze** instead.

Make sure drops are prevented even when using a special Brush.

Do not accidentally allow drops from the normal Minecraft block-break event.

---

# 5. CROP REGENERATION

GenCash crops must regenerate after harvesting.

The regeneration time must be configurable.

Example:

```yaml
regeneration:
  default-seconds: 5
```

The special Hay system described later must support **instant regeneration**.

When a crop is harvested:

1. Validate the crop.
2. Validate the tool.
3. Calculate the reward.
4. Give Grosze.
5. Possibly roll for VPLN.
6. Prevent physical drops.
7. Regenerate the crop.
8. Update statistics.

Do not give rewards twice for one crop.

---

# 6. CROP MATURITY

Only mature crops should reward players.

For example:

Wheat, carrots, potatoes and beetroot should require their maximum age.

Nether Wart should require its maximum growth stage.

Do NOT reward players for immature crops.

Make maturity checks compatible with Paper 1.20.1.

---

# 7. SPECIAL BRUSHES

Do NOT use `/motyka`.

Use:

```text
/brush 1x1
/brush 3x3
/brush 5x5
/brush 7x7
/brush 9x9
```

These commands give special farming hoes.

The item may look like a normal hoe, but internally it must be a **GenCash Brush**.

Use `PersistentDataContainer` to identify brushes.

Never identify a brush only by its display name or lore.

A normal diamond hoe renamed to the same name must NOT become a GenCash Brush.

---

# 8. BRUSH AREAS

The sizes must be exact.

### 1x1

Only the activated crop.

### 3x3

```text
XXX
XXX
XXX
```

### 5x5

```text
XXXXX
XXXXX
XXXXX
XXXXX
XXXXX
```

### 7x7

7 blocks wide × 7 blocks long.

### 9x9

9 blocks wide × 9 blocks long.

The activated crop must be the center of the area whenever possible.

Only configured mature GenCash crops may be harvested.

---

# 9. BRUSH MUST NEVER DESTROY RANDOM BLOCKS

A Brush must NEVER destroy normal blocks.

It may only process valid GenCash crops.

Never affect:

* Stone
* Dirt
* Grass
* Ores
* Chests
* Barrels
* Furnaces
* Hoppers
* Player structures
* Decorative blocks
* Unconfigured blocks
* Immature crops

If the player uses a 9x9 Brush, it does NOT mean "destroy everything in 9x9".

It means:

**"Harvest valid mature GenCash crops inside 9x9."**

---

# 10. BRUSH COMMANDS

Create:

```text
/brush 1x1
/brush 3x3
/brush 5x5
/brush 7x7
/brush 9x9
```

Admin command:

```text
/brush give  
```

Example:

```text
/brush give Steve 3x3
```

Also:

```text
/brush list
```

Display available brush sizes.

Add tab completion.

---

# 11. BRUSH PERMISSIONS

Use:

```text
gencash.brush
gencash.brush.1x1
gencash.brush.3x3
gencash.brush.5x5
gencash.brush.7x7
gencash.brush.9x9
gencash.brush.give
```

Do not accidentally give regular players administrative permissions.

---

# 12. SPECIAL HAY SEED

Create:

```text
/siano
```

This gives a special item called:

**Special Hay Seed**

The item must have:

* Configurable material
* Configurable name
* Configurable lore
* PersistentDataContainer identifier

A normal item renamed to the same name must NOT work.

---

# 13. HAY SEED PLANTING

When the special Hay Seed is planted:

* Immediately create the configured farming crop.
* Immediately make it mature.
* The player must NOT receive normal crop drops.
* The crop becomes part of the GenCash system.

When harvested:

* Give Grosze.
* Roll for VPLN.
* Give no physical crop items.
* Immediately regenerate the crop.

---

# 14. HAY CROP REGENERATION

Special Hay crops must regenerate **instantly**.

Expected behavior:

```text
HARVEST
↓
REWARD
↓
NO ITEM DROPS
↓
CROP IMMEDIATELY RETURNS
```

The player should be able to repeatedly harvest the crop.

Prevent duplicate rewards caused by multiple events firing.

---

# 15. VPLN SYSTEM

Create a separate currency called:

**VPLN**

VPLN values are represented as Polish złoty-style decimal values.

Possible rewards:

```text
0.01
0.05
0.10
0.25
0.50
1.00
```

The rewards and chances must be configurable.

Example:

```yaml
vpln:
  enabled: true
  rewards:
    "0.01": 50.0
    "0.05": 25.0
    "0.10": 15.0
    "0.25": 7.0
    "0.50": 2.5
    "1.00": 0.5
```

The plugin must validate that configured chances are valid.

Higher rewards should normally have lower chances.

Do not guarantee VPLN every time.

---

# 16. VPLN REWARD

When the random VPLN roll succeeds:

* Add the VPLN amount to the player's balance.
* Add it to their total earned VPLN statistics.
* Show a configurable message.
* Optionally play a sound.
* Optionally show a title.

Example:

```text
&6&lVPLN!
&eWykopałeś &f0.25 zł &eVPLN!
```

---

# 17. /VPLN

Create:

```text
/vpln
```

It should show:

* Current VPLN balance
* Total VPLN earned from farming

Example:

```text
&8&m----------------------
&6&lVPLN
&fTwoje VPLN: &a12.47 zł
&fWykopane VPLN: &e8.32 zł
&8&m----------------------
```

Everything must be configurable.

---

# 18. VPLN ADMIN COMMANDS

Create:

```text
/vpln 
/vpln give  
/vpln take  
/vpln set  
/vpln reset 
/vpln top
```

Validate:

* Invalid player
* Invalid amount
* Negative amount
* Extremely large amount
* Invalid decimal format

Use safe decimal handling.

---

# 19. GROSZE COMMANDS

Create:

```text
/grosze 
/grosze give  
/grosze take  
/grosze set  
/grosze reset 
/grosze top
```

Validate all inputs.

---

# 20. /GENCASH

Create:

```text
/gencash
```

Open the main GenCash GUI.

Create:

```text
/gencash stats
/gencash help
/gencash info
/gencash reload
```

---

# 21. /GENCASH STATS

Display:

* Current Grosze
* Current VPLN
* Total Grosze earned
* Total VPLN earned
* Total crops harvested
* Individual crop statistics

---

# 22. HARVEST TITLE

When a player earns Grosze, optionally display a title.

Example:

Title:

```text
&a&lWOW!
```

Subtitle:

```text
&eZdobyłeś &f27 &egroszy!
```

The amount must use the actual reward.

Placeholder:

```text
{grosze}
```

Make title timing configurable.

---

# 23. DATA STORAGE

Use **SQLite**.

Store:

* UUID
* Grosze
* VPLN
* Total Grosze earned
* Total VPLN earned
* Total crops harvested
* Per-crop statistics

Use UUIDs, never usernames as the primary identifier.

Use an in-memory cache.

Do not access SQLite synchronously every time a block is harvested.

Database writes should be handled safely and efficiently.

Make sure data is saved when:

* Player leaves
* Server shuts down
* Data changes where appropriate

Prevent data loss.

---

# 24. GUI

Create `/gencash`.

GUI should display:

* Grosze
* VPLN
* Statistics
* Brush information
* Top players

Do not make GUI clicks perform unintended actions.

Cancel unwanted inventory interactions where necessary.

Prevent players from taking decorative GUI items.

---

# 25. TOP SYSTEM

Create:

```text
/grosze top
/vpln top
```

Use cached data.

Do not query the entire database repeatedly for every command execution.

---

# 26. EXPLOIT PROTECTION

This is extremely important.

Protect against:

* Double block-break events
* Duplicate rewards
* Duplicate VPLN
* Brush duplication
* Hay Seed duplication
* Item duplication
* Negative balances
* Invalid decimal values
* Overflow
* Repeated event execution
* Fake brushes
* Fake Hay Seeds
* Unloaded chunks causing errors
* Players breaking crops too quickly
* Multiple players interacting with the same crop simultaneously

Use appropriate locks/state tracking where necessary.

Do not permanently lock a crop if a player disconnects.

Clean temporary state when it is no longer needed.

---

# 27. PLAYER DATA SAFETY

When a player joins:

* Load their data.
* If they have no data, create it.
* Cache it.

When they leave:

* Save data.
* Remove cache.

When the server shuts down:

* Save all loaded player data safely.
* Close the database connection.

Do not lose player balances after restart.

---

# 28. CONFIGURATION

Create a clean `config.yml`.

Everything important should be configurable:

* Currency names
* Crop rewards
* Crop regeneration
* Crop maturity
* VPLN rewards
* VPLN chances
* Brush names
* Brush lore
* Brush materials
* Brush sizes
* Hay Seed settings
* Titles
* Sounds
* Messages
* GUI
* Database settings

Do not hard-code values that should be configurable.

---

# 29. COMMAND PERMISSIONS

Use permissions such as:

```text
gencash.admin
gencash.reload

gencash.cash
gencash.cash.give
gencash.cash.take
gencash.cash.set
gencash.cash.reset
gencash.cash.top

gencash.vpln
gencash.vpln.give
gencash.vpln.take
gencash.vpln.set
gencash.vpln.reset
gencash.vpln.top

gencash.brush
gencash.brush.give
gencash.brush.1x1
gencash.brush.3x3
gencash.brush.5x5
gencash.brush.7x7
gencash.brush.9x9

gencash.siano
```

Configure sensible defaults.

---

# 30. TAB COMPLETION

Implement proper tab completion.

Examples:

```text
/brush 
```

shows:

```text
1x1
3x3
5x5
7x7
9x9
give
list
```

For player arguments, suggest online players.

For numerical arguments, validate input.

---

# 31. PERFORMANCE

The plugin must be suitable for a real multiplayer server.

Avoid:

* Infinite loops
* Huge synchronous scans
* Unnecessary repeating tasks
* Constant database queries
* Blocking the main thread
* Creating excessive objects during every block break

The 9x9 brush must only check at most the required area.

Use efficient collections and caching.

---

# 32. WORLD / LOCATION SAFETY

The plugin must safely handle:

* Different worlds
* Chunk boundaries
* Unloaded chunks
* Players leaving during operations
* Server shutdown
* Invalid locations

Never crash the server because a crop location is invalid.

---

# 33. EVENT HANDLING

Use correct Paper/Bukkit events for Paper 1.20.1.

Carefully handle:

* BlockBreakEvent
* PlayerInteractEvent
* PlayerJoinEvent
* PlayerQuitEvent
* PlayerInteractEntityEvent where needed
* InventoryClickEvent
* PluginDisableEvent

Do not cancel unrelated events.

Make sure event priorities are chosen correctly.

---

# 34. NORMAL MINECRAFT BEHAVIOR

Do not break normal Minecraft gameplay outside the GenCash system.

Normal:

* Blocks
* Farming
* Tools
* Drops
* Chests
* Containers

must continue working normally unless they are explicitly part of GenCash.

---

# 35. CODE STRUCTURE

Use separate classes, for example:

```text
GenCashPlugin
EconomyManager
VplnManager
GroszeManager
CropManager
BrushManager
HaySeedManager
RegenerationManager
PlayerDataManager
DatabaseManager
StatisticsManager
GuiManager
MessageManager
ConfigManager
```

Create command classes separately.

Do not put the entire plugin into one Java class.

Use clean interfaces where appropriate.

---

# 36. ERROR HANDLING

Every important operation must have proper error handling.

The plugin must never crash because:

* A player does not exist.
* A config value is invalid.
* A database operation fails.
* A chunk is unavailable.
* A command has invalid arguments.
* A player disconnects.
* A location is invalid.

Log useful errors to console without spamming the console.

---

# 37. CONFIG VALIDATION

On startup:

* Validate crop configuration.
* Validate VPLN rewards.
* Validate VPLN chances.
* Validate brush sizes.
* Validate messages.
* Validate database settings.

If something is invalid:

* Print a clear error.
* Use a safe fallback where possible.
* Do not crash the server unnecessarily.

---

# 38. README

Create a complete README containing:

* Installation
* Requirements
* Commands
* Permissions
* Configuration
* How Grosze work
* How VPLN works
* How Brushes work
* How `/siano` works
* How to configure crop rewards
* How to configure VPLN chances
* How to compile with Maven

---

# 39. FINAL BUILD CHECK

Before giving me the final answer, mentally perform a complete project compilation check.

Verify:

* Every import exists.
* Every class exists.
* Every referenced method exists.
* Every command exists.
* Every permission exists.
* Every configuration key exists.
* Every dependency exists in Maven.
* `plugin.yml` is valid.
* Package names match.
* Main class matches `plugin.yml`.
* Java version is 21.
* Paper API version matches 1.20.1.
* No newer-only API is used.
* No missing constructors.
* No missing getters/setters.
* No impossible Bukkit API calls.
* No pseudocode.
* No TODO placeholders.
* No unfinished methods.

The result must be a **complete Maven project**, not fragments.

If you discover a possible bug while generating the code, fix it before presenting the final result.

The final plugin should compile with:

```text
mvn clean package
```

and produce a usable `.jar` file for **Paper 1.20.1**.

DO NOT simplify the requested systems.

DO NOT remove features.

DO NOT replace the systems with placeholders.

DO NOT say that something is "left for later".

Provide the complete implementation.
Kodari AI
KodariAug 28 at 10:26 am 2

Created the complete GenCash Maven project for Paper 1.20.1 / Java 21.

Included:

  • Separate persistent Grosze and VPLN economies using SQLite

  • Configurable crops, rewards, maturity, and regeneration

  • Exact 1x1–9x9 brush system with PDC identification

  • Special Hay Seed system with persistent PDC identification

  • Instant Hay crop regeneration and duplicate-reward protection

  • VPLN weighted rewards with BigDecimal precision

  • Player statistics and cached rankings

  • /gencash, /grosze, /vpln, /brush, and /siano commands

  • Permissions and tab completion

  • GUI with balances, statistics, brush information, and rankings

  • Configurable messages, titles, sounds, materials, lore, and rewards

  • SQLite persistence on join, quit, periodic save, and shutdown

  • README with installation and configuration instructions

Build with:

Shell
mvn clean package

The resulting plugin is:

Plain Text
target/GenCash.jar
Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
21 1,177
src/main/java/pl/gencash/GenCashPlugin.java
package pl.gencash;

import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
import pl.gencash.command.BrushCommand;
import pl.gencash.command.GenCashCommand;
import pl.gencash.command.GroszeCommand;
import pl.gencash.command.SianoCommand;
import pl.gencash.command.VplnCommand;
import pl.gencash.data.DatabaseManager;
import pl.gencash.data.PlayerDataManager;
import pl.gencash.game.BrushManager;
import pl.gencash.game.CropManager;
import pl.gencash.game.HaySeedManager;
import pl.gencash.economy.VplnManager;
import pl.gencash.gui.GenCashGui;
import pl.gencash.listener.GameListener;

public final class GenCashPlugin extends JavaPlugin {
    private DatabaseManager database;
    private PlayerDataManager playerData;
    private VplnManager vpln;
    private BrushManager brushes;
    private HaySeedManager haySeeds;
    private CropManager crops;
    private GenCashGui gui;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        try {
            database = new DatabaseManager(this);
            database.open();
        } catch (Exception exception) {
            getLogger().severe("Nie można uruchomić SQLite: " + exception.getMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        playerData = new PlayerDataManager(this, database);
        vpln = new VplnManager(this, playerData);
        brushes = new BrushManager(this);
        haySeeds = new HaySeedManager(this, database);
        crops = new CropManager(this, playerData, vpln, brushes, haySeeds);
        gui = new GenCashGui(this, playerData, brushes);

        Bukkit.getPluginManager().registerEvents(new GameListener(this, playerData, crops, haySeeds, gui), this);
        registerCommands();
        playerData.refreshTopCaches();
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            playerData.saveAll();
            playerData.refreshTopCaches();
        }, 6000L, 6000L);
    }

    private void registerCommands() {
        register("gencash", new GenCashCommand(this, gui));
        register("grosze", new GroszeCommand(this, playerData));
        register("vpln", new VplnCommand(this, playerData));
        register("brush", new BrushCommand(this, brushes));
        register("siano", new SianoCommand(this, haySeeds, crops));
    }

    private void register(String name, org.bukkit.command.CommandExecutor executor) {
        PluginCommand command = getCommand(name);
        if (command != null) {
            command.setExecutor(executor);
            if (executor instanceof org.bukkit.command.TabCompleter completer) {
                command.setTabCompleter(completer);
            }
        }
    }

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

    public DatabaseManager getDatabase() { return database; }
    public PlayerDataManager getPlayerData() { return playerData; }
    public VplnManager getVpln() { return vpln; }
    public BrushManager getBrushes() { return brushes; }
    public HaySeedManager getHaySeeds() { return haySeeds; }
    public CropManager getCrops() { return crops; }
}