aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/commands
diff options
context:
space:
mode:
authorAppability <appable@icloud.com>2022-10-11 23:59:37 -0700
committerAppability <appable@icloud.com>2022-10-11 23:59:37 -0700
commit2c0e73deb53f54d78bd5594786313ac82151be1a (patch)
tree97fc2f389cc99d8f9e078a1cd7b0c6a5859a3f34 /src/main/kotlin/com/ambientaddons/commands
parent363b2426f8d9e45e52c472750c798dcaceb05a88 (diff)
downloadAmbientAddons-2c0e73deb53f54d78bd5594786313ac82151be1a.tar.gz
AmbientAddons-2c0e73deb53f54d78bd5594786313ac82151be1a.tar.bz2
AmbientAddons-2c0e73deb53f54d78bd5594786313ac82151be1a.zip
added chest qol features (complete, i think)
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/commands')
-rw-r--r--src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt28
-rw-r--r--src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt43
2 files changed, 71 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt b/src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt
new file mode 100644
index 0000000..5bfd92b
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt
@@ -0,0 +1,28 @@
+package com.ambientaddons.commands
+
+import AmbientAddons
+import com.ambientaddons.config.Config
+import com.ambientaddons.utils.Extensions.withModPrefix
+import com.ambientaddons.utils.LocationUtils
+import gg.essential.universal.UChat
+import net.minecraft.command.CommandBase
+import net.minecraft.command.ICommandSender
+
+class AmbientCommand : CommandBase() {
+ override fun getCommandName() = "ambientaddons"
+
+ override fun getCommandAliases() = listOf("aa")
+
+ override fun getCommandUsage(sender: ICommandSender?) = "/$commandName"
+
+ override fun getRequiredPermissionLevel() = 0
+
+ override fun processCommand(sender: ICommandSender?, args: Array<String>) {
+ when (args.getOrNull(0)) {
+ null -> AmbientAddons.currentGui = Config.gui()
+ "location" -> UChat.chat(LocationUtils.toString().withModPrefix())
+ "buy" -> AutoBuyCommand.processCommand(args.drop(1))
+ else -> UChat.chat("§cUnknown argument!")
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt b/src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt
new file mode 100644
index 0000000..c7ff9a7
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt
@@ -0,0 +1,43 @@
+package com.ambientaddons.commands
+
+import AmbientAddons.Companion.persistentData
+import com.ambientaddons.utils.Extensions.withModPrefix
+import gg.essential.universal.UChat
+
+object AutoBuyCommand {
+ fun processCommand(args: List<String>) {
+ when (args.getOrNull(0)) {
+ "add" -> {
+ val item = args[1]
+ val newPrice = args.getOrNull(2)?.toIntOrNull()
+ persistentData.autoBuyItems[item] = newPrice
+ persistentData.save()
+ UChat.chat("§aAdded item §a§l$item §awith ${if (newPrice == null) "no minimum price." else " minimum price §a§l$newPrice"}".withModPrefix())
+ }
+ "remove" -> {
+ val item = args[1]
+ if (persistentData.autoBuyItems.contains(item)) {
+ persistentData.autoBuyItems.remove(item)
+ persistentData.save()
+ UChat.chat("§aRemoved item §a§l$item.".withModPrefix())
+ } else UChat.chat("§cItem §a§l$item does not exist!".withModPrefix())
+ }
+ "list" -> {
+ UChat.chat("§2§lItems".withModPrefix())
+ persistentData.autoBuyItems.forEach {
+ if (it.value == null) {
+ UChat.chat(" §b${it.key}")
+ } else {
+ UChat.chat(" §b${it.key} §7(max price §a${it.value} §7coins)")
+ }
+ }
+ }
+ else -> {
+ UChat.chat("§2§lUsage".withModPrefix())
+ UChat.chat(" §aAdd item: §b/ambient buy add <Skyblock ID> [max allowable price]")
+ UChat.chat(" §aRemove item: §b/ambient buy remove <Skyblock ID>")
+ UChat.chat(" §aList: §b/ambient buy list")
+ }
+ }
+ }
+} \ No newline at end of file