aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt6
-rw-r--r--src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt42
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt21
-rw-r--r--src/main/kotlin/dulkirmod/features/NametagCleaner.kt2
4 files changed, 63 insertions, 8 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index c6e765b..2647d9f 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -1,9 +1,6 @@
package dulkirmod
-import dulkirmod.command.EnchantRuneCommand
-import dulkirmod.command.FairyCommand
-import dulkirmod.command.HelpCommand
-import dulkirmod.command.SettingsCommand
+import dulkirmod.command.*
import dulkirmod.config.Config
import dulkirmod.events.ChatEvent
import dulkirmod.features.NametagCleaner
@@ -50,6 +47,7 @@ class DulkirMod {
ClientCommandHandler.instance.registerCommand(EnchantRuneCommand())
ClientCommandHandler.instance.registerCommand(FairyCommand())
ClientCommandHandler.instance.registerCommand(SettingsCommand())
+ ClientCommandHandler.instance.registerCommand(JoinDungeonCommand())
}
@Mod.EventHandler
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
diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt
index a409d91..f472ee1 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -10,7 +10,7 @@ import java.awt.Color
import java.io.File
import java.util.function.Consumer
-object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod") {
+object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", sortingBehavior = ConfigSorting) {
@Property(
type = PropertyType.SWITCH,
@@ -203,6 +203,15 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod") {
customSpeed = 0f
}
+ // CUSTOM ANIMATIONS
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "JoinDungeon Command Confirmation",
+ description = "Chat notification when you push the button. Useful if you suck at navigating a numpad.",
+ category = "General"
+ )
+ var dungeonCommandConfirm = false
+
fun init() {
initialize()
@@ -213,5 +222,13 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod") {
"All settings that are related to custom animations. Mostly help from Aton."
)
}
-
+ private object ConfigSorting : SortingBehavior() {
+ override fun getCategoryComparator(): Comparator<in Category> = Comparator { o1, o2 ->
+ if (o1.name == "General") return@Comparator -1
+ if (o2.name == "General") return@Comparator 1
+ else compareValuesBy(o1, o2) {
+ it.name
+ }
+ }
+ }
}
diff --git a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt
index b1557c9..234aa6d 100644
--- a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt
+++ b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt
@@ -9,8 +9,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
/**
* Code inspired heavily by Skytils.
- *
- * TODO: fix
*/
object NametagCleaner {
@SubscribeEvent