Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/kotlin/org/cobalt/command/CommandManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object CommandManager {
dispatcher.execute(commandLine, player.connection.suggestionsProvider)
minecraft.gui.hud.chat.commandHistory.addCommand(content)
} catch (exception: CommandSyntaxException) {
ChatUtils.sendSystemMessage("${ChatFormatting.RED}${exception.message}")
ChatUtils.sendSystemMessage("<red>${exception.message}</red>")
}

return true
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/cobalt/module/ModuleManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object ModuleManager {
if (currentScript != null && currentScript != script) {
stopAllScripts()
ChatUtils.sendSystemMessage(
"${ChatFormatting.RED}Cannot start a different script when one is currently active, disabling all scripts..."
"<red>Cannot start a different script when one is currently active, disabling all scripts...</red>"
)

return
Expand All @@ -79,7 +79,7 @@ object ModuleManager {

fun stopScript() {
if (currentScript == null) {
ChatUtils.sendSystemMessage("${ChatFormatting.RED}There is no script currently running")
ChatUtils.sendSystemMessage("<red>There is no script currently running</red>")
return
}

Expand Down
4 changes: 1 addition & 3 deletions src/main/kotlin/org/cobalt/module/impl/misc/AutoSprint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ object AutoSprint : Module(
return
}

if (PathExecutor.running && PathExecutor.config?.shouldSprint != true) {
return
}
if (PathExecutor.controlsSprint) return

minecraft.options.keySprint.isDown = true
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/org/cobalt/pathfinder/PathExecutor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ object PathExecutor {

var running = false

val controlsSprint: Boolean
get() = running && config?.shouldSprint == true

init {
EventBus.register(this)
}
Expand All @@ -34,7 +37,7 @@ object PathExecutor {
stop()

if (config.useFlyMovement && !PlayerUtils.canFly) {
ChatUtils.sendSystemMessage("${ChatFormatting.RED} Invalid path config, since player cannot fly!")
ChatUtils.sendSystemMessage("<red> Invalid path config, since player cannot fly!</red>")
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CalculatingState : ExecutorState {
val path = pathFinder.findPath()

if (path == null) {
ChatUtils.sendSystemMessage("${ChatFormatting.RED}Unable to find a path.")
ChatUtils.sendSystemMessage("<red>Unable to find a path.</red>")
PathExecutor.stop()
return@runAsync
}
Expand Down
11 changes: 3 additions & 8 deletions src/main/kotlin/org/cobalt/util/ChatUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,21 @@ object ChatUtils {
@JvmStatic
fun sendSystemMessage(message: String, type: MessageType = MessageType.DEFAULT) {
val component = when (type) {
MessageType.DEFAULT -> stringToComponent(defaultPrefix + message)
MessageType.RAW -> stringToComponent(message)
MessageType.DEFAULT -> ChatFormatter.parse(defaultPrefix + message)
MessageType.RAW -> ChatFormatter.parse(message)
MessageType.DEBUG -> {
if (!Debug.enabled || lastDebugMessage == message) {
return
}

lastDebugMessage = message
stringToComponent(debugPrefix + message)
ChatFormatter.parse(debugPrefix + message)
}
}

addToChat(component)
}

@JvmStatic
fun stringToComponent(string: String): MutableComponent {
return ChatFormatter.parse(string)
}

@JvmStatic
fun sendPlayerMessage(message: String) {
runOnClientThread {
Expand Down
Loading