Skip to content
Merged
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
54 changes: 47 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@

## Unreleased

## Version 1.1.0

### Improvements

#### Menus

+ Every menu has a new look inspired by Hypixel SkyBlock. Values are coloured by what they are — money in gold, counts
in green, dates and times in yellow, nations in aqua, anything dangerous in red — and descriptions and tutorial lessons
pick out their key terms, such as PvP, spawns, outposts, and upkeep, in the same colours everywhere.
+ Every button now tells you what clicking it does, in lines like "Click to open!", "Left-click to edit!", and
"Right-click to clear!": yellow for a click or left-click, aqua for a right-click, and red when the click deletes or
removes something. Buttons that did two things by button, such as editing or clearing a board, used to explain it in
their description; the hints now sit in their own block at the bottom.
+ Switches show a bold ENABLED or DISABLED status and say "Click to enable!" or "Click to disable!" instead of "Click
to toggle", and permission cells say "Click to allow!" or "Click to deny!".
+ Progress bars show how far along you are: claims used against the claim limit, outposts, progress towards the next
town or nation level, and lessons read in the tutorial.
+ Menus have a black glass background so the icons stand out, the back button is now "Go Back" and names the menu it
returns to, and page arrows name the page they lead to.
+ Leaderboards mark the top three with gold, silver, and bronze ranks, sort buttons point at the current order with an
aqua arrow, and lists of pending invites use bullet points.
+ Server owners who edited their language files in `plugins/TownyMenu/lang/` keep their own text and colours. To get
the new look, move your edits aside and let TownyMenu copy the new files on the next start; the header of
`en_US.yml` lists the colour palette.

#### Misc

+ The sort button in the town and nation directories now goes both ways: left-click moves to the next sort order and
right-click goes back to the previous one, so you no longer have to click all the way around to reach the order you
just passed.

### Technical Details

#### Misc

+ TownyMenu now builds against Minecraft 26.3 (Paper API 26.3). Run it on a Paper 26.3 server.
+ Menus gain `hints(...)` for click hints from the new shared `click.*` translation keys, `progressBar(current, max)`,
`pageArrow(...)`, and a public `title`. The old `common.click-*` keys, `icon.currently`, and `icon.click-toggle` are
gone; the developer guide documents the click-hint rules and the colour palette.

## Version 1.0.2

### New Features
Expand All @@ -20,8 +60,8 @@
#### Bank Menu

+ The Deposit, Withdraw, and Bank History buttons now have a blank row above and below them instead of being wedged
between the bank icon and the bottom row, so the bank details, the actions, and the navigation read as three
separate blocks. The menu is one row taller for it, and the amount menu is laid out the same way.
between the bank icon and the bottom row, so the bank details, the actions, and the navigation read as three separate
blocks. The menu is one row taller for it, and the amount menu is laid out the same way.

#### Admin Menus

Expand All @@ -31,9 +71,9 @@

#### Misc

+ New `bank-amounts` setting in `config.yml` lists the preset amounts the deposit and withdraw menus offer. Amounts
that are zero or negative are dropped, duplicates removed, and the rest sorted; up to nine fit in the menu row. An
empty list leaves players with only Everything and Custom Amount.
+ New `bank-amounts` setting in `config.yml` lists the preset amounts the deposit and withdraw menus offer. Amounts that
are zero or negative are dropped, duplicates removed, and the rest sorted; up to nine fit in the menu row. An empty
list leaves players with only Everything and Custom Amount.

## Version 1.0.1

Expand Down Expand Up @@ -84,8 +124,8 @@
#### Misc

+ Added a `Prices` utility that works out what a menu action costs — claims, outposts, spawn travel, plot types, town
merges — from Towny's config and the town or nation involved, and `Menu.costLine` / `Menu.priceLine` to turn an
amount into lore.
merges — from Towny's config and the town or nation involved, and `Menu.costLine` / `Menu.priceLine` to turn an amount
into lore.
+ `Pickers.option` takes a `lines` lambda for per-option lore.
+ Added `LoreBlocks`, which lays an icon's lore out in blocks: a blank line under the display name, single separators
between blocks, a divider rule sized to the longest line above the actions, and no separator left dangling at either
Expand Down
51 changes: 39 additions & 12 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TownyMenu is a Minecraft Paper plugin that adds a GUI layer on top of [Towny](https://github.com/TownyAdvanced/Towny):
players manage their town, nation, and plots through inventory menus instead of typing Towny commands. It targets
Minecraft 26.2 (Paper API 26.2), hard-depends on Towny, and is written in Kotlin. [README.md](README.md) has the
Minecraft 26.3 (Paper API 26.3), hard-depends on Towny, and is written in Kotlin. [README.md](README.md) has the
player-facing overview.

## Tech Stack
Expand All @@ -13,7 +13,7 @@ player-facing overview.
|:---------------|:-------------------------------------------------|
| Language | Kotlin 2.3.10 |
| Build | Gradle 9.7.1 (Kotlin DSL) |
| Platform | Paper API 26.2 (MC 26.2) |
| Platform | Paper API 26.3 (MC 26.3) |
| Towny | 0.103.2.7 (`towny_version` in gradle.properties) |
| Java toolchain | JDK 25 |

Expand Down Expand Up @@ -41,7 +41,8 @@ Before finishing any task that changes the plugin, do all of the following:

3. **Translate every new string** — player-facing text never lives in Kotlin. Add each key to **both**
[en_US.yml](src/main/resources/lang/en_US.yml) and [zh_CN.yml](src/main/resources/lang/zh_CN.yml) in the same task,
with a real Simplified Chinese translation, and remove keys the change no longer uses. `LangFilesTest` fails the
with a real Simplified Chinese translation coloured the same way as the English (see the colour palette under
Translations), and remove keys the change no longer uses. `LangFilesTest` fails the
build when the files disagree or a key is missing or unused. See the Translations section below.

4. **Check the README** — if the change affects anything [README.md](README.md) mentions (features, commands,
Expand All @@ -57,8 +58,8 @@ Before finishing any task that changes the plugin, do all of the following:

The local test server lives in `run/` (gitignored). `copyPlugin` deletes every `TownyMenu-*.jar` and `towny-*.jar`
already in `run/plugins/` before copying, so a version bump never leaves two copies for Bukkit to load. It puts the
matching Towny jar there too, but the
Paper 26.2 jar (`run/paper-*.jar`) must be downloaded by hand from https://papermc.io/downloads/paper, and `eula.txt`
matching Towny jar there too, but the Paper 26.3 jar (`run/paper-*.jar`) must be downloaded by hand
from https://papermc.io/downloads/paper, and `eula.txt`
accepted, before `startServer` works. The server console reads commands from the terminal running Gradle.

## Repository Layout
Expand Down Expand Up @@ -119,14 +120,27 @@ Extend `Menu` (or `PagedMenu` for lists) and implement `build()`, which runs on
- **Keep `PagedMenu` entries lazy** — pass the icon as a lambda to `MenuEntry` so off-page icons are never built.
- **Show what a button costs** — a button that spends money takes its amount from `Prices` and turns it into lore with
`costLine(...)` / `priceLine(...)`, so the figure is this server's and not a guess.
- **Lay every icon's lore out in the same blocks** — a tooltip reads name → description → data → actions, and a new
icon follows that order or it looks out of place beside the others. With an `Icons` builder the description is the
- **Lay every icon's lore out in the same blocks** — a tooltip reads name → description → data → actions, and a new icon
follows that order or it looks out of place beside the others. With an `Icons` builder the description is the
`description` argument, the data and cost lines are the `extra` varargs, and everything about clicking is
`actions = listOf(...)`; with `itemStack { }` directly, use `loreWrapped(...)`, `loreBreak()` between data blocks,
and `loreActions(...)` to close. Never hand-roll the spacing: no `""` lore line to separate blocks, no divider drawn
by hand, no blank line under the name — `LoreBlocks` adds all three, collapses repeats, and trims a block that turns
out empty. The mistake to watch for is a click hint left among the data lines; it belongs in `actions`, which is what
puts it below the divider. See [The shape of an icon](docs/DEVELOPER_GUIDE.md#the-shape-of-an-icon).
`actions = hints(...)`; with `itemStack { }` directly, use `loreWrapped(...)`, `loreBreak()` between data blocks, and
`loreActions(...)` to close. Never hand-roll the spacing: no `""` lore line to separate blocks, no divider drawn by
hand, no blank line under the name — `LoreBlocks` adds all three, collapses repeats, and trims a block that turns out
empty. The mistake to watch for is a click hint left among the data lines; it belongs in `actions`, which is what puts
it below the divider. See [The shape of an icon](docs/DEVELOPER_GUIDE.md#the-shape-of-an-icon).
- **Tell the player what every click does** — a clickable icon gets a SkyBlock-style hint ending in `!`, taken from the
shared `click.*` keys with `hints(...)` (`actions = hints("click.open")`) or a menu-specific key in the same colours:
yellow for a click or left-click, aqua for a right-click, red when it deletes or removes something. A button that
acts differently per mouse button lists one hint per button, left first (`hints("click.edit", "click.clear")`), and
its description never explains the clicks. An on/off setting uses `Icons.toggle`, which writes its own
ENABLED/DISABLED status and "Click to enable!"/"Click to disable!" hint. Only purely informational icons go without a
hint. See [Click hints](docs/DEVELOPER_GUIDE.md#click-hints).
- **Show progress as a bar** — any "used of limit" or "towards the next level" figure gets a `progressBar(current, max)`
line under its number, and none when the limit is zero or unlimited.
- **Use the framework's chrome, never your own** — `backButton(slot)` (a "Go Back" arrow naming the parent menu),
`pageArrow(...)` for hand-paged menus, `tutorialButton(...)`, and the black glass filler `render()` lays down. Lists of
names inside lore use `common.list-entry` (`• name`). No colour tags in Kotlin, not even for a selection marker: add a
translation key (as `sort.selected` / `sort.option` do).

## Translations

Expand All @@ -135,6 +149,19 @@ Extend `Menu` (or `PagedMenu` for lists) and implement `build()`, which runs on
falling back to `en_US`.
- Values are MiniMessage with `{placeholder}` arguments. Arguments are inserted verbatim, so escape player-written text
with `TownyUtil.name()` / `TownyUtil.text()` first. Colours belong in the translation, not in Kotlin.
- **Every new string follows the [colour palette](docs/DEVELOPER_GUIDE.md#colour-palette)** (Hypixel SkyBlock style),
in both languages:
- Labels and descriptions `<gray>`; the value after a label takes its kind's colour — `<gold>` money and town
names, `<aqua>` nations, `<green>` counts, `<yellow>` dates and times, `<white>` player names and other neutral
values, `<red>` a count that is bad news (outlaws, prisoners). A ratio greys its slash:
`"<gray>Claims: <green>{claims}<gray>/<green>{max}"`.
- A description highlights one to three key terms, closing each tag so the grey resumes, and a term always gets
the same colour: `<red>` danger (PvP, enemies, outlaws, jail, debt, ruins, "permanently"), `<gold>` money and
leadership (bank, taxes, upkeep, price, mayor, capital, home block), `<green>` land and friendship (claims,
chunks, plots, land, allies, friends, trust), `<light_purple>` spawns, outposts, teleports, `<aqua>` nation zone,
`<yellow>` menu and button names. Example: `"Teleport to your town <light_purple>spawn</light_purple>."`
- Click hints end in `!` (Chinese `!`, `点击…!` / `左键…!` / `右键…!`) and are coloured by button as above.
- `command.*` help text stays plain: no tags.
- Keys are grouped by menu (`town.*`, `plot-group.*`); reuse `common.*`, `toggle.*`, and `icon.*` for shared text.
- Key names must appear as whole string literals (`tr(if (on) "a.on" else "a.off")`, not `"a.$state"`) so
`LangFilesTest` can see them. The only runtime-built keys are `plot-type.*` and `command.*`.
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
- **Status pages** — Click your town or nation to see its level, what the next level needs, its limits, the daily
upkeep, and warnings for debt, ruins, conquest, and overclaiming.
- **Leaderboards and prices** — Rank towns, nations, and players by residents, land, and money, and see every price on
the server with a countdown to the next Towny day. Buttons that spend money show their own price too, so you know
what a claim, a teleport, or a plot costs before you click it.
the server with a countdown to the next Towny day. Buttons that spend money show their own price too, so you know what
a claim, a teleport, or a plot costs before you click it.
- **Directories** — Browse and rank every town and nation by residents, claims, bank balance, distance, and more; visit,
join, donate, buy a town that is for sale, or propose alliances.
- **Invites** — Accept or decline town invites, nation invites for your town, and alliance requests in one place, or
Expand All @@ -58,7 +58,7 @@

| Dependency | Version |
|:-----------|:-----------|
| Paper | 26.2+ |
| Paper | 26.3+ |
| Java | 25+ |
| Towny | 0.103.2.7+ |

Expand All @@ -72,9 +72,9 @@ TownyMenu is an addon: Towny must be installed on the server, or TownyMenu will

The compiled JAR is placed in `build/libs/`. Run `./gradlew copyPlugin` to copy it, along with the matching Towny jar,
into `run/plugins/` for the local test server — any older copy of either is deleted first — or `./gradlew startServer`
to copy them and start the server. Before the
first start, download a Paper 26.2 jar from [papermc.io](https://papermc.io/downloads/paper) into `run/`, then accept
the EULA in `run/eula.txt` after the first launch.
to copy them and start the server. Before the first start, download a Paper 26.3 jar
from [papermc.io](https://papermc.io/downloads/paper) into `run/`, then accept the EULA in `run/eula.txt` after the
first launch.

Prebuilt jars are attached to every [GitHub release](https://github.com/TriBinary/TownyMenu/releases); see the
[change log](CHANGELOG.md) for what changed in each one.
Expand All @@ -94,14 +94,14 @@ All commands are sub-commands of `/townymenu` (alias `/tm`).

## Configuration

| Key | Default | Description |
|:---------------------------|:--------|:----------------------------------------------------------------------------|
| `message-prefix` | — | MiniMessage prefix shown before plugin messages |
| `language` | `auto` | `auto` follows each player's client language; `en_US` or `zh_CN` forces one |
| `sneak-swap-hand-shortcut` | `true` | Open the main menu by pressing swap-hand (F) while sneaking |
| `tutorial-join-hint` | `true` | Suggest the tutorial to players without a town when they join |
| `live-menu-refresh` | `true` | Update open menus when Towny changes what they show |
| `towny-alerts` | `true` | Announce invites, bankruptcy, and ruin in chat, linked to the right menu |
| Key | Default | Description |
|:---------------------------|:-----------------------|:----------------------------------------------------------------------------------------------|
| `message-prefix` | — | MiniMessage prefix shown before plugin messages |
| `language` | `auto` | `auto` follows each player's client language; `en_US` or `zh_CN` forces one |
| `sneak-swap-hand-shortcut` | `true` | Open the main menu by pressing swap-hand (F) while sneaking |
| `tutorial-join-hint` | `true` | Suggest the tutorial to players without a town when they join |
| `live-menu-refresh` | `true` | Update open menus when Towny changes what they show |
| `towny-alerts` | `true` | Announce invites, bankruptcy, and ruin in chat, linked to the right menu |
| `bank-amounts` | `10, 100, 1000, 10000` | Preset amounts the deposit and withdraw menus offer, alongside Everything and a custom amount |

## Translations
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ val serverPlugins: Configuration by configurations.creating {
}

dependencies {
compileOnly("io.papermc.paper:paper-api:26.2.build.+")
compileOnly("io.papermc.paper:paper-api:26.3.build.+")
compileOnly("com.palmergames.bukkit.towny:towny:${providers.gradleProperty("towny_version").get()}")
serverPlugins("com.palmergames.bukkit.towny:towny:${providers.gradleProperty("towny_version").get()}")
testImplementation(kotlin("test"))
Expand Down Expand Up @@ -91,7 +91,7 @@ tasks.register<JavaExec>("startServer") {
workingDir(layout.projectDirectory.dir("run"))
classpath(fileTree(layout.projectDirectory.dir("run")) { include("paper-*.jar") })
doFirst {
check(!classpath.isEmpty) { "No paper-*.jar in run/. Download Paper 26.2 from https://papermc.io/downloads/paper into run/." }
check(!classpath.isEmpty) { "No paper-*.jar in run/. Download Paper 26.3 from https://papermc.io/downloads/paper into run/." }
}
args("--nogui")
standardInput = System.`in`
Expand Down
Loading