feat(commands): add base command aliases
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user