Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ jobs:
path: coverage-summary.md

- name: Post coverage summary comment on PR
if: ${{ github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
uses: peter-evans/create-or-update-comment@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-file: coverage-summary.md
edit-mode: replace
identifier: coverage-summary
60 changes: 26 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
# Ignore Maven target directory
/**/target/

# Ignore compiled classes directories
**/classes/

# Ignore module build outputs
ezeconomy-bukkit/target/
ezeconomy-papi/target/

# Ignore IDE files
/.idea/
*.iml
*.ipr
*.iws

# Ignore Eclipse files
.classpath
.project
.settings/

# Ignore OS files
.DS_Store
Thumbs.db

# Ignore logs
*.log

# Ignore build tools
/build/

# Ignore other common files
*.swp
*.swo

/**/target/
# Ignore compiled classes directories
**/classes/
# Ignore module build outputs
ezeconomy-bukkit/target/
ezeconomy-papi/target/
# Ignore IDE files
/.idea/
*.iml
*.ipr
*.iws
# Ignore Eclipse files
.classpath
.project
.settings/
# Ignore OS files
.DS_Store
Thumbs.db
# Ignore logs
*.log
# Ignore build tools
/build/
# Ignore other common files
*.swp
*.swo
68 changes: 67 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

**EzEconomy** is a professional-grade Vault economy provider for Minecraft servers. Choose from YML, MySQL, SQLite, MongoDB, or custom storage with multi-currency support, async caching, and thorough permission controls.

> **Original plugin by [@ez-plugins](https://github.com/ez-plugins) — [ez-plugins/EzEconomy](https://github.com/ez-plugins/EzEconomy)**
> This fork adds Velocity proxy support, HikariCP connection pooling, cross-server payments, and other improvements by [@GitEpildev](https://github.com/gitEpildev).

---

## 📚 Documentation
Expand Down Expand Up @@ -42,6 +45,7 @@ EzEconomy is designed for performance, reliability, and operational clarity. Hig
- **Async caching**: Optimized for large servers
- **Comprehensive commands**: `/balance`, `/eco`, `/baltop`, `/bank`, `/pay`, `/currency`
- **Granular permissions**: Per-command and per-bank action
- **Velocity proxy support**: Cross-server payments, network-wide player list, and offline notification queuing

---

Expand All @@ -63,6 +67,8 @@ EzEconomy is designed for performance, reliability, and operational clarity. Hig
- `ezeconomy.balance.others`: View other players' balances
- `ezeconomy.eco`: Use /eco admin command
- `ezeconomy.pay`: Use /pay command
- `ezeconomy.payall`: Use /pay * to pay all players
- `ezeconomy.payall.bypasswithdraw`: Pay all without deducting from sender balance
- `ezeconomy.currency`: Use /currency command
- **Bank Permissions**:
- `ezeconomy.bank.create`: Create a new bank
Expand Down Expand Up @@ -168,12 +174,72 @@ mongodb:

## ⬇️ Installation

1. Place `EzEconomy.jar` in your plugins folder
1. Place `ezeconomy-bukkit-*.jar` in your Paper/Spigot server's `plugins/` folder
2. Configure `config.yml` and the appropriate `config-*.yml` file for your storage type
3. Restart your server

---

## Velocity / Proxy Support

This fork includes a dedicated `ezeconomy-velocity` module that enables full cross-server economy on Velocity networks. Both the Velocity proxy plugin and the Bukkit plugin work together over a shared plugin messaging channel (`ezeconomy:notify`).

### What it does

| Feature | How it works |
|---------|-------------|
| **Cross-server `/pay`** | A player on Server A can `/pay PlayerB 100` even if PlayerB is on Server B. The Velocity plugin forwards the "You received ..." notification to the correct backend. |
| **Cross-server `/bal`** | `/bal PlayerB` resolves players across all servers using the shared MySQL `players` table and the Velocity network player list. |
| **`/pay *` (pay all)** | Pays every online player on every backend server, not just the local one. Remote recipients get notifications forwarded through Velocity. |
| **Network player list** | The Velocity plugin broadcasts a UUID + name list of all connected players to every backend every 3 seconds. This powers tab-completion and cross-server player resolution. |
| **Offline notification queue** | If a recipient is offline when payment arrives, the notification is queued. MySQL storage: persisted to a `pending_notifications` table. Other storage: held in-memory until the player next logs in. |

### Prerequisites

- **Velocity proxy** (not BungeeCord — the velocity module uses the Velocity API)
- **MySQL storage** (`storage: mysql`) configured identically on every backend server, pointing to the **same database**. This is required so all servers share balances and player records.
- **`store-on-join: true`** recommended on every backend so player UUID/name records are persisted to MySQL when they join any server. Without this, cross-server lookups may fail for players who have never been seen by the database.

### Setup

1. **Velocity proxy** — place `ezeconomy-velocity-*.jar` in the proxy's `plugins/` folder.
2. **Each Paper backend** — place `ezeconomy-bukkit-*.jar` in the server's `plugins/` folder.
3. **Each backend `config.yml`** — set:

```yaml
storage: mysql

store-on-join:
enabled: true

cross-server:
enabled: true
verbose-logging: false # set true temporarily for debugging
```

4. **Each backend `config-mysql.yml`** — point to the **same** MySQL database:

```yaml
mysql:
host: your-shared-db-host
port: 3306
database: ezeconomy
username: ezeconomy
password: your-password
table: balances
```

5. **Restart** the Velocity proxy first, then all backend servers.

### Troubleshooting

- **"Player not found" on cross-server `/pay` or `/bal`**: make sure `cross-server.enabled: true` and `store-on-join.enabled: true` are set on the backend where the command is run. The target player must have joined at least once since `store-on-join` was enabled.
- **Enable verbose logging**: set `cross-server.verbose-logging: true` temporarily to see `PLAYER_LIST` and `NOTIFY` messages in the console.
- **Command conflicts**: if another plugin intercepts `/pay` or `/payall`, use the built-in aliases `/ezpay` and `/ezpayall` instead.
- **Vault required**: each Paper backend needs `Vault` (or `Vault-Updated`) installed so EzEconomy can register as the economy provider.

---

## 🔗 Integration

- EzEconomy automatically registers as a Vault provider
Expand Down
3 changes: 1 addition & 2 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ Using `/pay * <amount>` sends the specified amount to multiple recipients at onc
- By default the command enumerates online players via the server; enabling `pay.pay_all.include_offline` uses the storage provider to enumerate stored balances and may include offline-only accounts.
- A summary message (`paid_all_summary`) is sent to the sender after successful execution. Recipients receive the standard payment notification if they are online.
- Large recipient sets or mixed-currency conversions may increase execution time; consider enabling the feature only for trusted admins and ensure backup/monitoring is in place.

If you'd like, I can also add a short example snippet and cross-link to the config defaults in `src/main/resources/config.yml`.
- On Velocity networks with `cross-server.enabled: true`, `/pay *` includes players from all backend servers. Each remote recipient receives a notification forwarded through the proxy.
52 changes: 52 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,41 @@ banking:

Set `banking.enabled` to `false` if you prefer using a different bank plugin or want to disable shared bank accounts.

### Store on join

Control whether player metadata (UUID + name) is written to storage when a player joins.

```yaml
store-on-join:
enabled: false
```

When disabled, EzEconomy skips the join-time write. **On Velocity networks this should be `true`** so that every backend server populates the shared MySQL `players` table. Without it, cross-server commands like `/bal <player>` and `/pay <player>` cannot resolve players who have only joined a different backend.

### Cross-server messaging (Velocity)

These settings control the plugin messaging channel used by the `ezeconomy-velocity` proxy module.

```yaml
cross-server:
enabled: true
verbose-logging: false
```

- `enabled` — set to `true` on every Paper backend that participates in the Velocity network. When `false` (the default for single-server setups), the plugin does not register the messaging channel and all cross-server features are disabled.
- `verbose-logging` — set to `true` temporarily to see `PLAYER_LIST`, `NOTIFY`, and `RECIPIENT_OFFLINE` messages in the console. Useful for verifying that the Velocity plugin is broadcasting the player list and forwarding payment notifications.

> **Requires**: the `ezeconomy-velocity-*.jar` plugin running on the Velocity proxy, `storage: mysql` with all backends pointing to the same database, and `store-on-join.enabled: true`.

### Payment sync timeout

```yaml
payment:
sync-event-timeout-ms: 5000
```

This controls how long async payment execution waits for sync event dispatch before the payment is cancelled for safety.

### Caching strategy

Configure how EzEconomy caches frequently-read values (placeholders, top lists, GUI data).
Expand All @@ -61,6 +96,23 @@ caching-strategy: LOCAL

If `caching-strategy` is not present, the plugin will fallback to the older `locking-strategy` value for backward compatibility.

### Lock timing

Configure lock acquisition timing independently from the selected lock backend.

```yaml
locking-strategy: LOCAL
locking:
ttl-ms: 5000
retry-ms: 50
max-attempts: 100
```

- `locking.ttl-ms`: lock lease duration in milliseconds.
- `locking.retry-ms`: wait time between lock retries.
- `locking.max-attempts`: maximum retry attempts before failing lock acquisition.
- Legacy `redis.ttl-ms`, `redis.retry-ms`, and `redis.max-attempts` are still accepted as fallback values.

### Notes

- `storage` must match one of the supported providers: `yml`, `mysql`, `sqlite`, `mongodb`, or `custom`.
Expand Down
18 changes: 8 additions & 10 deletions docs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ EzEconomy supports multiple storage backends to store player balances, bank data

## Configuration

Storage providers are configured in the main `config.yml` file under the `storage` section:
Storage providers are configured in the main `config.yml` file:

```yaml
storage:
type: sqlite # Options: yml, sqlite, mysql, mongodb
# Provider-specific config below
storage: sqlite # Options: yml, sqlite, mysql, mongodb
```

Each provider has its own configuration file (e.g., `config-sqlite.yml`) that is loaded based on the type.
Each provider has its own configuration file (for example, `config-sqlite.yml`) that is loaded based on this value.

## YML Storage Provider

### Description
Stores data in YAML files on the filesystem. Each player has their own file, and bank data is stored in the owner's file.

### Setup
1. Set `storage.type: yml` in `config.yml`
1. Set `storage: yml` in `config.yml`.
2. Configure in `config-yml.yml`:
```yaml
yml:
Expand Down Expand Up @@ -66,7 +64,7 @@ Stores data in YAML files on the filesystem. Each player has their own file, and
Uses a local SQLite database file for all data storage.

### Setup
1. Set `storage.type: sqlite` in `config.yml`
1. Set `storage: sqlite` in `config.yml`.
2. Configure in `config-sqlite.yml`:
```yaml
sqlite:
Expand Down Expand Up @@ -124,7 +122,7 @@ CREATE TABLE bank_members (
Uses a remote MySQL database for scalable storage.

### Setup
1. Set `storage.type: mysql` in `config.yml`
1. Set `storage: mysql` in `config.yml`.
2. Configure in `config-mysql.yml`:
```yaml
mysql:
Expand Down Expand Up @@ -190,7 +188,7 @@ CREATE TABLE transactions (
Uses MongoDB for NoSQL document-based storage.

### Setup
1. Set `storage.type: mongodb` in `config.yml`
1. Set `storage: mongodb` in `config.yml`.
2. Configure in `config-mongodb.yml`:
```yaml
mongodb:
Expand Down Expand Up @@ -269,4 +267,4 @@ Currently, there is no automatic migration tool. To switch providers:

1. **Permission denied**: Ensure the plugin has write access to the data folder
2. **Connection failed**: Check database credentials and network connectivity
3. **Table creation failed**: Ensure the database user has CREATE privileges
3. **Table creation failed**: Ensure the database user has CREATE privileges.
18 changes: 15 additions & 3 deletions docs/developer-api.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Developer API (v2)

This file has moved to the API folder. See the full developer API documentation at:
The full developer API documentation now lives under the `docs/api/` folder.

- [docs/api/README.md](api/README.md)
## Start Here

The new location contains the complete Developer API guide, examples, and links to storage and command docs.
- [API Overview](api/README.md)
- [Storage Provider API](api/storage-provider.md)

## Event Reference

- [PreTransactionEvent](api/event/PreTransactionEvent.md)
- [PostTransactionEvent](api/event/PostTransactionEvent.md)
- [PlayerPayPlayerEvent](api/event/PlayerPayPlayerEvent.md)
- [TransactionType](api/event/TransactionType.md)
- [BankPreTransactionEvent](api/event/BankPreTransactionEvent.md)
- [BankPostTransactionEvent](api/event/BankPostTransactionEvent.md)

These pages include method summaries, usage notes, and examples for integrations.
12 changes: 8 additions & 4 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ EzEconomy is a Vault-compatible economy provider built for reliability, clarity,
- **Multi-currency**: Optional per-player currency selection with conversion rates.
- **Async caching**: Keeps balance lookups fast on busy servers.
- **Banking system**: Shared accounts with member management and permissions.
- **Banking system**: Shared accounts with member management and permissions. You can disable the built-in banking subsystem via `banking.enabled: false` in `config.yml` if you run an external bank plugin or don't need bank features.
- **Optional banking toggle**: Disable built-in banking via `banking.enabled: false` in `config.yml` if you run an external bank plugin.

## Supported Versions

Expand All @@ -32,6 +32,10 @@ EzEconomy targets modern Paper/Spigot servers that support Vault. For best resul

- **Configuration**: See storage-specific settings and multi-currency setup.
- **Commands & Permissions**: Confirm staff and player access rules.
- **Storage Details**: Understand backend behavior and data safety.

- **Events**: EzEconomy now exposes pre/post transaction events for integrations and moderation. See `docs/api/event/PreTransactionEvent.md`, `docs/api/event/PostTransactionEvent.md`, `docs/api/event/PlayerPayPlayerEvent.md`, and `docs/api/event/TransactionType.md` for details and examples.
- **Storage details**: Understand backend behavior and data safety.
- **Events**: EzEconomy exposes transaction events for integrations and moderation.
See:
- `docs/api/event/PreTransactionEvent.md`
- `docs/api/event/PostTransactionEvent.md`
- `docs/api/event/PlayerPayPlayerEvent.md`
- `docs/api/event/TransactionType.md`
7 changes: 6 additions & 1 deletion docs/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Assign permissions through your permissions plugin (LuckPerms, PermissionsEx, etc.).

## Notes

- All bank permissions are disabled if `banking.enabled` is set to `false`.
- Grant `ezeconomy.bank.admin` only to trusted staff.

## Player Permissions

| Permission | Description |
Expand Down Expand Up @@ -33,5 +38,5 @@ Assign permissions through your permissions plugin (LuckPerms, PermissionsEx, et
## Recommended Roles

- **Players**: `ezeconomy.pay`, `ezeconomy.currency`
- **Staff**: `ezeconomy.balance.others`
- **Moderators/Staff**: `ezeconomy.balance.others`
- **Administrators**: `ezeconomy.eco`, `ezeconomy.bank.admin`
2 changes: 1 addition & 1 deletion ezeconomy-bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.ez-plugins</groupId>
<artifactId>ezeconomy-parent</artifactId>
<version>2.5.1</version>
<version>2.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>ezeconomy-bukkit</artifactId>
Expand Down
Loading
Loading