-
-
Notifications
You must be signed in to change notification settings - Fork 91
Feat: Countdown #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat: Countdown #211
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @FlyModeZ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
I've implemented a new "Countdowns" feature that enables users to set up custom in-game timers triggered by specific chat messages or regex patterns, with the countdowns displayed on a customizable HUD. This feature is complemented by a new command-line interface for easy management of these triggers. Additionally, I've made general improvements to utility functions, such as enhanced number formatting and list manipulation, and included minor fixes and enhancements in other modules, like preventing repetitive /locraw commands and refining dungeon score and puzzle completion message recognition.
Highlights
- New Countdowns Feature: I've introduced a new "Countdowns" feature that allows users to create custom in-game timers. These timers can be triggered by specific chat messages or regular expressions and are displayed on a customizable HUD.
- Command-Line Management for Countdowns: I've added a new command-line interface, "/countdowns", which provides subcommands to easily manage (add, remove, clear, list) your custom countdown triggers.
- Enhanced ListSetting for Dynamic Data Loading: I've enhanced the
ListSettingclass to support areloaderfunction. This allows for more dynamic handling and potential transformation of list elements when they are deserialized from JSON, ensuring data consistency or updates upon loading. - Prevention of Repetitive /locraw Commands: I've implemented a new feature in the
ChatCommandsmodule to prevent repetitive sending of the/locrawcommand, which helps reduce chat spam. - Utility Function Improvements: I've added new utility functions for number formatting, including an overloaded
toFixedfunction that accepts a divisor, and refactored theformatNumberfunctions to better handle large numbers (e.g., K, M, B, T). I also added anaddOrNullextension forMutableListto prevent duplicate entries.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new "Countdown" feature, which allows users to set up timers on their HUD triggered by chat messages or regex patterns. The changes are well-structured, adding a new module, a command for managing countdowns, and several utility updates. My review highlights a critical bug in the new command's index validation, a potential performance issue with how chat messages are processed, and opportunities to improve code style and readability for better maintainability.
|
nvm im dumbass |
Signed-off-by: FlyModeZ <[email protected]>
Signed-off-by: FlyModeZ <[email protected]>
| sendChatMessage(words.joinToString(" ")) | ||
| } | ||
|
|
||
| @SubscribeEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odin doesn't use locraw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skyhanni and oneconfig sending them at the same time for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea well this isn't skyhanni nor oneconfig
| } | ||
| } | ||
| val countdownTriggers by ListSetting("Countdowns", mutableListOf<CountdownTrigger>()) { it.copy() } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't have presets inside the mod
| private set | ||
| var averagePing = 0f | ||
| private set | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this
| return first | ||
| } | ||
|
|
||
| fun <T> MutableList<T>.addOrNull(element: T): T? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't generally used not point having it a global function
| Regex("^You are not currently in a party.$") | ||
| ) | ||
|
|
||
| var forceInParty = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if hypixel change these party messages it would break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill revert this
| } | ||
|
|
||
| literal("party").runs { | ||
| modMessage("${PartyUtils.isInParty}, ${PartyUtils.partyLeader}, ${PartyUtils.partyMembers}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk i didn't make these 2 lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I more like meant the forceInParty and forceIsLeader the entire changes here...
| } | ||
| } | ||
|
|
||
| literal("remove").runs { index: Int -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use runCatching here
| Config.save() | ||
| } | ||
|
|
||
| literal("addregex").runs { prefix: String, time: Int, message: GreedyString -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use runCatching here and add a string to the list and not a regex class
| * | ||
| * @author Stivais | ||
| */ | ||
| class ListSetting<E, T : MutableCollection<E>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not modify this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i couldn't find any other way to define realRegex
like idk but when you read from config this var realRegex code block doesn't run
data class CountdownTrigger(val prefix: String, val time: Int, val regex: Boolean, val message: String) {
@Transient
var realRegex: Regex? = if (regex) {
runCatching { Regex(message) }.getOrNull()
} else {
null
}
}init {} block runs before config load btw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh ok
| val module: Module, | ||
| ) : RenderableSetting<HudElement>(name, description), Saving { | ||
|
|
||
| constructor(name: String, x: Float, y: Float, scale: Float, toggleable: Boolean, description: String, module: Module, draw: (Boolean) -> Pair<Number, Number>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(old) if you have a HUD, toggleable=false, it's also not enabled when first launch
i'm fixing this :<

thingy