Commit Graph

84 Commits

Author SHA1 Message Date
Stijn 73e67eed6c
Vote mute (#3)
* Implement chat log handler with database support

The code changes introduce the ability to log chat messages. A new ChatLogHandler class has been added that manages the queue of chat log messages, both storing them in memory and writing them to a database. New columns have been added to the database and the interactivity with the database is handled using prepared statements to improve security and performance. The chat messages are deleted from the database after a certain period, which can be configured.

* Add start of VoteToMute functionality in chat system

Implemented VoteToMute system enabling initiated voting for muting a player in chat. This includes creating new classes "ActiveVoteToMute", "VoteToMute", and "VoteToMuteStarter". The "VoteToMute" class handles the voting command logic, it allows players to vote on whether to mute other players. The code also adds a call to register this new command in the main VelocityChat class.

* Replace Object2ObjectOpenHashMap with HashMap

The usage of Object2ObjectOpenHashMap in storing chat logs and the chat log handler was switched to HashMap. This was done to ensure the plugin can be run on proxy as velocity does not include this library

* Add VoteToMuteHelper and enhance ActiveVoteToMute

Implemented a new module titled VoteToMuteHelper to enhance the voting system and augment the user experience. This module enhances the system by providing relevant player suggestions and setting up the mute player. Made updates to the ActiveVoteToMute module to handle potential voters and mute the player if the vote is passed. VoteToMute module is also updated to include the total eligible players. The code is made robust by adding appropriate error checks.

* Enable optional logging in ChatLogHandler

Modified the ChatLogHandler to support optional logging by introducing a new argument in the getInstance() method. This argument sets the logging state during instantiation. This facilitates better flexibility when using the ChatLogHandler across different sections of the code base as logging requirements may differ.

* Add mute vote results sent to Discord and staff presence check

Enhanced the vote-to-mute feature by adding a function that sends the mute vote results to a general channel on Discord. A 'staff presence' check has also been added which prevents the mute vote from being initiated if a staff member is online, instead, it prompts users to directly contact a staff member for help.

* Fix chat log message deletion query

Corrected the SQL query in the `deleteOldMessages` method within `ChatLogQueries.java`. Originally, it was incorrectly deleting newer messages rather than older ones due to an incorrect comparison symbol. It has now been adjusted to properly delete older messages based on the provided duration.

* Add player muted logging and abstract embed building

The update introduces a log entry indicating when a player has been muted due to voting. The embed creation for this process has been isolated and extracted into a separate function. This contributes to better code modularity and organization.

* Implement logging for ChatLogHandler

The ChatLogHandler now includes logging for better troubleshooting and understanding of the server state. Logging triggers when chat logging is disabled, when it starts, and also if there's a failure in saving chat messages to the database.

* Refactor death message display in PlayerListener

The commit refactors the method for displaying player death messages in the PlayerListener class. Specifically, it adds functionality to replace usernames with display names in death notifications. More descriptive death messages with themed colors and icons are now shown.

* Refine ChatPlugin and improve "vote to mute" logic

Modified ChatPlugin to include "thisPlugin" within the ShutdownListener initialization. Additionally, adjusted the mute vote failure message color from green to red in ActiveVoteToMute file and added a condition to return false if there are no votes. Also, made improvements to the pagination logic in the VoteToMuteStarter file. Lastly, improved the chat logging mechanics in ChatLogHandler by adding and refining various log information for capturing action details.

* Update vote validation and argument naming

Updated the method "votePassed" in "ActiveVoteToMute" to consider a scenario where no votes have been made for muting. Also, corrected the argument name from "yesno" to "yesNo" in "VoteToMuteHelper" to match with its name in the command constructor

* Update vote to mute functionality in chat system

Several changes were made to update the vote to mute functionality in the chat system. The threshold for eligible players online for vote has been changed from 10 to 6. In addition, improvements have been made to prevent the vote from ending prematurely. Lastly, feedback messages to users when they cast their vote and an update to the vote start message format have been implemented.

* Update vote-to-mute feature

The vote-to-mute feature is updated to include information about the vote initiating player. Also, the duration to retrieve chat logs increased from 5 minutes to 10 minutes. Lastly, eligible players are now notified live about the voting progress.

* Fix message validation and chat log order

Corrected conditional logic in VoteToMuteHelper to validate messages properly and adjusted sorting of chat logs in VoteToMuteStarter to display in reverse chronological order. The update now accurately verifies the existence of selected messages and presents recent logs first for more user-friendly navigation.
2024-07-27 23:16:18 +02:00
Teriuihi 340975e99e Change default config file path
The path to the configuration file that was initially set to the user's home directory has been modified. It has been shifted to "/mnt/configs/ChatPlugin".
2024-07-19 20:46:39 +02:00
Teriuihi a377bdfe48 Implement player death message limits
The code now includes player death message limits, with a configured maximum number of messages per defined period. This was added in the PlayerListener class and configuration options were placed in Config.java. This change will restrict spamming of death messages.
2024-04-06 13:11:05 +02:00
Len ffa90b5c94 add MENTIONPLAYERTAG to Config.java 2023-07-15 17:45:03 +02:00
Teriuihi f3c7a312c0 Added first join messages 2023-06-20 00:35:46 +02:00
Teriuihi d8f064e7ca Fix spy needing mute-server permission 2023-06-20 00:09:48 +02:00
Len 3d14cca551 Update minimessage tags to be lowercase 2022-10-03 11:29:06 +02:00
Len d1df551f35 Update minimessage tags to be lowercase 2022-10-03 10:30:27 +02:00
Teriuihi d7bd3aa222 Switched to using minimessage (mostly) 2022-10-02 04:52:33 +02:00
Len a4e4982dc3 Update nicknames to use Chat's plugin message channels. 2022-10-01 20:42:35 +02:00
Len 6329eacd07 Fix some deprecated issues 2022-09-29 16:26:55 +02:00
Len a405862fe1 Update Config.java references for Nicknames 2022-09-27 00:45:23 +02:00
Len 11ecf1ad16 Merge Nicknames 2022-09-27 00:02:27 +02:00
Len 4d01ccb065 Update Config.java 2022-09-27 00:02:27 +02:00
Teriuihi 4068ad8ea6 Fixed message for toggling chat channel
Fixed stack overflow for untoggling chat channels
2022-05-30 19:43:31 +02:00
Teriuihi 82eecc3142 Colored toggle word, improved default party online/offline marker 2022-05-30 19:27:47 +02:00
Teriuihi 41897f4b16 Added toggle to party as well and made it so it can be added to other channels if needed 2022-05-24 04:17:55 +02:00
Teriuihi dac0f7936e Use util to parse message 2022-05-24 02:06:28 +02:00
Stijn 408d38fb78 Added silent join 2022-05-23 22:32:43 +02:00
Stijn faa0435131 Require reports to be at least 3 words long 2022-05-23 22:06:17 +02:00
Stijn 1946cd4ab7 Added online indicators for party info 2022-05-23 21:55:36 +02:00
Teriuihi 98475583a9 Gave report an error message 2022-03-05 04:52:10 +01:00
Teriuihi 09507999aa Added player does not exist message when sending a message to a player that's not online 2022-03-02 17:36:15 +01:00
Teriuihi 7c9b12c394 Don't let someone join a party they are already in 2022-03-02 17:30:19 +01:00
Teriuihi a0c626a88f Add confirmation message, change color, fix author icon url 2022-02-20 19:12:20 +01:00
Teriuihi 56010fb9ad Added /report probably (and fixed party chat tab complete) 2022-02-20 18:19:52 +01:00
Teriuihi 956d04abe0 Added party leave notif 2022-02-19 16:58:22 +01:00
Teriuihi e0ed414a38 Added confirmation message to mail sent 2022-02-19 16:58:22 +01:00
Teriuihi a3d1910c7d Fixed party notifs and spy 2022-02-19 16:58:22 +01:00
Teriuihi 497cd99979 Grammar in config message 2022-02-19 16:58:22 +01:00
Teriuihi 630cd6c133 Tweaked mails, added notifs, added config options 2022-02-19 16:58:22 +01:00
Teriuihi ce0cad2586 Added missing config messages 2022-02-19 16:58:22 +01:00
Teriuihi 4571d191fd Added party disband command and a way to remove all users from a party 2022-02-19 16:58:22 +01:00
Teriuihi dcd8456612 Added party chat help message 2022-02-19 16:58:22 +01:00
Teriuihi 83d1ae933d Added messages for commands that had no output 2022-02-19 16:58:22 +01:00
Teriuihi e5e174d363 Added logout notif 2022-02-19 16:58:22 +01:00
Teriuihi 8f6b8675b5 Notify players if their party member joins 2022-02-19 16:58:22 +01:00
Teriuihi 4c1da52c9b Edited templates for spy/party format 2022-02-19 16:58:22 +01:00
Teriuihi 3cb858ba3d Added more config messages 2022-02-19 16:58:22 +01:00
Teriuihi 4f4f48e847 Added all the commands and added configurable messages for everything 2022-01-30 17:50:18 +01:00
Teriuihi daf6ab21a5 started migrating party to proxy 2022-01-30 02:12:09 +01:00
destro174 57a43e9c1c finish mails? 2022-01-29 23:21:35 +01:00
destro174 615458adab Update permissions to mention the plugin they're from 2022-01-27 21:09:23 +01:00
destro174 af23e0df29 don't add defaults if not asked 2022-01-05 14:09:36 +01:00
destro174 5b68a0cbb7 Bring back block style config 2021-12-11 20:20:36 +01:00
Stijn 42b19c5197 Updated velocity and configurate version 2021-11-29 15:37:19 +01:00
destro174 0199a67e77 unify usafe of util methods 2021-08-25 22:11:29 +02:00
destro174 2f8a8fc8ff clean some open TODO tasks 2021-08-25 12:41:47 +02:00
destro174 728cac3281 Add blockednotification format in config 2021-08-25 12:12:29 +02:00
destro174 1d5dd7c764 Don't use replacematcher for parsing text on signs 2021-08-20 23:03:58 +02:00