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
@@ -189,7 +189,7 @@ final class BaseTeleportManager implements Listener {
public void onCommand(PlayerCommandPreprocessEvent event) {
String command = event.getMessage().toLowerCase(Locale.ROOT).split("\\s+", 2)[0];
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")) {
cancel(event.getPlayer(), "Base teleport cancelled by another teleport command.");
}
+3
View File
@@ -8,9 +8,11 @@ commands:
setbase:
description: Set your unlocked personal base.
usage: /setbase
aliases: [sethome]
base:
description: Teleport to or upgrade your base.
usage: /base [upgrade]
aliases: [home]
basenavigation:
description: Toggle particle navigation toward your base.
usage: /basenavigation [on|off]
@@ -23,6 +25,7 @@ commands:
gotobase:
description: Visit an available player base.
usage: /gotobase <player>
aliases: [visit]
baseprogress:
description: View progression or toggle progress boss bars.
usage: /baseprogress [bossbar]
@@ -4,11 +4,36 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.yaml.snakeyaml.Yaml;
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
void declaresPluginEntrypointCommandsAndPermissions() {
InputStream stream = getClass().getClassLoader().getResourceAsStream("plugin.yml");
@@ -30,4 +55,11 @@ final class PluginMetadataTest {
Map<?, ?> permissions = (Map<?, ?>) plugin.get("permissions");
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");
}
}