summaryrefslogtreecommitdiff
path: root/platform-paper
diff options
context:
space:
mode:
authorSho Sakuma <me@m1sk9.dev>2026-04-07 18:01:54 +0900
committerSho Sakuma <me@m1sk9.dev>2026-04-07 18:05:38 +0900
commit5d01be7d6d12848ed594bfa260034db8fec7882c (patch)
treeb05e2649314fbe671c9f8982f1c164c66dfc54a3 /platform-paper
parent94de4c68e0b29d6032cfbfecb23263d5c706b64f (diff)
downloadLunaticChat-5d01be7d6d12848ed594bfa260034db8fec7882c.tar.gz
LunaticChat-5d01be7d6d12848ed594bfa260034db8fec7882c.tar.bz2
LunaticChat-5d01be7d6d12848ed594bfa260034db8fec7882c.zip
feat(command): add subcommand aliases with tab completion support
Closes #173 Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'platform-paper')
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/ChannelCommand.kt202
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/LunaticChatCommand.kt45
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/SettingsCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/StatusCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelBanCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelCreateCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelDeleteCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInfoCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInviteCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelJoinCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelKickCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelLeaveCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelListCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelModCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelOwnershipCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelStatusCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelSwitchCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelUnbanCommand.kt3
-rw-r--r--platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt23
19 files changed, 181 insertions, 137 deletions
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/ChannelCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/ChannelCommand.kt
index 230a813..13c30dd 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/ChannelCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/ChannelCommand.kt
@@ -44,111 +44,111 @@ class ChannelCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("ch"))
+
@Permission(LunaticChatPermissionNode.Channel::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> {
val channelCommand = Commands.literal("channel")
- // Add subcommands
- channelCommand
- .then(
- ChannelCreateCommand(
- plugin,
- channelManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelListCommand(
- plugin,
- channelManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelJoinCommand(
- plugin,
- channelManager,
- membershipManager,
- notificationHandler,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelLeaveCommand(
- plugin,
- channelManager,
- membershipManager,
- notificationHandler,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelSwitchCommand(
- plugin,
- channelManager,
- membershipManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelStatusCommand(
- plugin,
- channelManager,
- membershipManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelInfoCommand(
- plugin,
- channelManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelDeleteCommand(
- plugin,
- channelManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelInviteCommand(
- plugin,
- channelManager,
- membershipManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelKickCommand(
- plugin,
- channelManager,
- membershipManager,
- notificationHandler,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelBanCommand(
- plugin,
- channelManager,
- membershipManager,
- notificationHandler,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelUnbanCommand(
- plugin,
- channelManager,
- membershipManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelModCommand(
- plugin,
- channelManager,
- membershipManager,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- ChannelOwnershipCommand(
- plugin,
- channelManager,
- membershipManager,
- languageManager,
- ).buildWithPermissionCheck(),
- )
+ // Add subcommands (with aliases)
+ ChannelCreateCommand(
+ plugin,
+ channelManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelListCommand(
+ plugin,
+ channelManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelJoinCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ notificationHandler,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelLeaveCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ notificationHandler,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelSwitchCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelStatusCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelInfoCommand(
+ plugin,
+ channelManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelDeleteCommand(
+ plugin,
+ channelManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelInviteCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelKickCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ notificationHandler,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelBanCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ notificationHandler,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelUnbanCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelModCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
+
+ ChannelOwnershipCommand(
+ plugin,
+ channelManager,
+ membershipManager,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { channelCommand.then(it) }
// Default help message when no subcommand is provided
channelCommand.executes { ctx ->
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/LunaticChatCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/LunaticChatCommand.kt
index cd3b33d..2be0128 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/LunaticChatCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/LunaticChatCommand.kt
@@ -34,36 +34,31 @@ class LunaticChatCommand(
get() = languageManager.getMessage("commandDescription.lc")
override fun buildCommand(): LiteralArgumentBuilder<CommandSourceStack> {
- val command =
- Commands
- .literal(name)
- .then(
- SettingsCommand(
- plugin,
- settingHandlerRegistry,
- languageManager,
- ).buildWithPermissionCheck(),
- ).then(
- StatusCommand(
- plugin,
- languageManager,
- configuration,
- ).buildWithPermissionCheck(),
- )
+ val command = Commands.literal(name)
+
+ SettingsCommand(
+ plugin,
+ settingHandlerRegistry,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { command.then(it) }
+
+ StatusCommand(
+ plugin,
+ languageManager,
+ configuration,
+ ).buildAllWithPermissionCheck().forEach { command.then(it) }
// Add channel command if channel manager is available
plugin.channelManager?.let { manager ->
plugin.channelMembershipManager?.let { membershipManager ->
plugin.channelNotificationHandler?.let { notificationHandler ->
- command.then(
- ChannelCommand(
- plugin,
- manager,
- membershipManager,
- notificationHandler,
- languageManager,
- ).buildWithPermissionCheck(),
- )
+ ChannelCommand(
+ plugin,
+ manager,
+ membershipManager,
+ notificationHandler,
+ languageManager,
+ ).buildAllWithPermissionCheck().forEach { command.then(it) }
}
}
}
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/SettingsCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/SettingsCommand.kt
index 9cd6645..bf5a245 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/SettingsCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/SettingsCommand.kt
@@ -39,6 +39,9 @@ class SettingsCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("set"))
+
/**
* Builds the setting subcommand structure.
* For each registered setting key, creates:
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/StatusCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/StatusCommand.kt
index 0e35205..1f75cf2 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/StatusCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/StatusCommand.kt
@@ -29,6 +29,9 @@ class StatusCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("st"))
+
@Permission(LunaticChatPermissionNode.Status::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands.literal("status").executes { ctx ->
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelBanCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelBanCommand.kt
index 5a6b52f..67a4a5d 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelBanCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelBanCommand.kt
@@ -35,6 +35,9 @@ class ChannelBanCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), emptyList())
+
@Permission(LunaticChatPermissionNode.ChannelBan::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelCreateCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelCreateCommand.kt
index fa97a46..8f93261 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelCreateCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelCreateCommand.kt
@@ -29,6 +29,9 @@ class ChannelCreateCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("new"))
+
@Permission(LunaticChatPermissionNode.ChannelCreate::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelDeleteCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelDeleteCommand.kt
index f39d8e8..9632d30 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelDeleteCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelDeleteCommand.kt
@@ -28,6 +28,9 @@ class ChannelDeleteCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("del"))
+
@Permission(LunaticChatPermissionNode.ChannelDelete::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInfoCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInfoCommand.kt
index fc32f9b..212f3dc 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInfoCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInfoCommand.kt
@@ -33,6 +33,9 @@ class ChannelInfoCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("i"))
+
@Permission(LunaticChatPermissionNode.ChannelInfo::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInviteCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInviteCommand.kt
index 37c8d7a..b6c0de3 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInviteCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelInviteCommand.kt
@@ -33,6 +33,9 @@ class ChannelInviteCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("inv"))
+
@Permission(LunaticChatPermissionNode.ChannelInvite::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelJoinCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelJoinCommand.kt
index 2edb0da..e5433eb 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelJoinCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelJoinCommand.kt
@@ -38,6 +38,9 @@ class ChannelJoinCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("j"))
+
@Permission(LunaticChatPermissionNode.ChannelJoin::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelKickCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelKickCommand.kt
index 452c48d..d4dd103 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelKickCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelKickCommand.kt
@@ -33,6 +33,9 @@ class ChannelKickCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("k"))
+
@Permission(LunaticChatPermissionNode.ChannelKick::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelLeaveCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelLeaveCommand.kt
index d763853..47556bf 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelLeaveCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelLeaveCommand.kt
@@ -30,6 +30,9 @@ class ChannelLeaveCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("l"))
+
@Permission(LunaticChatPermissionNode.ChannelLeave::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands.literal("leave").executes { ctx ->
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelListCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelListCommand.kt
index c0df8bf..daa060b 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelListCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelListCommand.kt
@@ -35,6 +35,9 @@ class ChannelListCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("ls"))
+
@Permission(LunaticChatPermissionNode.ChannelList::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelModCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelModCommand.kt
index a368abb..9a29c75 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelModCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelModCommand.kt
@@ -31,6 +31,9 @@ class ChannelModCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), emptyList())
+
@Permission(LunaticChatPermissionNode.ChannelMod::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelOwnershipCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelOwnershipCommand.kt
index 6724052..59ee5c0 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelOwnershipCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelOwnershipCommand.kt
@@ -31,6 +31,9 @@ class ChannelOwnershipCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("own"))
+
@Permission(LunaticChatPermissionNode.ChannelOwnership::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelStatusCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelStatusCommand.kt
index 7fb41c6..8a4400b 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelStatusCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelStatusCommand.kt
@@ -38,6 +38,9 @@ class ChannelStatusCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("st"))
+
@Permission(LunaticChatPermissionNode.ChannelStatus::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands.literal("status").executes { ctx ->
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelSwitchCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelSwitchCommand.kt
index 6f8cc8f..b5bd18d 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelSwitchCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelSwitchCommand.kt
@@ -31,6 +31,9 @@ class ChannelSwitchCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), listOf("sw"))
+
@Permission(LunaticChatPermissionNode.ChannelSwitch::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelUnbanCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelUnbanCommand.kt
index 043ca01..2bde39f 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelUnbanCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lc/channel/ChannelUnbanCommand.kt
@@ -32,6 +32,9 @@ class ChannelUnbanCommand(
return applyMethodPermission("build", builder)
}
+ fun buildAllWithPermissionCheck(): List<LiteralArgumentBuilder<CommandSourceStack>> =
+ withAliases(buildWithPermissionCheck(), emptyList())
+
@Permission(LunaticChatPermissionNode.ChannelUnban::class)
fun build(): LiteralArgumentBuilder<CommandSourceStack> =
Commands
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt
index 6c0596e..2c81197 100644
--- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt
+++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/command/impl/lcv/VelocityStatusCommand.kt
@@ -37,18 +37,19 @@ class VelocityStatusCommand(
override val description: String
get() = languageManager.getMessage("commandDescription.lcv")
- override fun buildCommand(): LiteralArgumentBuilder<CommandSourceStack> =
- Commands
+ override fun buildCommand(): LiteralArgumentBuilder<CommandSourceStack> {
+ val statusExecutor =
+ com.mojang.brigadier.Command<CommandSourceStack> { ctx ->
+ val context = wrapContext(ctx)
+ val result = execute(context)
+ handleResult(context, result)
+ }
+
+ return Commands
.literal(name)
- .then(
- Commands
- .literal("status")
- .executes { ctx ->
- val context = wrapContext(ctx)
- val result = execute(context)
- handleResult(context, result)
- },
- )
+ .then(Commands.literal("status").executes(statusExecutor))
+ .then(Commands.literal("st").executes(statusExecutor))
+ }
private fun execute(ctx: CommandContext): CommandResult {
val sender = ctx.sender