Files
Coalgov/CoalGov/README.md
2026-05-04 17:00:18 +00:00

198 lines
7.2 KiB
Markdown

# CoalGov
CoalGov is a server-side Paper/Bukkit plugin for vanilla Minecraft clients. It adds a small coal-backed economy, land classes, claims, mining permits, protected government land, and coal ore mining restrictions.
The ledger uses Coal Cents for sub-coal transactions: `100cc` equals `1 coal`. Commands that accept money still treat plain numbers as coal, so `2.5`, `2.50`, and `250cc` all mean `2 coal 50cc`.
## Build
```bash
./gradlew build
```
The jar is written to `build/libs/CoalGov-*.jar`.
## VPS Install
1. Build with `./gradlew build`.
2. Copy `build/libs/CoalGov-*.jar` to `/path/to/server/plugins/`.
3. Restart the Paper server.
4. Edit `plugins/CoalGov/config.yml`.
5. Run `/coalgov admin reload`.
This is a Paper/Bukkit plugin only. It does not require Forge, Fabric, resource packs, client mods, or custom launchers.
## Commands
- `/coal balance`
- `/coal deposit`
- `/coal withdraw <amount>`; withdrawals must be whole coal because they create coal items
- `/coal pay <player> <amount>`; accepts coal decimals or `cc`
- `/coal fines [list|pay <id|all>]`
- `/market`
- `/claim wand`
- `/claim buy <homestead|industrial> <radius>`
- `/claim buy <homestead|industrial>` after selecting a polygon with `/claim wand`
- `/claim info`
- `/claim list`
- `/claim show <id>`
- `/claim appraise [id]`
- `/claim sell [id]`
- `/claim transfer <id> <player>`
- `/claim abandon <id>`
- `/permit buy mining <regionName>`
- `/permit list`
- `/diviningrod`
- `/land info`
- `/land create <name> <landClass> <radius>`
- `/land delete <name>`
- `/land list`
- `/coalgov admin balance <player>`
- `/coalgov admin grant <player> <amount>`
- `/coalgov admin take <player> <amount>`
- `/coalgov admin reload`
- `/coalgov admin bypass <on|off|status>`
- `/coalgov admin rod`
- `/coalgov admin treasury <balance|grant <player> <amount>>`
- `/coalgov admin tax exempt <player> <on|off|status>`
- `/police fine <player> <amount> <reason>`
- `/cgnpc zone create <name>`
- `/cgnpc create <trader|worker> <name> <zone>`
- `/cgnpc stock <id> <material> <amount>`
- `/cgnpc funds <id> <amount>`
- `/cgnpc haggle <id> <buy|sell> <material> <amount> <offer>`
## Super Furnace
Craft a CoalGov Super Furnace with a furnace in the center and stone in the eight surrounding slots. Placed super furnaces are persisted in SQLite, smelt 5x as fast, and burn fuel 4x faster.
## Permissions
- `coalgov.admin`: admin commands, default `op`. Gameplay bypass is available with `/coalgov admin bypass on`.
- `coalgov.coal`: coal economy commands, default `true`
- `coalgov.claim`: claim commands, default `true`
- `coalgov.permit`: permit commands, default `true`
- `coalgov.land.info`: land info commands, default `true`
- `coalgov.market`: market trading, default `true`
- `coalgov.diviningrod`: divining rod command, default `true`
- `coalgov.police`: police fine commands, default `op`
## Claim Wand
Run `/claim wand` to receive a CoalGov claim wand. Right-click blocks to add polygon points. Once at least three points are selected, `/claim buy homestead` or `/claim buy industrial` buys the polygon instead of a radius claim. Sneak right-click with the wand to clear the current polygon. The plugin shows temporary particles between points and client-side gold marker block previews while selecting, and permanent protected marker blocks are placed at claim vertices after purchase.
## Market
`/market` opens a vanilla inventory menu. Players can sell configured resources to the Ministry or buy from Ministry stock. A normal click buys 1 item, and shift-click buys 64. Prices are dynamic: each material has a base price, but the live price rises when market stock is low and falls when stock is high. Buying and selling use Coal Cents internally, so cheap blocks like cobblestone can transact below 1 coal without forcing bulk purchases. Selling resources increases stock; buying resources decreases stock. Bulk sales are priced against simulated rising stock so one large sale cannot receive the first scarce-stock quote for every item. Coal-equivalent materials keep a floor based on direct coal value, charcoal conversion, or fuel value; arbitrary/generated resources like cobblestone have no forced 1-coal floor. The stock is persisted in SQLite.
## Example Config
```yaml
economy:
starting_balance: 0
deposit_coal: true
deposit_coal_blocks: true
claims:
homestead:
base_cost: 32
cost_per_block: 0.05
max_radius: 45
first_claim:
free: true
max_radius: 12
industrial:
base_cost: 128
cost_per_block: 0.15
max_radius: 96
permits:
mining:
cost: 64
duration_hours: 72
market:
dynamic:
initial_stock: 1024
target_stock: 1024
min_multiplier: 0.35
max_multiplier: 3.0
sell_multiplier: 0.85
buy_multiplier: 1.15
prices:
DIRT: 0.01
COBBLESTONE: 0.02
SAND: 0.05
GRAVEL: 0.04
OAK_LOG: 0.25
SPRUCE_LOG: 0.25
BIRCH_LOG: 0.25
TORCH: 0.10
COAL: 1.0
COAL_BLOCK: 9.0
RAW_COPPER: 0.5
COPPER_INGOT: 1.0
RAW_IRON: 1.0
IRON_INGOT: 2.0
RAW_GOLD: 2.0
GOLD_INGOT: 4.0
DIAMOND: 32.0
EMERALD: 12.0
land:
default_land_class: FREEHOLD
deny_mining_in_government: true
deny_mining_in_protected_preserve: true
deny_mining_in_border_zone: true
spawn:
protection_radius: 32
guide:
create_government_region: true
lines:
- "COALGOV BASIN"
- "Free first"
- "homestead:"
- "/claim buy"
- "Use /claim wand"
- "for polygons"
- "Coal seams:"
- "redwood ridges"
- "Permits:"
- "/permit buy"
- "mining <region>"
- "/market trades"
messages:
prefix: "&8[&6CoalGov&8]&r "
```
## Manual Test Checklist
- Server starts without errors.
- Database file is created at `plugins/CoalGov/coalgov.db`.
- Player joining creates a `players` row.
- `/coal balance` works.
- `/coal deposit` removes coal from inventory and increases balance by `100cc` per coal item.
- `/coal withdraw` decreases balance and gives coal items for whole-coal amounts.
- `/coal pay` transfers whole coal, decimal coal, and `cc` amounts.
- `/market` opens a vanilla inventory trading menu.
- Selling resources through `/market` increases market stock.
- Buying resources through `/market` decreases market stock and changes future prices.
- `/land create` creates a region.
- `/land info` reports current land class.
- `/claim buy` creates a claim and charges coal.
- `/claim appraise` appraises the claim you are standing in.
- `/claim sell` sells the claim you are standing in back to the government at appraised value.
- `/claim show <id>` displays a temporary particle outline.
- `/claim wand` draws a temporary polygon with particles and marker block previews.
- `/claim buy homestead` after wand selection creates a polygon claim.
- Claim corners are marked with protected gold blocks.
- Unclaimed land is protected from normal block placement and breaking.
- Overlapping claims are rejected.
- Mining coal in `PROTECTED_PRESERVE` is denied.
- Mining coal in `MINING_CONCESSION` without permit is denied.
- Buying a mining permit allows mining coal in that concession.
- Admin permission alone does not bypass gameplay restrictions.
- `/coalgov admin bypass on` bypasses build, mining, and marker restrictions for that admin session.