aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/command
diff options
context:
space:
mode:
authoringle <inglettronald@gmail.com>2022-10-02 21:52:11 -0500
committeringle <inglettronald@gmail.com>2022-10-02 21:52:11 -0500
commit830d3185f6c0c4ac14c957c03e982badb40fa053 (patch)
tree5cd0acc33220bda733373bb51e70988bf3cb9fa3 /src/main/kotlin/dulkirmod/command
parent0b4f2ae705585e3978c4f0e4acd2ca772d1d13d7 (diff)
downloadDulkirMod-830d3185f6c0c4ac14c957c03e982badb40fa053.tar.gz
DulkirMod-830d3185f6c0c4ac14c957c03e982badb40fa053.tar.bz2
DulkirMod-830d3185f6c0c4ac14c957c03e982badb40fa053.zip
Added chat confirmation for join-dungeon command
Diffstat (limited to 'src/main/kotlin/dulkirmod/command')
-rw-r--r--src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt
new file mode 100644
index 0000000..3e5405a
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt
@@ -0,0 +1,42 @@
+package dulkirmod.command
+
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import net.minecraft.client.Minecraft
+import net.minecraft.command.CommandException
+import net.minecraft.command.ICommandSender
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.EnumChatFormatting
+
+class JoinDungeonCommand : ClientCommandBase("joindungeon") {
+ @Throws(CommandException::class)
+ override fun processCommand(sender: ICommandSender, args: Array<String>) {
+ var arguments = args.contentToString().replace("[", "").replace("]", "").replace(",","")
+ println(arguments)
+ var type = ""
+ var num = ""
+ println(args[0])
+ if (args[0] == "master_catacombs") {
+ type = "M"
+ }
+ else if (args[0] == "catacombs") {
+ type = "F"
+ }
+
+ // Try statement so message is consistent if user gives bad input
+ try {
+ if (args[1].toInt() in 1..7) {
+ num = args[1]
+ }
+ } catch (e: NumberFormatException) { }
+
+ if(Config.dungeonCommandConfirm) {
+ mc.thePlayer.addChatMessage(
+ ChatComponentText(
+ EnumChatFormatting.GOLD.toString() + "" + EnumChatFormatting.BOLD + "Running command: $type$num"
+ )
+ )
+ }
+ mc.thePlayer.sendChatMessage("/joindungeon $arguments")
+ }
+} \ No newline at end of file