Skip to content

Commit caf4032

Browse files
committed
Added assigning aliases for Cooldown module.
1 parent 018f45c commit caf4032

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/projectessentialsspawn/commands/SetSpawnCommand.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.mairwunnx.projectessentials.projectessentialsspawn.commands
22

33
import com.mairwunnx.projectessentials.projectessentialsspawn.models.SpawnModelBase
4+
import com.mairwunnx.projectessentialscooldown.essentials.CommandsAliases
45
import com.mairwunnx.projectessentialscore.extensions.isPlayerSender
56
import com.mairwunnx.projectessentialscore.extensions.sendMsg
67
import 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()

src/main/kotlin/com/mairwunnx/projectessentials/projectessentialsspawn/commands/SpawnCommand.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.mairwunnx.projectessentials.projectessentialsspawn.commands
22

33
import com.mairwunnx.projectessentials.projectessentialsspawn.EntryPoint
44
import com.mairwunnx.projectessentials.projectessentialsspawn.models.SpawnModelBase
5+
import com.mairwunnx.projectessentialscooldown.essentials.CommandsAliases
56
import com.mairwunnx.projectessentialscore.extensions.isPlayerSender
67
import com.mairwunnx.projectessentialscore.extensions.sendMsg
78
import 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 {

0 commit comments

Comments
 (0)