Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SmorkiAutoPickup

Enterprise-grade, ultra-performance economy and utility mechanics plugin engineered specifically for Folia's regionized multi-threading architecture.

Version Platform Java License


What it does

Redstone lag machines are one of the most effective ways to degrade server performance. On traditional servers a single limiter can guard the whole world, but Folia runs each region on its own thread — a naive global lock would introduce cross-region contention and defeat the entire point of Folia.

SmorkiAutoPickup solves this correctly:

  • Tracks block break drops per player, per action using lock-free thread structures.
  • When a block is broken, its drops are calculated completely asynchronously — zero impact on other regions.
  • Inventory insertions are executed by player.getScheduler().run(), which runs on the same thread that owns the mining player.
  • Configuration reloads happen on AsyncScheduler — disk I/O never touches a region thread.

Performance architecture

Why Folia's RegionScheduler changes everything

Vanilla Paper (and most Paper forks) use a single-threaded tick loop. Every plugin task, event handler, and scheduler callback runs on that one thread. Under load, a spike in one chunk stalls the entire server.

Folia replaces this with a regionized model: World

├── Region A (chunks 0–31, 0–31) → Thread A ├── Region B (chunks 32–63, 0–31) → Thread B └── Region C (chunks 0–31, 32–63) → Thread C Each region ticks independently. A lag spike or heavy mining operation in Region A does not slow the tick rate of Region B or C.

SmorkiAutoPickup is designed around this model:

Operation Scheduler used Why
Block break drop cancellation Region thread (event callback) Events already fire on the owning region thread — no dispatch needed
Fortune & Smelt processing Asynchronous Multi-threading Mathematical matrix calculations happen outside the hot game loop
Inventory insertion task player.getScheduler().run() Ingestion runs on the same region thread that currently owns the player
Config reload AsyncScheduler.runNow File I/O must never block a region or game thread

Lock-free data structures

Structure Usage Why not synchronized?
ConcurrentHashMap Player preference cache (Toggles) Lock-striped; reads never block writers
Folia Entity Scheduler Secure inventory modification Dispatches inventory additions to the specific region thread owning the player
Adventure API (MiniMessage) Advanced Text Component parsing Immutable component tree processing prevents legacy string compilation delays

Event listener design

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) { … }

LOWEST prioritythe event is processed and natural drops are wiped before any other plugin handles it, avoiding wasted downstream drop processing.

ignoreCancelled = truealready-cancelled events (from protection plugins like WorldGuard) are skipped entirely.

No synchronization inside the handlerall shared state is either thread-local to the region or backed by lock-free structures.

Installation
Make sure you are running Folia or Paper (Minecraft 1.21.11) (not Spigot).

Download SmorkiAutoPickup-1.0.0.jar from Releases.

Place it in your server's plugins/ folder.

Restart the server (not /reloadFolia discourages hot-reload).

Configuration (config.yml)
YAML
settings:
  async-processing: true
  give-xp: true
  filter-offline-cache: true

# ============================================================
#  SmorkiAutoPickupconfig.yml
#  Theme: Matte Purple (#8E44AD) & Cyan (#00FFFF)
#  MiniMessage syntax is used for ALL message strings.
# ============================================================

# ── General ─────────────────────────────────────────────────
# Whether auto-pickup is enabled by default for new players
# (players who have never run /autopickup toggle).
default-enabled: true

# ── Auto-Smelt ──────────────────────────────────────────────
auto-smelt:
  # Master switchset to false to disable smelting entirely
  # while keeping auto-pickup active.
  enabled: true

  # Map of raw oresmelted result.
  # You may add any material pair recognised by the Bukkit API.
  recipes:
    IRON_ORE: IRON_INGOT
    DEEPSLATE_IRON_ORE: IRON_INGOT
    GOLD_ORE: GOLD_INGOT
    DEEPSLATE_GOLD_ORE: GOLD_INGOT
    COPPER_ORE: COPPER_INGOT
    DEEPSLATE_COPPER_ORE: COPPER_INGOT
    NETHER_GOLD_ORE: GOLD_NUGGET
    ANCIENT_DEBRIS: NETHERITE_SCRAP

# ── Auto-Pickup (all blocks) ─────────────────────────────────
auto-pickup:
  # Master switchset to false to disable pickup entirely.
  enabled: true

  # If true, items are also picked up when the player is in
  # Creative mode (useful for creative-survival hybrid servers).
  include-creative: false

  # Blocks listed here are NEVER auto-picked up (exact Material names).
  # Useful to exclude things like bedrock, barriers, etc.
  blacklist:
    - BEDROCK
    - BARRIER
    - COMMAND_BLOCK
    - CHAIN_COMMAND_BLOCK
    - REPEATING_COMMAND_BLOCK
    - STRUCTURE_BLOCK
    - STRUCTURE_VOID
    - LIGHT

# ── XP Awards ───────────────────────────────────────────────
xp:
  # Grant bonus XP when an ore is auto-smelted.
  enabled: true
  # XP points awarded per smelted ore.
  amount-per-smelt: 1

# ── Messages (MiniMessage format) ───────────────────────────
# Colour palette reference:
#   Matte Purple : <color:#8E44AD>
#   Cyan         : <color:#00FFFF>
#   Red warning  : <red>
messages:
  prefix: "<color:#8E44AD><bold>[SAP]</bold></color> "

  toggle-enabled: >
    <color:#8E44AD><bold>[SAP]</bold></color>
    <color:#00FFFF>Auto-Pickup & Auto-Smelt <bold>ENABLED</bold>.</color>

  toggle-disabled: >
    <color:#8E44AD><bold>[SAP]</bold></color>
    <color:#00FFFF>Auto-Pickup & Auto-Smelt <bold>DISABLED</bold>.</color>

  inventory-full: >
    <red><bold>⚠</bold> Your inventory is full! Items dropped on the ground.</red>

  reload-success: >
    <color:#8E44AD><bold>[SAP]</bold></color>
    <color:#00FFFF>Configuration reloaded successfully.</color>

  reload-no-permission: >
    <color:#8E44AD><bold>[SAP]</bold></color>
    <red>You do not have permission to run this command.</red>

  unknown-command: >
    <color:#8E44AD><bold>[SAP]</bold></color>
    <color:#00FFFF>Usage: <white>/autopickup <toggle|reload></white></color>

Reload without restarting:

/smorkiautopickup reload

git clone [https://github.com/smorki/SmorkiAutoPickup.git](https://github.com/smorki/SmorkiAutoPickup.git)
cd SmorkiAutoPickup
mvn clean package
# Output: target/SmorkiAutoPickup-1.0.0.jar
  

About

High-performance, 100% region-safe Folia & Paper auto-pickup plugin for 1.21.11. Eliminates region lag spikes using async drop calculations and safe entity schedulers. Features beautiful modern Matte Purple & Cyan MiniMessage gradient themes, full Fortune support, and custom configuration options. Engineered by Smorki.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages