File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
src/main/kotlin/com/mairwunnx/projectessentials/projectessentialsspawn/commands Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 11package com.mairwunnx.projectessentials.projectessentialsspawn.commands
22
33import com.mairwunnx.projectessentials.projectessentialsspawn.models.SpawnModelBase
4+ import com.mairwunnx.projectessentialscooldown.essentials.CommandsAliases
45import com.mairwunnx.projectessentialscore.extensions.isPlayerSender
56import com.mairwunnx.projectessentialscore.extensions.sendMsg
67import com.mairwunnx.projectessentialscore.helpers.ONLY_PLAYER_CAN
@@ -30,6 +31,18 @@ object SetSpawnCommand {
3031 }
3132 }
3233
34+ private fun applyCommandAliases () {
35+ try {
36+ Class .forName(
37+ " com.mairwunnx.projectessentialscooldown.essentials.CommandsAliases"
38+ )
39+ CommandsAliases .aliases[" setspawn" ] = aliases.toMutableList()
40+ logger.info(" - applying aliases: $aliases " )
41+ } catch (_: ClassNotFoundException ) {
42+ // ignored
43+ }
44+ }
45+
3346 private fun execute (c : CommandContext <CommandSource >): Int {
3447 if (c.isPlayerSender()) {
3548 val player = c.source.asPlayer()
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package com.mairwunnx.projectessentials.projectessentialsspawn.commands
22
33import com.mairwunnx.projectessentials.projectessentialsspawn.EntryPoint
44import com.mairwunnx.projectessentials.projectessentialsspawn.models.SpawnModelBase
5+ import com.mairwunnx.projectessentialscooldown.essentials.CommandsAliases
56import com.mairwunnx.projectessentialscore.extensions.isPlayerSender
67import com.mairwunnx.projectessentialscore.extensions.sendMsg
78import com.mairwunnx.projectessentialscore.helpers.ONLY_PLAYER_CAN
@@ -41,6 +42,19 @@ object SpawnCommand {
4142 )
4243 )
4344 }
45+ applyCommandAliases()
46+ }
47+
48+ private fun applyCommandAliases () {
49+ try {
50+ Class .forName(
51+ " com.mairwunnx.projectessentialscooldown.essentials.CommandsAliases"
52+ )
53+ CommandsAliases .aliases[" spawn" ] = aliases.toMutableList()
54+ logger.info(" - applying aliases: $aliases " )
55+ } catch (_: ClassNotFoundException ) {
56+ // ignored
57+ }
4458 }
4559
4660 private fun execute (c : CommandContext <CommandSource >): Int {
You can’t perform that action at this time.
0 commit comments