Skip to content

Commit 1f1a450

Browse files
align repo with DPC conventions (https://github.com/Dans-Plugins/dpc-conventions)
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com> Agent-Logs-Url: https://github.com/Dans-Plugins/Currencies/sessions/da4f00c4-c4a0-4ccf-b87f-c3f6dcc588c4
1 parent bf90998 commit 1f1a450

9 files changed

Lines changed: 643 additions & 24 deletions

File tree

.github/copilot-instructions.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copilot Instructions
2+
3+
This repository follows the DPC (Dans Plugins Community) conventions defined at
4+
https://github.com/Dans-Plugins/dpc-conventions. Read those conventions before
5+
making any changes.
6+
7+
## Technology Stack
8+
9+
- Language: Kotlin
10+
- Build tool: Gradle (Groovy DSL)
11+
- Target platform: Spigot / Paper
12+
- Test framework: JUnit 5 + MockK
13+
14+
## Project Structure
15+
16+
- `src/main/kotlin/` – Plugin source code
17+
- `src/main/resources/``plugin.yml`, `config.yml`, and `lang/` files
18+
- `src/test/kotlin/` – Unit tests
19+
- `.github/workflows/` – CI and release workflows
20+
21+
## Coding Conventions
22+
23+
- Use the `lang/` resource files for every user-facing string; never hard-code
24+
messages in Kotlin.
25+
- Follow the existing package structure when adding new classes.
26+
- Annotate every command executor and event listener with `@Override` where applicable.
27+
- This plugin depends on Medieval Factions; use its API where faction data is needed.
28+
29+
## Contribution Workflow
30+
31+
- Branch from `develop` for all changes.
32+
- Open a pull request against `develop`, not `main`.
33+
- Reference the related GitHub issue in every pull request description.

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '17'
23+
distribution: 'temurin'
24+
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Build with Gradle
29+
run: ./gradlew clean build

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build-and-attach:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
23+
- name: Grant execute permission for gradlew
24+
run: chmod +x gradlew
25+
26+
- name: Build with Gradle
27+
run: ./gradlew clean build
28+
29+
- name: Upload JAR to release
30+
uses: softprops/action-gh-release@v2
31+
with:
32+
files: build/libs/*.jar

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [2.1.0]
10+
11+
### Changed
12+
- Updated dependencies
13+
14+
## [2.0.0]
15+
16+
### Added
17+
- Database-backed storage using jOOQ and Flyway
18+
- HikariCP connection pooling
19+
- Support for MariaDB and H2 databases
20+
- PlaceholderAPI integration
21+
- bStats metrics (plugin ID 12810)
22+
23+
### Changed
24+
- Migrated codebase to Kotlin
25+
- Rewrote currency and balance services
26+
27+
## [1.0.0]
28+
29+
### Added
30+
- Initial release
31+
- Faction-based currency creation and minting
32+
- Coinpurse inventory system
33+
- Power cost and item cost for minting
34+
- Protection against crafting, smelting, placement, and anvil usage of currency items

COMMANDS.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Commands Reference
2+
3+
## Currency Commands
4+
5+
### /currency balance
6+
7+
**Description:** View your current balance of all currencies.
8+
**Permission:** `currencies.balance`
9+
**Usage:** `/currency balance`
10+
**Example:** `/currency balance`
11+
12+
---
13+
14+
### /currency create \<name\>
15+
16+
**Description:** Create a new currency for your faction.
17+
**Permission:** `currencies.create`
18+
**Usage:** `/currency create <name>`
19+
**Example:** `/currency create GoldCoin`
20+
21+
---
22+
23+
### /currency info \<currency\>
24+
25+
**Description:** View information about a specific currency.
26+
**Permission:** `currencies.list`
27+
**Usage:** `/currency info <currency>`
28+
**Example:** `/currency info GoldCoin`
29+
30+
---
31+
32+
### /currency list
33+
34+
**Description:** List all currencies associated with your faction.
35+
**Permission:** `currencies.list`
36+
**Usage:** `/currency list`
37+
**Example:** `/currency list`
38+
39+
---
40+
41+
### /currency mint \<currency\> \<amount\>
42+
43+
**Description:** Mint coins of the specified currency. May cost faction power and/or items depending on server configuration.
44+
**Permission:** `currencies.mint`
45+
**Usage:** `/currency mint <currency> <amount>`
46+
**Example:** `/currency mint GoldCoin 10`
47+
48+
---
49+
50+
### /currency rename \<currency\> \<new-name\>
51+
52+
**Description:** Rename an existing currency. Requires the appropriate faction permission or `currencies.force.rename`.
53+
**Permission:** `currencies.rename`
54+
**Usage:** `/currency rename <currency> <new-name>`
55+
**Example:** `/currency rename GoldCoin SilverCoin`
56+
57+
---
58+
59+
### /currency set description \<currency\> \<description\>
60+
61+
**Description:** Set or update the description of a currency. Requires the appropriate faction permission or `currencies.force.desc`.
62+
**Permission:** `currencies.desc`
63+
**Usage:** `/currency set description <currency> <description>`
64+
**Example:** `/currency set description GoldCoin "The official coin of the Northern Kingdom"`
65+
66+
---
67+
68+
### /currency retire \<currency\>
69+
70+
**Description:** Permanently retire a currency so it can no longer be minted.
71+
**Permission:** `currencies.retire`
72+
**Usage:** `/currency retire <currency>`
73+
**Example:** `/currency retire GoldCoin`
74+
75+
---
76+
77+
## Coinpurse Commands
78+
79+
### /coinpurse
80+
81+
**Description:** Open your coinpurse inventory to view and organise your coins.
82+
**Aliases:** `/purse`, `/wallet`
83+
**Permission:** `currencies.coinpurse`
84+
**Usage:** `/coinpurse`
85+
**Example:** `/coinpurse`

CONFIG.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Configuration Guide
2+
3+
All configuration options are found in `plugins/Currencies/config.yml`. The file is generated automatically on first run.
4+
5+
---
6+
7+
## version
8+
9+
**Type:** string
10+
**Default:** *(set automatically)*
11+
**Description:** The plugin version. This value is managed automatically and should not be changed manually.
12+
13+
---
14+
15+
## database.url
16+
17+
**Type:** string
18+
**Default:** `jdbc:h2:./medieval_factions_db;AUTO_SERVER=true;MODE=MYSQL;DATABASE_TO_UPPER=false`
19+
**Description:** The JDBC connection URL for the database. By default an embedded H2 database is used. Change this to a MariaDB/MySQL URL to use an external database.
20+
21+
**Example (MariaDB):**
22+
```yaml
23+
database:
24+
url: 'jdbc:mariadb://localhost:3306/currencies'
25+
dialect: 'MARIADB'
26+
username: 'currencies_user'
27+
password: 'secret'
28+
```
29+
30+
---
31+
32+
## database.dialect
33+
34+
**Type:** string
35+
**Default:** `H2`
36+
**Description:** The SQL dialect to use. Supported values: `H2`, `MARIADB`.
37+
38+
---
39+
40+
## database.username
41+
42+
**Type:** string
43+
**Default:** `sa`
44+
**Description:** The database username.
45+
46+
---
47+
48+
## database.password
49+
50+
**Type:** string
51+
**Default:** *(empty)*
52+
**Description:** The database password.
53+
54+
---
55+
56+
## coinpurse.slots
57+
58+
**Type:** integer
59+
**Default:** `54`
60+
**Description:** The number of inventory slots in a player's coinpurse. Must be a multiple of 9 and no greater than 54.
61+
62+
**Example:**
63+
```yaml
64+
coinpurse:
65+
slots: 27
66+
```
67+
68+
---
69+
70+
## currencies.showAmountMinted
71+
72+
**Type:** boolean
73+
**Default:** `true`
74+
**Description:** When `true`, the amount minted is shown to the player after a successful mint operation.
75+
76+
**Example:**
77+
```yaml
78+
currencies:
79+
showAmountMinted: false
80+
```
81+
82+
---
83+
84+
## currencies.powerCostEnabled
85+
86+
**Type:** boolean
87+
**Default:** `true`
88+
**Description:** When `true`, minting a currency costs faction power.
89+
90+
**Example:**
91+
```yaml
92+
currencies:
93+
powerCostEnabled: false
94+
```
95+
96+
---
97+
98+
## currencies.powerCost
99+
100+
**Type:** integer
101+
**Default:** `1`
102+
**Description:** The amount of faction power deducted per mint operation. Only relevant when `powerCostEnabled` is `true`.
103+
104+
**Example:**
105+
```yaml
106+
currencies:
107+
powerCost: 2
108+
```
109+
110+
---
111+
112+
## currencies.itemCostEnabled
113+
114+
**Type:** boolean
115+
**Default:** `true`
116+
**Description:** When `true`, minting a currency requires an item cost (configured per currency).
117+
118+
**Example:**
119+
```yaml
120+
currencies:
121+
itemCostEnabled: false
122+
```
123+
124+
---
125+
126+
## currencies.disallowCrafting
127+
128+
**Type:** boolean
129+
**Default:** `true`
130+
**Description:** When `true`, currency items cannot be used in crafting recipes.
131+
132+
**Example:**
133+
```yaml
134+
currencies:
135+
disallowCrafting: false
136+
```
137+
138+
---
139+
140+
## currencies.disallowSmelting
141+
142+
**Type:** boolean
143+
**Default:** `true`
144+
**Description:** When `true`, currency items cannot be smelted in a furnace.
145+
146+
**Example:**
147+
```yaml
148+
currencies:
149+
disallowSmelting: false
150+
```
151+
152+
---
153+
154+
## currencies.disallowPlacement
155+
156+
**Type:** boolean
157+
**Default:** `true`
158+
**Description:** When `true`, currency items cannot be placed as blocks in the world.
159+
160+
**Example:**
161+
```yaml
162+
currencies:
163+
disallowPlacement: false
164+
```
165+
166+
---
167+
168+
## currencies.disallowAnvilUsage
169+
170+
**Type:** boolean
171+
**Default:** `true`
172+
**Description:** When `true`, currency items cannot be combined or renamed in an anvil.
173+
174+
**Example:**
175+
```yaml
176+
currencies:
177+
disallowAnvilUsage: false
178+
```

0 commit comments

Comments
 (0)