realprinario-ctrl

And permissions for each (Beside default) Like for ex: leafhoppers.seeothers (Look / Upgrade others Hoppers) leafhoppers.protected (Not touchable by any1 besides the owner) ect

📎 1 file 16,279 chars
📄
pasted-code-1789247133618.txt
txt 996 lines
▶
# Leaf Hoppers — Advanced Upgradeable Hoppers Plugin

Create a **production-ready Minecraft Paper plugin** named **Leaf Hoppers**.

The plugin should provide its own custom, optimized hopper system rather than relying on vanilla hopper mechanics. The goal is to make hoppers highly configurable, upgradeable, efficient, and suitable for large-scale servers with **minimal to zero unnecessary lag**.

## Core Requirements

**Plugin Name:** Leaf Hoppers
**Prefix:** `&8[&aLeaf Hoppers&8]`

Target modern Paper/Minecraft servers and design the plugin with performance as a major priority.

The plugin must have:

* Custom Leaf Hoppers
* Upgradeable hopper system
* Multiple hopper types
* Upgrade GUI
* Hopper storage
* Chest linking
* Item filters
* Custom transfer system
* Dupe protection
* Full configuration
* Configurable limits
* Optimized item movement
* Reload support where safe
* Clean messages
* Permission system
* Persistent data that survives restarts

---

# 1. Custom Hopper System

Do NOT simply expose vanilla hopper functionality.

Leaf Hoppers should have its own hopper implementation.

Each Leaf Hopper should store its own:

* Hopper type
* Level
* Upgrade levels
* Owner
* Unique ID
* Transfer settings
* Filter settings
* Linked containers
* Statistics
* Custom data

Use persistent data such as `PersistentDataContainer` or an appropriate database/storage system.

Every hopper must have a unique identifier to help prevent duplication and corruption.

---

# 2. Hopper Types

Create multiple configurable hopper types.

Example default types:

### Basic Hopper

* Cheap starter hopper
* Normal transfer speed
* Small suction radius
* Small transfer amount

### Advanced Hopper

* Faster transfers
* Larger suction radius
* Larger transfer amount

### Elite Hopper

* Very fast
* Large suction radius
* Large transfer amount
* Advanced filtering

### Ultimate Hopper

* Extremely fast
* Very large suction radius
* Large transfer amount
* Advanced automation

### Collector Hopper

Designed primarily for collecting dropped items.

### Seller Hopper

Automatically sells collected items using the server economy.

### Smelter Hopper

Can automatically route items into configured furnaces/smelters.

### Void Hopper

Can automatically delete configured items.

All hopper types must be configurable.

Admins should be able to create additional hopper types through configuration rather than requiring code changes.

---

# 3. Upgrade System

Create a simple and extremely easy-to-use upgrade GUI.

The player should be able to right-click their hopper to open its management GUI.

Example:

```text
╔══════════════════════════════════════╗
║          LEAF HOPPER                 ║
║                                      ║
║  Level: 12                            ║
║                                      ║
║  🟢 Suction Radius      Level 8       ║
║  🟢 Transfer Amount     Level 10      ║
║  🟢 Transfer Speed      Level 12      ║
║  🟢 Storage              Level 5       ║
║  🟢 Chest Linking       Level 6       ║
║  🟢 Filters              Level 4       ║
║                                      ║
║       [ Upgrade All ]                 ║
║       [ Statistics ]                  ║
║       [ Settings ]                    ║
╚══════════════════════════════════════╝
```

Make the GUI clean, intuitive, and customizable.

Do not make upgrading tedious.

---

# 4. Upgrades

Include at minimum:

## Suction Radius

Controls how far the hopper searches for dropped items.

Example:

```yaml
suction-radius:
  enabled: true
  max-level: 100
  base: 2.0
  per-level: 1.0
```

The server owner must be able to configure this.

---

## Transfer Amount

Controls how many items are transferred per operation.

Example:

```yaml
transfer-amount:
  enabled: true
  max-level: 100
  base: 1
  per-level: 1
```

Allow values above vanilla hopper limits.

---

## Transfer Speed

Controls how frequently the hopper performs transfers.

Example:

```yaml
transfer-speed:
  enabled: true
  max-level: 100
  base-delay: 20
  minimum-delay: 1
  reduction-per-level: 1
```

Use an optimized scheduler rather than creating an independent repeating task for every hopper.

---

## Storage

Allow hoppers to have configurable internal storage.

Example:

```yaml
storage:
  enabled: true
  base-slots: 5
  slots-per-level: 1
  max-level: 100
```

---

## Chest Linking

Allow players to link a hopper directly to a container.

Possible containers:

* Chests
* Double chests
* Barrels
* Shulker boxes
* Furnaces
* Blast furnaces
* Smokers
* Configurable container types

The hopper should be able to remember its linked destination.

---

## Filters

Create an advanced filter system.

Players should be able to configure:

* Whitelisted items
* Blacklisted items
* Exact item types
* Item names
* Custom model data
* Enchantments
* Materials
* Optional NBT/PDC rules

Example:

```text
FILTERS

[ + Add Item ]

Mode:
[ WHITELIST ]

Items:
Diamond
Emerald
Gold Ingot
Iron Ingot

[ SAVE ]
[ CLEAR ]
```

---

# 5. Additional Upgrades

Add useful upgrades beyond the requested ones.

Include:

### Pickup Upgrade

Improves how efficiently dropped items are detected.

### Capacity Upgrade

Increases internal hopper storage.

### Multi-Output Upgrade

Allows one hopper to distribute items between multiple destinations.

### Smart Routing

Allows different items to be sent to different containers.

### Overflow Protection

Prevents items from being lost when the destination is full.

### Priority Upgrade

Allows destinations to have configurable priorities.

### Auto-Sell Upgrade

Optional economy integration.

### Auto-Smelt Upgrade

Optional furnace/smelting functionality.

### Compression Upgrade

Optional item compression.

### Experience Upgrade

Optional XP collection.

### Filter Slots

Increase the number of configurable filter rules.

Every upgrade must be independently configurable.

---

# 6. Performance / Optimization

Performance is one of the MOST IMPORTANT requirements.

The plugin must be designed specifically for servers with potentially thousands of hoppers.

Do NOT:

* Create one Bukkit repeating task per hopper
* Constantly scan chunks unnecessarily
* Constantly scan huge areas
* Perform unnecessary synchronous operations
* Repeatedly load/save hopper data from disk
* Spam events
* Create excessive ItemStack clones
* Run expensive database queries on the main thread

Instead use:

* Centralized hopper processing
* Batched processing
* Tick-based scheduling
* Chunk-aware processing
* Cached hopper data
* Dirty-data saving
* Efficient collections
* Nearby-item indexing/caching where appropriate
* Configurable processing intervals
* Automatic throttling
* Processing budgets per tick

Example:

```yaml
performance:
  max-hoppers-per-tick: 500
  max-items-per-tick: 1000
  processing-interval: 1
  chunk-processing-limit: 100
  async-data-saving: true
```

The plugin should gracefully handle large numbers of hoppers.

---

# 7. Smart Hopper Processing

Do not process every hopper every tick if it does not need processing.

A hopper should become "active" when:

* It has items
* It has nearby items to collect
* Its transfer cooldown expires
* Its destination becomes available
* Its configuration changes

Inactive hoppers should require minimal processing.

Use an efficient active-hopper queue.

---

# 8. Dupe Protection

Implement strong duplication protection.

Protect against:

* Hopper cloning
* Item duplication
* Shift-click exploits
* Double-click exploits
* Inventory desync
* Hopper/chest race conditions
* Rapid pickup/drop exploits
* Chunk unload duplication
* Server restart duplication
* Hopper break/place duplication
* Container linking exploits
* ItemStack mutation exploits

Every hopper should have a unique ID.

Validate hopper ownership and data whenever necessary.

Never duplicate items when moving stacks.

Use safe inventory transaction logic.

---

# 9. Hopper Breaking

When a player breaks a Leaf Hopper:

* Verify ownership/permissions
* Save all hopper contents
* Drop the hopper item
* Preserve upgrades
* Preserve filters
* Preserve linked containers where appropriate
* Remove the hopper from the active system
* Clean up cached data

Do not allow hopper data to be duplicated by breaking/replacing rapidly.

---

# 10. Hopper Placement

When placing a Leaf Hopper:

* Generate a unique hopper ID
* Load the correct hopper type
* Load default upgrades
* Register it with the central hopper manager
* Save its location
* Apply its custom appearance/data

Prevent invalid or corrupted hopper items from creating invalid hopper objects.

---

# 11. GUI

Create a polished inventory GUI.

Include:

* Hopper information
* Current level
* Upgrade buttons
* Upgrade prices
* Current stats
* Next-level stats
* Filter menu
* Linking menu
* Settings
* Statistics
* Confirm/cancel buttons where necessary

Use configurable GUI layouts.

Example:

```yaml
gui:
  title: "&8Leaf Hopper"
  size: 54

  filler:
    material: BLACK_STAINED_GLASS_PANE

  upgrades:
    suction:
      slot: 20
      material: HOPPER

    transfer-amount:
      slot: 21
      material: CHEST

    transfer-speed:
      slot: 22
      material: CLOCK
```

Everything should be configurable.

---

# 12. Upgrade Costs

Support configurable upgrade pricing.

Allow:

* Fixed costs
* Exponential costs
* Multipliers
* Different prices per hopper type
* Different prices per level

Example:

```yaml
upgrade-costs:
  suction-radius:
    type: exponential
    base: 1000
    multiplier: 1.25

  transfer-speed:
    type: exponential
    base: 2500
    multiplier: 1.30
```

Integrate with Vault-compatible economies.

If Vault is unavailable, provide a configurable fallback or disable economy-based upgrades.

---

# 13. Permissions

Create permissions such as:

```text
leafhoppers.use
leafhoppers.place
leafhoppers.break
leafhoppers.upgrade
leafhoppers.admin
leafhoppers.give
leafhoppers.reload
leafhoppers.bypass
leafhoppers.link
leafhoppers.filter
```

Make permission nodes configurable where practical.

---

# 14. Commands

Create:

```text
/leafhopper
/lh
```

Subcommands:

```text
/lh give   [amount]
/lh giveall  [amount]
/lh types
/lh info
/lh reload
/lh stats
/lh admin
```

Add tab completion.

Add configurable aliases.

---

# 15. Messages

Prefix:

```text
&8[&aLeaf Hoppers&8]
```

Every message must be configurable.

Example:

```yaml
messages:

  prefix: "&8[&aLeaf Hoppers&8]"

  no-permission: "%prefix% &cYou don't have permission."
  hopper-given: "%prefix% &aYou received a %type% hopper."
  hopper-upgraded: "%prefix% &aHopper upgraded successfully!"
  not-enough-money: "%prefix% &cYou don't have enough money."
  max-level: "%prefix% &eThis upgrade is already maxed."
  invalid-hopper: "%prefix% &cInvalid hopper type."
  hopper-linked: "%prefix% &aHopper linked successfully."
  hopper-unlinked: "%prefix% &eHopper unlinked."
  reload: "%prefix% &aConfiguration reloaded."
```

Support:

* `&` colors
* Hex colors if supported
* PlaceholderAPI placeholders
* `%prefix%`
* `%player%`
* `%hopper%`
* `%level%`
* `%cost%`
* `%next_level%`

---

# 16. Full Configuration

Almost NOTHING should be hardcoded.

Put configurable values in:

```text
config.yml
messages.yml
gui.yml
hoppers.yml
```

If possible, allow the server owner to configure:

* Hopper types
* Upgrade limits
* Upgrade prices
* Transfer speeds
* Transfer amounts
* Suction radius
* Storage
* Filters
* GUI
* Messages
* Permissions
* Sounds
* Particles
* Effects
* Performance limits
* Database/storage
* Auto-save interval
* Debug mode
* Economy settings

Do not impose arbitrary hard limits in Java.

For example, do not hardcode:

```java
if (level > 100) ...
```

Instead read the limit from configuration.

Allow:

```yaml
max-level: -1
```

to mean unlimited where appropriate.

---

# 17. Data Storage

Support reliable persistent storage.

Prefer a system such as:

```text
SQLite
```

for larger servers.

Allow configuration for:

```yaml
storage:
  type: sqlite
```

Potential options:

```text
yaml
sqlite
```

Do not save every hopper to disk every tick.

Use asynchronous saving where safe.

Flush important data on:

* Hopper break
* Hopper upgrade
* Hopper configuration change
* Server shutdown
* Configured autosave interval

---

# 18. Reload Safety

Implement:

```text
/lh reload
```

Reload configuration without corrupting active hoppers.

Do not unnecessarily recreate all hopper objects.

Safely update:

* Messages
* GUI settings
* Hopper type configuration
* Upgrade configuration
* Performance settings

Document which settings require a restart.

---

# 19. Statistics

Add hopper statistics.

Track things such as:

```text
Items Collected
Items Transferred
Items Sold
Items Voided
Total Transfers
Time Active
```

Show them in a GUI.

Example:

```text
HOPPER STATISTICS

Items Collected: 1,284,921
Items Transferred: 1,203,114
Items Sold: 82,921
Transfers: 348,291
```

Make statistics configurable.

---

# 20. Sounds & Effects

Add optional sounds when:

* Upgrading
* Linking
* Unlinking
* Opening GUI
* Purchasing
* Breaking
* Placing

Allow sounds and particles to be disabled.

Do not create unnecessary particles that can hurt performance.

---

# 21. Compatibility

Design the plugin to work cleanly with common server plugins.

Potential integrations:

* Vault
* PlaceholderAPI
* LuckPerms
* WorldGuard
* Essentials
* Economy plugins

Integrations should be optional.

The plugin must still work if those plugins are not installed.

---

# 22. Anti-Lag Features

Add configurable global limits:

```yaml
limits:
  enabled: true
  max-hoppers-per-chunk: -1
  max-active-hoppers-per-tick: 500
  max-item-checks-per-tick: 1000
```

`-1` means unlimited.

Add automatic load balancing:

```yaml
performance:
  adaptive-processing: true
  dynamically-reduce-workload: true
```

If server TPS drops, the plugin should reduce its workload instead of making the problem worse.

---

# 23. Debugging

Add:

```text
/lh debug
```

Show:

```text
Leaf Hoppers Debug

Loaded Hoppers: 4,281
Active Hoppers: 932
Processing: 487/tick
Item Checks: 812/tick
TPS: 19.98
Average Processing Time: 0.14ms
```

Make debug logging disabled by default.

---

# 24. Code Quality

Write clean, maintainable Java.

Use a modular architecture such as:

```text
LeafHoppers
├── commands
├── config
├── hopper
│   ├── HopperManager
│   ├── HopperData
│   ├── HopperType
│   └── HopperProcessor
├── upgrades
├── gui
├── filters
├── storage
├── economy
├── listeners
├── protection
├── hooks
└── utilities
```

Avoid giant classes.

Use interfaces where appropriate.

Avoid memory leaks.

Clean up all cached data when chunks unload or hoppers are removed.

---

# 25. Important Performance Rule

The plugin must be capable of handling **thousands of Leaf Hoppers** without creating thousands of Bukkit tasks.

Use centralized processing.

Bad:

```text
Hopper 1 → task
Hopper 2 → task
Hopper 3 → task
...
Hopper 5000 → task
```

Good:

```text
Central Hopper Processor
        ↓
Active Hopper Queue
        ↓
Batch Processing
        ↓
Transfer / Pickup
```

---

# 26. Deliverables

Provide the complete plugin source code.

Include:

```text
plugin.yml
config.yml
messages.yml
gui.yml
hoppers.yml
README.md
```

Provide complete Java source code for every class.

Do NOT provide pseudo-code.

Do NOT leave:

```text
TODO
IMPLEMENT THIS
...
```

or placeholder methods.

Everything should compile.

Include the required Maven or Gradle build configuration.

Specify the exact Minecraft/Paper API version being targeted.

---

# 27. Final Quality Requirement

Leaf Hoppers should feel like a **professional premium Minecraft plugin**, not a basic Skript-style hopper replacement.

Prioritize:

1. Performance
2. Dupe protection
3. Reliability
4. Easy GUI
5. Configuration
6. Scalability
7. Clean code
8. Compatibility
9. User experience

The plugin should be designed for a server that may have **thousands of hoppers operating simultaneously**.

Make the system highly configurable so server owners can create completely different hopper economies without modifying the Java source code.

**Plugin name:** Leaf Hoppers

**Prefix:** `&8[&aLeaf Hoppers&8]`

Build the entire plugin from this specification.
Kodari AI
KodariSep 12 at 9:11 pm 4
LeafHoppers
Leaf Hoppers is a high-performance, configurable hopper plugin for Paper servers. It introduces custom upgradeable hoppers with types like Basic, Advanced, Elite, Ultimate, Collector, Seller, Smelter, and Void. Features include a centralized active-hopper queue for optimized processing, upgradeable suction radius, transfer amount/speed, storage, chest linking, advanced filters, and dupe protection. Players manage hoppers via an intuitive inventory GUI. Includes full YAML configuration, SQLite storage, Vault economy integration, permissions, commands, statistics, and anti-lag adaptive processing designed to handle thousands of hoppers efficiently.
  1. Create the Gradle project, plugin metadata, and fully configurable YAML resources.

  2. Implement persistent hopper data, type/upgrade configuration, item serialization, and safe lifecycle handling.

  3. Add centralized budgeted processing for pickup, storage, linked-container transfer, filters, seller/void behavior, and statistics.

  4. Add GUI, commands/tab completion, permissions, linking/filter interactions, reload support, and optional Vault economy integration.

  1. Created the complete Leaf Hoppers Gradle project targeting Paper 1.21.4 with Java 21.

  2. Added configurable resources: config.yml, messages.yml, gui.yml, hoppers.yml, plugin.yml, and README.md.

  3. Implemented persistent hopper data, unique IDs, ownership, upgrades, filters, linked containers, internal storage, statistics, item serialization, and autosaving.

  4. Added centralized budgeted processing with configurable hopper/item-per-tick limits instead of one task per hopper.

  5. Added hopper types including Basic, Advanced, Elite, Ultimate, Collector, Seller, Smelter, and Void.

  6. Added management and storage GUIs with upgrade, filter, linking, and statistics controls.

  7. Added /lh commands: give, giveall, types, info, reload, stats, and debug, plus tab completion.

  8. Added configurable permissions including ownership protection, bypass, leafhoppers.seeothers, upgrade, linking, filtering, admin, reload, and give permissions.

  9. Added optional Vault economy integration for upgrades and seller hoppers.

  10. Added safe hopper placement, breaking, ownership validation, persistent storage, and stored-item drops.

realprinario-ctrl

Make the GUI better, Sneak Break breaks the Hopper.

Kodari AI
KodariSep 12 at 9:51 pm 2
  1. Improve the existing GUI without changing its intended workflow.

  2. Fix the sneak-break behavior so breaking a hopper while sneaking works correctly.

  1. GUI: the management info item now respects the configured management.info-slot instead of always using slot 4.

  2. Sneak-break: left-click interactions no longer intercept registered hoppers, allowing BlockBreakEvent to run normally and drop/remove the hopper correctly.

realprinario-ctrl

Make sure each hopper has its own GUI and lore. Simple GUI With good text. Easy to read.

Kodari AI
KodariSep 12 at 9:51 pm 1
  1. Make each hopper GUI instance-specific, with clear hopper identity and readable lore.

  2. Preserve the existing controls and ensure the GUI opens with the clicked hopper’s data.

  • Give the management screen a clear identity for the specific hopper being opened.

  • Replace terse lore with readable labels, status details, and actionable instructions.

  • Keep the existing slots and click behavior unchanged so upgrades, storage, filters, linking, and stats continue to work.

  1. Updated the hopper management GUI with clearer, easier-to-read lore:

    • Hopper type, level, owner, and location

    • Upgrade levels, costs, max-level status, and click instructions

    • Storage usage

    • Filter mode and item count

    • Link status

    • Statistics with formatted values

  2. Each opened hopper keeps its own HopperHolder and HopperData, so the GUI displays information for the specific hopper being used.

  3. Updated the GUI title to show the hopper’s display name instead of only its internal type ID.

realprinario-ctrl

Make each hopper have its own inventory for its own use.

Make the Hopper item have lore on what it does, you can left click with the Hopper for ALL of its info

Kodari AI
KodariSep 12 at 10:06 pm 2
  1. Per-hopper inventory: ensure every placed hopper opens its own inventory instance and never shares GUI state.

  2. Informative hopper item: add readable lore and make left-clicking the held hopper show its full functionality and status.

  1. Per-hopper GUI instances

    • Every opened hopper creates its own HopperHolder and inventory.

    • The GUI displays that hopper’s type, owner, location, upgrades, storage, filters, links, and statistics.

    • Storage remains tied to the specific hopper’s HopperData.

  2. Hopper item lore

    • Added readable lore showing:

      • Hopper function

      • Pickup radius

      • Transfer amount

      • Transfer delay

      • Storage capacity

      • Filter mode

      • Usage instructions

  3. Left-click information

    • Left-clicking while holding a Leaf Hopper displays all of its information in chat.

    • Sneak-left-click remains available for breaking blocks and does not trigger the information message.

realprinario-ctrl

Make EACH hopper HAVE ITS OWN GUI. EX: THE SMELTER HOPPER HAS ITS OWN GUI WITH ITS OWN AUTO SMELT UPGRADE.

Kodari AI
KodariSep 12 at 10:12 pm 2
  1. Identify how hopper types, GUI creation, upgrades, and inventory state currently flow.

  2. Separate GUI content and available upgrades by hopper type, starting with the smelter’s auto-smelt upgrade.

  3. Update the item/GUI behavior so every hopper opens its own type-specific interface without shared state.

  • Added type-specific upgrade lists to every hopper in hoppers.yml.

  • Each hopper now opens a separate GUI containing only its own upgrades.

  • Smelter Hoppers now have their own menu with an Auto-Smelt upgrade.

  • Seller Hoppers show Auto-Sell instead.

  • Collector, Void, Basic, Advanced, Elite, and Ultimate Hoppers each have their own appropriate upgrade selection.

  • Hopper item lore now lists the upgrades available for that specific hopper type.

  • Upgrade purchases are restricted so a hopper cannot buy upgrades that do not belong to its GUI.

realprinario-ctrl

Sneak click in one of the GUI slots to upgrade it to Level 10 "Price: <amount>" --> "&7Price: &a$<amount>" Like that and make all of them like that so it looks cleaner

Kodari AI
KodariSep 12 at 10:14 pm 1
  1. Make sneak-clicking an upgrade slot purchase/apply that upgrade through level 10.

  2. Standardize upgrade lore prices as &7Price: &a$<amount> and clean up the related GUI text.

  • Sneak-clicking an upgrade slot now upgrades that upgrade repeatedly up to Level 10.

  • Upgrades stop at the configured maximum level or when the player cannot afford the next level.

  • Regular clicks still upgrade by one level.

  • Upgrade prices now display cleanly as: &7Price: &a$<amount>

realprinario-ctrl

Polish & Fix bugs (Add on to the plugin folder so it is more free to mess with)

Kodari AI
KodariSep 12 at 10:21 pm 4
  1. Audit the current plugin for concrete bugs and fragile behavior.

  2. Polish the player-facing hopper GUIs, lore, and messages without changing the core workflow.

  3. Move hardcoded behavior into plugin configuration where practical so the plugin is easier to customize.

  • Fixed sneak-upgrades so they honor the configured maximum instead of stopping at level 10.

  • Added per-hopper storage viewer protection to prevent two players overwriting each other’s inventory.

  • Fixed storage capacity initialization and prevented extra empty slots from being saved.

  • Added hopper block validation using persistent data, so replaced blocks are no longer treated as hoppers.

  • Closed active storage GUIs when a hopper is broken, preventing stale-item duplication.

  • Added configurable filter limits and clear feedback when the filter capacity is full.

  • Made smelter recipes configurable in hoppers.yml.

  • Added functional smelter behavior for the configurable recipes.

  • Seller hoppers now require the auto-sell upgrade before paying out.

  • Seller payouts now use configured per-item prices instead of paying a flat amount.

  • Removed unsupported upgrades from the default hopper GUI lists so players are not charged for upgrades that do nothing.

  • Added configurable GUI upgrade descriptions.

  • Changed autosaves to use cloned snapshots, and shutdown saving now completes synchronously.

  • Added gui.yml and hoppers.yml options for easier customization.

realprinario-ctrl

They all have the same menu what? Also there's NO buttons anymore fix this. Make sure they all have seperate upgrades please and less hopper types if it is to much for you to handle.

Kodari AI
KodariSep 12 at 10:27 pm 1
  1. Fix the GUI so each hopper type renders visible, clickable buttons again.

  2. Give each supported hopper type its own upgrade list and behavior, removing excess types only if they cannot be supported cleanly.

  3. Keep the menus configurable in hoppers.yml/gui.yml so future changes are easy.

  • Fixed the missing upgrade buttons: every supported upgrade now gets a visible button, with a fallback slot if its config slot is invalid.

  • Fixed click detection so the listener uses the exact same per-hopper-type slot layout that the GUI renders.

  • Added separate GUI titles and upgrade layouts for:

    • Basic

    • Advanced

    • Elite

    • Ultimate

    • Collector

    • Seller

    • Smelter

    • Void

  • Smelter now has its own menu with Auto-Smelt.

  • Seller now has its own menu with Auto-Sell.

  • Reduced the upgrade lists so each hopper has a focused set of upgrades instead of every hopper using the same menu.

  • Upgrade buttons remain configurable in gui.yml, including each hopper type’s slots and materials.

  • Existing normal-click and sneak/shift-click upgrade behavior is preserved.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
21 1,642
src/main/java/com/leafhoppers/LeafHoppersPlugin.java
package com.leafhoppers;

import com.leafhoppers.command.LeafHopperCommand;
import com.leafhoppers.config.ConfigManager;
import com.leafhoppers.economy.EconomyHook;
import com.leafhoppers.hopper.HopperManager;
import com.leafhoppers.hopper.HopperStorage;
import com.leafhoppers.hopper.HopperTypeRegistry;
import com.leafhoppers.listener.HopperListener;
import com.leafhoppers.message.MessageService;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class LeafHoppersPlugin extends JavaPlugin {
    private ConfigManager configManager;
    private MessageService messages;
    private HopperTypeRegistry typeRegistry;
    private HopperStorage storage;
    private EconomyHook economy;
    private HopperManager hopperManager;

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.configManager.load();
        this.messages = new MessageService(this);
        this.messages.load();
        this.typeRegistry = new HopperTypeRegistry(this);
        this.typeRegistry.load();
        this.economy = new EconomyHook(this);
        this.storage = new HopperStorage(this);
        this.hopperManager = new HopperManager(this, storage, typeRegistry, messages, economy);
        storage.load(hopperManager);
        hopperManager.start();
        Bukkit.getPluginManager().registerEvents(new HopperListener(this, hopperManager, typeRegistry, messages), this);
        LeafHopperCommand command = new LeafHopperCommand(this, hopperManager, typeRegistry, messages);
        getCommand("leafhopper").setExecutor(command);
        getCommand("leafhopper").setTabCompleter(command);
    }

    @Override
    public void onDisable() {
        if (hopperManager != null) {
            hopperManager.stop();
        }
        if (storage != null && hopperManager != null) {
            storage.saveAndWait(hopperManager.all());
        }
    }

    public void reloadPlugin() {
        configManager.load();
        messages.load();
        typeRegistry.load();
        hopperManager.reloadSettings();
    }

    public ConfigManager config() { return configManager; }
    public MessageService messages() { return messages; }
    public HopperTypeRegistry types() { return typeRegistry; }
    public HopperManager hoppers() { return hopperManager; }
    public EconomyHook economy() { return economy; }
}