8000 GitHub - joogiebear/EconGuard · GitHub
[go: up one dir, main page]

Skip to content
joogiebearPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 
8000

History

65 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EconGuard

Economy audit ledger shared by a server's plugins, and anti-abuse / RMT-detection core for Paper. Requires Paper 26.2 or newer.

EconGuard doesn't move money and has no player-facing features. It's the piece the other economy plugins report to: one ledger, one place to look, one audit trail for a ban or rollback.

Part of a suite with RoyalBank, RoyalAuctions and RoyalBazaar — but the API is public and generic, so any plugin can feed it.


Contents


Why a separate plugin

Every economy plugin ends up growing its own half-blind anti-abuse layer. The bank sees deposits, the auction house sees sales, the shop sees purchases — and none of them see each other, so the one pattern that actually matters is invisible to all of them:

a three-day-old account receives 500M through an auction "sale" of a dirt block, immediately banks it, and withdraws it over the next week.

The bank sees a big deposit. The auction house sees a weird sale. Neither sees RMT. EconGuard sees the whole chain because everything reports into one ledger, and correlation runs across sources.

That's also why it's a standalone plugin rather than a library: with a library each plugin gets its own copy of the state and they still can't see each other.

What it can and cannot do

Can: surface suspicious patterns, keep a unified per-player money history, correlate counterparties across bank/auction/shop/pay, and give you an evidence trail for enforcement.

Cannot: prevent real-money trading. RMT is an out-of-game agreement; the in-game half looks exactly like a legitimate gift. Nothing running on your server can distinguish them with certainty — which is why EconGuard flags for staff review and never auto-punishes. A false ban costs you far more than a missed flag.

To actually cap the damage, pair it with friction in the economy itself: a maximum currency cap, and limits/cooldowns/tax on player-to-player transfers.


Install

  1. Drop EconGuard.jar into plugins/.
  2. Start the server.
  3. Any suite plugin present will sta 8000 rt reporting automatically — no wiring needed.

EconGuard has no hard dependencies. If it isn't installed, the reporting plugins simply skip the call.

Commands & permissions

Base command /econguard, aliases /eg, /econ.

Command
/eg flags List accounts flagged for review
/eg flags clear [player] Clear all flags, or one player's
/eg history <player> [limit] That player's unified money history across every source
/eg stats Ledger size, flag count, detection status
/eg reload Reload config.yml and messages.yml
Node Default
econguard.admin op The commands above
econguard.alerts op Receive alerts and flag notices in chat

Configuration

currency-symbol: "$"        # formatting for alerts only
notify-staff: true          # ping online econguard.alerts holders
discord-webhook: ""         # optional; blank = off

storage:
  type: SQLITE              # or MYSQL (fill in the mysql block in config.yml)
  sqlite-file: "econguard.db"
  refresh-seconds: 5        # MySQL: how often flags from other servers are picked up
  server-id: ""             # MySQL: this server's name; empty generates one

database:
  max-rows-per-player: 500  # pruned on startup and daily. 0 = unlimited

# "Young account" definition — see below. Either condition qualifies.
young-account:
  max-age-days: 3
  max-playtime-hours: 10

detection:
  large-transaction: 100000000.0
  young-incoming-transfer: 50000000.0
  velocity:
    enabled: true
    window-minutes: 30
    threshold: 250000000.0
  counterparty:
    enabled: true
    window-minutes: 60
    threshold: 500000000.0

All chat text (command output, staff alerts and the flag reasons shown in alerts) is in messages.yml. A key missing from your copy uses the plugin's built-in default.

The detection signals

The young-account gate is the core idea. Two of the four signals only fire on young accounts, and that's deliberate: a veteran who legitimately sells a lucky drop for 200M is not suspicious, and flagging them is how an anti-abuse system trains staff to ignore it. What is suspicious is wealth arriving with no time invested — that's the actual RMT fingerprint, and the one thing a buyer can't fake without playing the game.

An account is "young" if it joined within max-age-days or has under max-playtime-hours playtime. Either qualifies — an alt farmed to 4 days old but with 20 minutes played is still young.

Signal Fires when Gate
Large transaction any single movement ≥ large-transaction all accounts (informational)
Young incoming transfer a young account receives ≥ young-incoming-transfer in one go young only
Velocity a young account gains ≥ threshold incoming within window-minutes young only
Counterparty correlation the same payer funds the same receiver ≥ threshold within window-minutes — both are flagged all ages

Counterparty correlation deliberately ignores account age: it catches the ring, and the seller in an RMT ring is usually an established account. That's what a per-plugin anti-abuse layer structurally cannot see, because the transfers are spread across the bank, the auction house and /pay.

Alerts go to the console, to online econguard.alerts holders, and to the Discord webhook. Staff with the permission are told the pending flag count when they join.

Tuning

The defaults are deliberately high — they're set for a server with a large currency supply, and on a small economy they will simply never fire.

Calibrate against your own numbers, not the defaults: look at what an established player's balance actually is, and set large-transaction somewhere around what an unusual-but-legitimate single trade looks like. Then run for a week and read /eg flags. A system that flags twenty accounts a day gets ignored within a week, and an ignored flag is worth exactly as much as no flag.


Developer API

Feed EconGuard from any plugin. Nothing here compiles against a Royal* plugin — the API is generic.

Reporting an event:

import com.mystipixel.econguard.api.*;

EconGuard.get().ifPresent(api -> api.record(
    MoneyEvent.builder(player.getUniqueId(), player.getName())
              .source(Sources.BANK)      // bank pay auction shop admin interest other
              .action("deposit")         // free-form; shown in /eg history
              .amount(amount)
              .incoming(false)           // is the player RECEIVING money?
              .counterparty(otherUuid)   // optional — required for correlation detection
              .item("ecoitems:brazen_sword")   // optional
              .balanceAfter(newBalance)  // optional
              .note("via /ah buy")       // optional
              .build()));

EconGuard.get() returns Optional.empty() when the plugin isn't installed, so the ifPresent call above is the whole guard — no soft-depend check, no isPluginEnabled, no reflection. Your plugin works with or without it, and the integration is one statement.

The interface:

public interface EconGuardAPI {
    void record(MoneyEvent event);
    List<Flag> getFlags();
    boolean clearFlag(UUID player);
    void clearFlags();
    List<MoneyEvent> getHistory(UUID player, int limit);
}

public record Flag(UUID player, String playerName, String type, String reason, long timestamp) {}

Two things to get right:

  • incoming is from the reporting player's perspective. A bank deposit is money leaving their purse → incoming(false). An auction sale pays the seller → incoming(true) on the seller's event. Get this backwards and velocity detection points at the wrong side of every trade.
  • Set counterparty whenever there is one. Correlation detection is the signal that catches RMT rings, and it's the one that goes quietly dead if the field is left null. A shop purchase has no counterparty (the server is); a /pay or an auction sale absolutely does.

Add it as a provided dependency and softdepend: [EconGuard] in your plugin.yml.

Storage

SQLite (econguard.db). Two tables: the money ledger and the flag list. Writes are async; the ledger is pruned to max-rows-per-player on startup and once a day so it can't grow unbounded on a long-lived server.

MySQL is supported too, for one server or for several.

Several servers, one ledger

Point every server at the same MySQL/MariaDB database and they share one ledger and one set of flags: /econguard history shows a player's payments from every server.

  • Flags reach every server. Each server re-reads the flags every refresh-seconds, so a player flagged on one server is refused on the others (with block-flagged-trades) within that time, and clearing a flag clears it everywhere.
  • A flag is announced once, in chat and on Discord, by the server that raised it first. Staff on the other servers see it in /econguard flags and in the count shown when they join.
  • Detection counts payments from every server. The velocity and collusion totals read the shared ledger, so money split across servers adds up. Each server writes its payments to the database about once a second, so two payments on two servers within a second of each other are counted together at the next payment, not at once.
  • Servers that start together take turns migrating the schema (econguard_schema_version), and the ledger is pruned by one server at most every six hours (econguard_lease), in small batches so other servers' writes don't wait on it.
  • Upgrade one server first when an old MySQL ledger is still latin1: its one-time conversion to utf8mb4 copies the table, and other servers give up waiting for it after two minutes.
  • Give each server its own server-id, or leave it empty and each server keeps a generated one in server-id.txt. Copying that file to another server makes them look like one server.
  • Keep the servers' clocks in sync (NTP). Ledger times come from the server that recorded them.

Building

mvn -DskipTests package     # -> target/EconGuard.jar

Java 21, Maven. Versioning is year.week.revision (e.g. 2026.28.0), matching the eco suite.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0