diff options
author | Appability <appable@icloud.com> | 2022-11-12 23:39:20 -0800 |
---|---|---|
committer | Appability <appable@icloud.com> | 2022-11-12 23:39:20 -0800 |
commit | 129cb8b04c7ae239ffd2546e8e48e19506b9f4d1 (patch) | |
tree | 1a8f09b58efd609d0a0de6ca0718ef4a31237d4b /src/main/kotlin/com | |
parent | 21a3f8f1ed7230655cfe2f1e93b8edb14a2a21d0 (diff) | |
download | AmbientAddons-129cb8b04c7ae239ffd2546e8e48e19506b9f4d1.tar.gz AmbientAddons-129cb8b04c7ae239ffd2546e8e48e19506b9f4d1.tar.bz2 AmbientAddons-129cb8b04c7ae239ffd2546e8e48e19506b9f4d1.zip |
clean up help/usage messages
Diffstat (limited to 'src/main/kotlin/com')
6 files changed, 52 insertions, 23 deletions
diff --git a/src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt b/src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt index 3d62954..ca5631c 100644 --- a/src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt +++ b/src/main/kotlin/com/ambientaddons/commands/AmbientCommand.kt @@ -3,6 +3,7 @@ package com.ambientaddons.commands import AmbientAddons import AmbientAddons.Companion.mc import com.ambientaddons.config.Config +import com.ambientaddons.utils.Chat import com.ambientaddons.utils.Extensions.withModPrefix import com.ambientaddons.utils.SBLocation import gg.essential.universal.UChat @@ -25,15 +26,13 @@ class AmbientCommand : CommandBase() { "buy" -> AutoBuyCommand.processCommand(args.drop(1)) "salvage" -> SalvageCommand.processCommand(args.drop(1)) else -> { - val chatWidth = mc.ingameGUI?.chatGUI?.chatWidth ?: return - val chatBreak = "§9§m" + "-".repeat(chatWidth / mc.fontRendererObj.getStringWidth("-")) UChat.chat(""" - $chatBreak + ${Chat.getChatBreak()} §b§lUsage: §a/ambient §eto access GUI settings. §a/ambient buy §eto edit autobuy list. §a/ambient salvage §eto configure salvage features. - $chatBreak + ${Chat.getChatBreak()} """.trimIndent()) } } diff --git a/src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt b/src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt index 538485c..1cead71 100644 --- a/src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt +++ b/src/main/kotlin/com/ambientaddons/commands/AutoBuyCommand.kt @@ -1,6 +1,7 @@ package com.ambientaddons.commands import AmbientAddons.Companion.persistentData +import com.ambientaddons.utils.Chat import com.ambientaddons.utils.Extensions.withModPrefix import gg.essential.universal.UChat @@ -33,10 +34,14 @@ object AutoBuyCommand { } } 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") + UChat.chat(""" + ${Chat.getChatBreak()} + §b§lUsage: + §a/ambient buy add <Skyblock ID> [max price] §eto add an item. + §a/ambient buy remove <Skyblock ID> §eto remove an item. + §a/ambient buy list §eto view current autobuy list + ${Chat.getChatBreak()} + """.trimIndent()) } } } diff --git a/src/main/kotlin/com/ambientaddons/commands/SalvageCommand.kt b/src/main/kotlin/com/ambientaddons/commands/SalvageCommand.kt index 0d11e79..d5390b4 100644 --- a/src/main/kotlin/com/ambientaddons/commands/SalvageCommand.kt +++ b/src/main/kotlin/com/ambientaddons/commands/SalvageCommand.kt @@ -1,6 +1,7 @@ package com.ambientaddons.commands import AmbientAddons.Companion.persistentData +import com.ambientaddons.utils.Chat import com.ambientaddons.utils.Extensions.withModPrefix import com.ambientaddons.utils.SalvageStrategy import gg.essential.universal.UChat @@ -20,27 +21,43 @@ object SalvageCommand { persistentData.save() UChat.chat((if (allowed) "§aAllowing item §a§l${item}." else "§cItem already allowed.").withModPrefix()) } + "block" -> { + val item = args[1] + val blocked = persistentData.salvageMap.put(item, SalvageStrategy.Block) != SalvageStrategy.Block + persistentData.save() + UChat.chat((if (blocked) "§aBlocking item §a§l${item}." else "§cItem already blocked.").withModPrefix()) + } "remove" -> { val item = args[1] val removed = persistentData.salvageMap.remove(item) != null persistentData.save() - UChat.chat((if (removed) "§aRemoving item §a§l${item}." else "§cItem not in list.").withModPrefix()) + UChat.chat((if (removed) "§aRemoved item §a§l${item}." else "§cItem not in list.").withModPrefix()) } "list" -> { - UChat.chat("§2§lItems §7(§aalways salvage, §callow salvaging§7)".withModPrefix()) + UChat.chat("§2§lItems §7(§aalways salvage, §eallow salvaging, §cblock salvaging§7)".withModPrefix()) persistentData.salvageMap.forEach { - if (it.value == SalvageStrategy.Always) { - UChat.chat(" §a${it.key}") - } else { - UChat.chat(" §e${it.key}") + when (it.value) { + SalvageStrategy.Always -> UChat.chat(" §a${it.key}") + SalvageStrategy.Allow -> UChat.chat(" §e${it.key}") + else -> UChat.chat(" §c${it.key}") } } } else -> { - UChat.chat("§2§lUsage".withModPrefix()) - UChat.chat(" §aAlways salvage item: §b/ambient salvage auto <Skyblock ID>") - UChat.chat(" §aAllow salvaging item: §b/ambient salvage allow <Skyblock ID>") - UChat.chat(" §aBlock salvaging item: §b/ambient remove <Skyblock ID>") + UChat.chat(""" + ${Chat.getChatBreak()} + §b§lUsage: + §a/ambient salvage auto <Skyblock ID> §eto always salvage an item. + §a/ambient salvage allow <Skyblock ID> §eto allow salvaging an item. + §a/ambient salvage block <Skyblock ID> §eto block salvaging an item. + §a/ambient salvage remove <Skyblock ID> §eto remove an item. + §a/ambient salvage list §eto view current salvage list. + + §b§lNotes: + §eSome items are explicitly blocked due to past item quality bugs. + §eIf not blocked in list, this will salvage all dungeon mob drops unless starred. + ${Chat.getChatBreak()} + """.trimIndent()) } } } diff --git a/src/main/kotlin/com/ambientaddons/features/misc/Welcome.kt b/src/main/kotlin/com/ambientaddons/features/misc/Welcome.kt index ac99025..70d4556 100644 --- a/src/main/kotlin/com/ambientaddons/features/misc/Welcome.kt +++ b/src/main/kotlin/com/ambientaddons/features/misc/Welcome.kt @@ -2,6 +2,7 @@ package com.ambientaddons.features.misc import AmbientAddons.Companion.mc import AmbientAddons.Companion.persistentData +import com.ambientaddons.utils.Chat import com.ambientaddons.utils.SBLocation import gg.essential.universal.UChat import net.minecraftforge.event.world.WorldEvent @@ -14,12 +15,10 @@ object Welcome { @SubscribeEvent fun onTick(event: ClientTickEvent) { if (!persistentData.isFirstLoad || event.phase != TickEvent.Phase.START || !SBLocation.inSkyblock) return - val chatWidth = mc.ingameGUI?.chatGUI?.chatWidth ?: return persistentData.isFirstLoad = false persistentData.save() - val chatBreak = "§9§m" + "-".repeat(chatWidth / mc.fontRendererObj.getStringWidth("-")) UChat.chat(""" - $chatBreak + ${Chat.getChatBreak()} §b§lThanks for installing AmbientAddons Forge! §eUse §a§l/ambient §r§eto access GUI settings. @@ -27,7 +26,7 @@ object Welcome { §eTo configure auto-buy, use §a/ambient buy§e. §eTo configure salvage features, use §a/ambient salvage§e. - $chatBreak + ${Chat.getChatBreak()} """.trimIndent()) } }
\ No newline at end of file diff --git a/src/main/kotlin/com/ambientaddons/utils/Chat.kt b/src/main/kotlin/com/ambientaddons/utils/Chat.kt new file mode 100644 index 0000000..10d263b --- /dev/null +++ b/src/main/kotlin/com/ambientaddons/utils/Chat.kt @@ -0,0 +1,9 @@ +package com.ambientaddons.utils + +import AmbientAddons.Companion.mc + +object Chat { + fun getChatBreak(): String = mc.ingameGUI?.chatGUI?.chatWidth?.let { + "§9§m" + "-".repeat(it / mc.fontRendererObj.getStringWidth("-")) + } ?: "" +} diff --git a/src/main/kotlin/com/ambientaddons/utils/Extensions.kt b/src/main/kotlin/com/ambientaddons/utils/Extensions.kt index 62c8c37..21584ce 100644 --- a/src/main/kotlin/com/ambientaddons/utils/Extensions.kt +++ b/src/main/kotlin/com/ambientaddons/utils/Extensions.kt @@ -32,7 +32,7 @@ object Extensions { ?: "" } - fun String.withModPrefix(): String = "§9§lAmbient §7» §r${this}" + fun String.withModPrefix(): String = "§b§lAmbient §7» §r${this}" fun String.renderWidth(): Int = mc.fontRendererObj.getStringWidth(this) |