feat(commands): add base command aliases
Release / release (push) Successful in 2m21s
CI / build (push) Successful in 53s

This commit is contained in:
dmg
2026-08-10 19:58:09 -04:00
parent 84e013ac11
commit 00aa7566ad
8 changed files with 49 additions and 5 deletions
+4 -4
View File
@@ -22,13 +22,13 @@ The plugin JAR is written to `build/libs/`.
## Player commands ## Player commands
```text ```text
/setbase /setbase (alias: /sethome)
/base /base (alias: /home)
/base upgrade /base upgrade (alias: /home upgrade)
/basenavigation /basenavigation
/baseflight /baseflight
/basevisitors /basevisitors
/gotobase <player> /gotobase <player> (alias: /visit <player>)
/baseprogress /baseprogress
/baseprogress bossbar /baseprogress bossbar
``` ```
+6
View File
@@ -40,3 +40,9 @@ description: Chronological record of material decisions affecting the Spigot Bas
- Made progression materials, visitor currency, boss-bar duration, particle count, and title timing configurable. - Made progression materials, visitor currency, boss-bar duration, particle count, and title timing configurable.
- Preserved unknown forward-compatible YAML fields for retained player records while continuing to reject invalid progression state. - Preserved unknown forward-compatible YAML fields for retained player records while continuing to reject invalid progression state.
- Completed and verified all approved user stories with the automated Gradle check lifecycle. - Completed and verified all approved user stories with the automated Gradle check lifecycle.
## 2026-08-10 — Player command aliases
- Added `/sethome` for `/setbase`, `/home` for `/base`, and `/visit` for `/gotobase`.
- Visitor autocomplete remains available for eligible offline bases through the `/visit` alias.
- Verified the aliases and plugin build with `./gradlew clean check jar`.
@@ -17,6 +17,7 @@ As a **player**, I want to earn and set a personal base so that later quality-of
- [x] Player-placed blocks may contribute when broken; natural-generation detection is not required. - [x] Player-placed blocks may contribute when broken; natural-generation detection is not required.
- [x] Base I unlocks when the player reaches the configured threshold, which defaults to 250 qualifying blocks. - [x] Base I unlocks when the player reaches the configured threshold, which defaults to 250 qualifying blocks.
- [x] `/setbase` is unavailable before Base I and explains the unmet requirement. - [x] `/setbase` is unavailable before Base I and explains the unmet requirement.
- [x] `/sethome` is an alias for `/setbase` with identical behavior.
- [x] After Base I unlocks, `/setbase` records the player's current world and block location as the center of a cylindrical base. - [x] After Base I unlocks, `/setbase` records the player's current world and block location as the center of a cylindrical base.
- [x] The initial cylinder has a configurable 10-block horizontal radius and extends a configurable 25 blocks above and 25 blocks below the set Y coordinate. - [x] The initial cylinder has a configurable 10-block horizontal radius and extends a configurable 25 blocks above and 25 blocks below the set Y coordinate.
- [x] The first successful `/setbase` is immediately available. - [x] The first successful `/setbase` is immediately available.
@@ -15,6 +15,7 @@ As a **player with Base II**, I want to earn `/base` so that I can return safely
- [x] Only placements made in Survival mode and within the base's current horizontal and vertical bounds count. - [x] Only placements made in Survival mode and within the base's current horizontal and vertical bounds count.
- [x] Player-placed blocks and replacement of previously broken blocks may contribute repeatedly. - [x] Player-placed blocks and replacement of previously broken blocks may contribute repeatedly.
- [x] Base III unlocks `/base` with a configurable 30-second warm-up and three-hour cooldown by default. - [x] Base III unlocks `/base` with a configurable 30-second warm-up and three-hour cooldown by default.
- [x] `/home` is an alias for `/base`, including `/home upgrade`.
- [x] Looking around without changing block coordinates does not cancel the warm-up. - [x] Looking around without changing block coordinates does not cancel the warm-up.
- [x] Changing block X, Y, or Z, taking damage, teleporting, changing worlds, dying, disconnecting, or starting a conflicting teleport cancels the warm-up. - [x] Changing block X, Y, or Z, taking damage, teleporting, changing worlds, dying, disconnecting, or starting a conflicting teleport cancels the warm-up.
- [x] Cancellation clearly informs the player and does not consume the cooldown. - [x] Cancellation clearly informs the player and does not consume the cooldown.
@@ -18,6 +18,7 @@ As a **player with Base III**, I want to open my base to visitors so that other
- [x] `/basevisitors` lets a Base IV owner toggle visitor access on and off. - [x] `/basevisitors` lets a Base IV owner toggle visitor access on and off.
- [x] The visitor-access preference persists across reconnects and restarts. - [x] The visitor-access preference persists across reconnects and restarts.
- [x] `/gotobase <owner>` autocompletes bases that the requesting player is currently eligible to visit. - [x] `/gotobase <owner>` autocompletes bases that the requesting player is currently eligible to visit.
- [x] `/visit <owner>` aliases `/gotobase <owner>` with identical autocomplete, including eligible bases whose owners are offline.
- [x] Enabled bases remain visitable while their owners are offline. - [x] Enabled bases remain visitable while their owners are offline.
- [x] A visitor teleport uses the destination owner's current warm-up tier. - [x] A visitor teleport uses the destination owner's current warm-up tier.
- [x] Looking around is permitted, while movement between block coordinates, damage, teleportation, world change, death, logout, or a conflicting teleport cancels the visitor warm-up. - [x] Looking around is permitted, while movement between block coordinates, damage, teleportation, world change, death, logout, or a conflicting teleport cancels the visitor warm-up.
@@ -189,7 +189,7 @@ final class BaseTeleportManager implements Listener {
public void onCommand(PlayerCommandPreprocessEvent event) { public void onCommand(PlayerCommandPreprocessEvent event) {
String command = event.getMessage().toLowerCase(Locale.ROOT).split("\\s+", 2)[0]; String command = event.getMessage().toLowerCase(Locale.ROOT).split("\\s+", 2)[0];
if (command.equals("/base") || command.equals("/gotobase") if (command.equals("/base") || command.equals("/gotobase")
|| command.equals("/spawn") || command.equals("/home") || command.equals("/visit") || command.equals("/spawn") || command.equals("/home")
|| command.equals("/tp") || command.equals("/teleport")) { || command.equals("/tp") || command.equals("/teleport")) {
cancel(event.getPlayer(), "Base teleport cancelled by another teleport command."); cancel(event.getPlayer(), "Base teleport cancelled by another teleport command.");
} }
+3
View File
@@ -8,9 +8,11 @@ commands:
setbase: setbase:
description: Set your unlocked personal base. description: Set your unlocked personal base.
usage: /setbase usage: /setbase
aliases: [sethome]
base: base:
description: Teleport to or upgrade your base. description: Teleport to or upgrade your base.
usage: /base [upgrade] usage: /base [upgrade]
aliases: [home]
basenavigation: basenavigation:
description: Toggle particle navigation toward your base. description: Toggle particle navigation toward your base.
usage: /basenavigation [on|off] usage: /basenavigation [on|off]
@@ -23,6 +25,7 @@ commands:
gotobase: gotobase:
description: Visit an available player base. description: Visit an available player base.
usage: /gotobase <player> usage: /gotobase <player>
aliases: [visit]
baseprogress: baseprogress:
description: View progression or toggle progress boss bars. description: View progression or toggle progress boss bars.
usage: /baseprogress [bossbar] usage: /baseprogress [bossbar]
@@ -4,11 +4,36 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.InputStream; import java.io.InputStream;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
final class PluginMetadataTest { final class PluginMetadataTest {
@Test
void sethomeAliasesSetbase() {
Map<?, ?> commands = commands();
Map<?, ?> setbase = (Map<?, ?>) commands.get("setbase");
assertEquals(List.of("sethome"), setbase.get("aliases"));
}
@Test
void homeAliasesBase() {
Map<?, ?> commands = commands();
Map<?, ?> base = (Map<?, ?>) commands.get("base");
assertEquals(List.of("home"), base.get("aliases"));
}
@Test
void visitAliasesGotobase() {
Map<?, ?> commands = commands();
Map<?, ?> gotobase = (Map<?, ?>) commands.get("gotobase");
assertEquals(List.of("visit"), gotobase.get("aliases"));
}
@Test @Test
void declaresPluginEntrypointCommandsAndPermissions() { void declaresPluginEntrypointCommandsAndPermissions() {
InputStream stream = getClass().getClassLoader().getResourceAsStream("plugin.yml"); InputStream stream = getClass().getClassLoader().getResourceAsStream("plugin.yml");
@@ -30,4 +55,11 @@ final class PluginMetadataTest {
Map<?, ?> permissions = (Map<?, ?>) plugin.get("permissions"); Map<?, ?> permissions = (Map<?, ?>) plugin.get("permissions");
assertNotNull(permissions.get("spigotbase.admin")); assertNotNull(permissions.get("spigotbase.admin"));
} }
private Map<?, ?> commands() {
InputStream stream = getClass().getClassLoader().getResourceAsStream("plugin.yml");
assertNotNull(stream);
Map<?, ?> plugin = new Yaml().load(stream);
return (Map<?, ?>) plugin.get("commands");
}
} }