Skip to content

Utilise Minutes in TempBan for under 1 hour bans. #362

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

Merged
merged 3 commits into from
May 12, 2025

Conversation

Ayymoss
Copy link
Collaborator

@Ayymoss Ayymoss commented May 11, 2025

Previously, configurations with <1hr tempban period presets threw int.Parse() floating point issues as it converted it to <1.

This resolves this by utilising minutes as the smallest time step.

The duration calculation for tempbans now uses minutes rather than hours for greater precision. This change ensures better alignment with user expectations and configurations in smaller timeframes.
@diamante0018
Copy link
Collaborator

This works but wouldn't it also be great if the code that threw the exception got refactored in a way that the underlying cause stops throwing under some circumstances? Perhaps I'm not understanding the code right now

@Ayymoss
Copy link
Collaborator Author

Ayymoss commented May 11, 2025

@diamante0018 You're right. The underlying issues is still present. This fix was only for the webfront side.

People could still use decimal in commands, but not sure why you would, but it's possible. :D

@diamante0018
Copy link
Collaborator

I see. Ah I understand. Maybe I'll setup a server locally to check it out. Haven't wrote in c# in a while but if it's something I can do I'll make a pr

@Ayymoss
Copy link
Collaborator Author

Ayymoss commented May 11, 2025

I can fix it if necessary, it's no issue. We should probably just reject the command or use the fallback value if the duration contains a decimal place.

Ayymoss added 2 commits May 11, 2025 22:59
Adjusted regex in `ParseTimespan` and `TempBanCommand` to ensure input starts with 1-5 numeric characters, improving validation. This prevents malformed user inputs and enhances overall command reliability.
@Ayymoss
Copy link
Collaborator Author

Ayymoss commented May 11, 2025

Okay, this should input the issue too through regex constraints. If the regex can be bypassed, the int.Parse() issue will come back. But for all intents and purposes I think this is fine.

Webfront now works with <1h durations.

Manual commands are now properly constrained.

Note, failing syntax will not return any message to the user.

@RaidMax RaidMax merged commit 072e6da into develop May 12, 2025
9 checks passed
@RaidMax RaidMax deleted the fix/tempban-subhour branch May 12, 2025 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants