Commit Graph
49 Commits
Author SHA1 Message Date
StijnandGitHub 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
auto 5583abbbca Fix party info not showing if party owner is null 2023-06-20 23:44:32 +02:00
Len 6329eacd07 Fix some deprecated issues 2022-09-29 16:26:55 +02:00
Stijn d3be713c9a Added optional sender argument to /mail list <username> 2022-09-21 18:26:16 +02:00
auto b1f2370bec Added continue, fixed mail 2022-06-02 03:48:51 +02:00
auto 679602c1f7 Registered SilentJoinCommand 2022-05-30 19:19:41 +02:00
auto fdd9d81400 Fix party users not being removed correctly (they left the party but still had their party id set) 2022-05-24 02:49:36 +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
destro174 e6dfd19b84 Merge branch 4.9 2022-03-14 16:48:35 +01:00
auto 98475583a9 Gave report an error message 2022-03-05 04:52:10 +01:00
auto 7c9b12c394 Don't let someone join a party they are already in 2022-03-02 17:30:19 +01:00
destro174 5834ff2c97 Why doesn't it error? 2022-02-24 17:16:32 +01:00
destro174 e550679637 Workaround? please build 2022-02-23 16:13:53 +01:00
auto a0c626a88f Add confirmation message, change color, fix author icon url 2022-02-20 19:12:20 +01:00
auto 8d6efe0265 Don't ask for player 2022-02-20 19:03:11 +01:00
auto 56010fb9ad Added /report probably (and fixed party chat tab complete) 2022-02-20 18:19:52 +01:00
autoanddestro174 8fd784bba1 Maybe added proxydiscordlink and added report command 2022-02-19 16:58:22 +01:00
autoanddestro174 956d04abe0 Added party leave notif 2022-02-19 16:58:22 +01:00
autoanddestro174 a3d1910c7d Fixed party notifs and spy 2022-02-19 16:58:22 +01:00
destro174 448d9ac8aa Update minimessage to 4.10.0 2022-02-19 16:58:22 +01:00
autoanddestro174 c1b32e12cc Check if a user has permission to see tab complete suggestions 2022-02-19 16:58:22 +01:00
autoanddestro174 4571d191fd Added party disband command and a way to remove all users from a party 2022-02-19 16:58:22 +01:00
autoanddestro174 dcd8456612 Added party chat help message 2022-02-19 16:58:22 +01:00
autoanddestro174 83d1ae933d Added messages for commands that had no output 2022-02-19 16:58:22 +01:00
autoanddestro174 8a89b08420 Check if a user is already in a party before letting them make another party 2022-02-19 16:58:22 +01:00
autoanddestro174 304d825622 Configure party invite messages 2022-02-19 16:58:22 +01:00
autoanddestro174 f2aeb2c300 Parse commands before putting them in template 2022-02-19 16:58:22 +01:00
destro174 342957ef68 Fix build! 2022-02-19 15:14:41 +01:00
auto fbbe0d6ef3 Maybe added proxydiscordlink and added report command 2022-02-15 16:37:47 +01:00
auto 647ad2b62a Added party leave notif 2022-02-15 03:20:05 +01:00
auto e6e1073958 Fixed party notifs and spy 2022-02-15 02:32:38 +01:00
destro174 e08c5a4a3b Update minimessage to 4.10.0 2022-02-05 21:16:20 +01:00
auto 79501c619a Check if a user has permission to see tab complete suggestions 2022-01-31 03:15:43 +01:00
auto 0c8a4a97d3 Added party disband command and a way to remove all users from a party 2022-01-31 03:06:52 +01:00
auto 032d0e2bef Added party chat help message 2022-01-31 02:54:23 +01:00
auto 787927672a Added messages for commands that had no output 2022-01-30 20:20:42 +01:00
auto a0a60757f6 Check if a user is already in a party before letting them make another party 2022-01-30 19:50:22 +01:00
auto 89938338b1 Configure party invite messages 2022-01-30 19:50:06 +01:00
auto f8ede610b2 Parse commands before putting them in template 2022-01-30 19:49:53 +01:00
auto 2acebc6c16 Renamed partycommand and made party chat work from galaxy to proxy 2022-01-30 19:31:29 +01:00
auto 4f4f48e847 Added all the commands and added configurable messages for everything 2022-01-30 17:50:18 +01:00
auto 5fcf9da6b9 Removed updateparty comments 2022-01-30 15:46:22 +01:00
auto 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 26b044b2e7 merge basic mailing 2022-01-29 14:53:47 +01:00
destro174 615458adab Update permissions to mention the plugin they're from 2022-01-27 21:09:23 +01:00
destro174 ce071841a2 fix an oopsie 2021-12-11 19:35:35 +01:00