-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use Brigadier command logic
- Loading branch information
Showing
4 changed files
with
47 additions
and
78 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
core/src/main/kotlin/com/mineinabyss/emojy/EmojyBrigadierCommands.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.mineinabyss.emojy | ||
|
||
import com.mineinabyss.idofront.commands.brigadier.commands | ||
import com.mineinabyss.idofront.messaging.success | ||
import com.mineinabyss.idofront.textcomponents.miniMsg | ||
import net.kyori.adventure.text.Component | ||
import org.bukkit.entity.Player | ||
|
||
object EmojyBrigadierCommands { | ||
|
||
fun registerCommands() { | ||
emojy.plugin.commands { | ||
"emojy" { | ||
"list" { | ||
executes { | ||
val emotes = emojy.emotes.filter { it.checkPermission(sender as? Player) && it !in emojyConfig.emojyList.ignoredEmotes }.toSet() | ||
val gifs = emojy.gifs.filter { it.checkPermission(sender as? Player) && it !in emojyConfig.emojyList.ignoredGifs }.toSet() | ||
|
||
val emoteList = when (sender) { | ||
is Player -> Component.textOfChildren(*emotes.map { it.formattedUnicode(true) }.toTypedArray()) | ||
else -> emotes.joinToString(", ") { it.id }.miniMsg() | ||
} | ||
|
||
val gifList = when (sender) { | ||
is Player -> Component.textOfChildren(*gifs.map { it.formattedUnicode(true) }.toTypedArray()) | ||
else -> gifs.joinToString(", ") { it.id }.miniMsg() | ||
} | ||
|
||
sender.sendRichMessage("<green>List of emojis:") | ||
sender.sendMessage(emoteList) | ||
sender.sendRichMessage("<#f35444>List of GIFs") | ||
sender.sendMessage(gifList) | ||
} | ||
} | ||
"reload" { | ||
executes { | ||
emojy.plugin.createEmojyContext() | ||
EmojyGenerator.generateResourcePack() | ||
sender.success("Emojy has been reloaded!") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
75 changes: 0 additions & 75 deletions
75
core/src/main/kotlin/com/mineinabyss/emojy/EmojyCommands.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
group=com.mineinabyss | ||
version=0.9 | ||
idofrontVersion=0.24.0 | ||
idofrontVersion=0.24.5 |