Commit Graph

31 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 f3c7a312c0 Added first join messages 2023-06-20 00:35:46 +02:00
Len 5db3bc5ffe update formatting and emotes in written books. 2022-09-29 17:00:53 +02:00
Len 244b2aeda2 Register Nickname events and commands 2022-09-29 16:27:49 +02:00
Len 11ecf1ad16 Merge Nicknames 2022-09-27 00:02:27 +02:00
Teriuihi b1f2370bec Added continue, fixed mail 2022-06-02 03:48:51 +02:00
Teriuihi 08a695f2ac Added chatclear command 2022-02-06 03:31:07 +01:00
destro174 e08c5a4a3b Update minimessage to 4.10.0 2022-02-05 21:16:20 +01:00
Teriuihi 2acebc6c16 Renamed partycommand and made party chat work from galaxy to proxy 2022-01-30 19:31:29 +01:00
destro174 615458adab Update permissions to mention the plugin they're from 2022-01-27 21:09:23 +01:00
destro174 47fb205001 Add a reload command 2021-08-14 19:55:32 +02:00
Teriuihi 30cc4b3ead Renamed party things to not conflict with mcmmo hopefully 2021-08-08 12:46:56 +02:00
Teriuihi 2cb843b68c Finished party command, and sub commands 2021-08-08 11:36:06 +02:00
Teriuihi b9fae1cb35 Created configurable chat channels 2021-08-05 11:40:42 +02:00
Teriuihi 9d9b8f0bf2 Added configurable chat channels 2021-08-04 15:46:45 +02:00
destro174 9957158758 revert completablefuture 2021-08-01 21:00:57 +02:00
Teriuihi e7d508d8d1 Moved Util to Utility 2021-07-30 23:22:38 +02:00
destro174 9d8d4b3853 fixes 2021-07-30 03:16:41 +02:00
destro174 0891e252f9 auto commit 2021-07-27 18:46:58 +02:00
destro174 04ac327365 Split toggleglobalchat into another command 2021-07-18 00:56:33 +02:00
Teriuihi 313d09906d Fixed DatabaseConnection not being loaded on startup 2021-06-30 02:02:35 +02:00
destro174 b5b9f92cfb register the commands 2021-06-23 21:48:46 +02:00
destro174 5bea7c95f9 idk what i fucked up here all files are new in git? 2021-06-20 22:03:39 +02:00
len a5c23d842d progress 2021-06-13 13:53:49 +02:00
len 5d8d7b5dff Add back api and server module 2021-06-02 19:55:55 +02:00
len 4b79d6909f Refactor 2021-05-22 20:34:32 +02:00
len 47fd6bf2db Add ALogger 2021-05-15 13:52:02 +02:00
len 904fc3faad Fix Compile issues 2021-05-15 12:34:19 +02:00
len a7c21c6aa9 RegexConfig 2021-05-13 23:05:26 +02:00
len 35fda21ed1 Plugin Message channal and global chat check 2021-05-13 20:27:20 +02:00
len 4aa4726a4e Add plugin 2021-05-13 14:11:29 +02:00