Skip to content
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

Add configuration option for specific chat type format #5337

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

Flowsqy
Copy link
Contributor

@Flowsqy Flowsqy commented May 6, 2023

  • Add a per-type formats
  • Remove public modifier in constructor to respect checkstyle
  • Add config deserializer
  • Add a comment in AbstractChatHandler about a known inconsistency

Information

This PR closes #5332.

Details

Proposed feature:

Keep old configuration format for backward compatibility.
Add the ability to transform each format ('group-name':'chat-format' or format: 'chat-format') to allow per-type format.
To specify a per-type format, transform:

<format-key>: '<chat-format>'

into

<format-key>:
  <chat-type>: '<chat-format>'
  <chat-type>: '<chat-format>'
  #...

'' can be replaced by 'local', 'shout', 'question', 'unknown' and 'default'
Note that considering the early state of this PR, 'local' can't be fired by the plugin due to the implementation.
Format are evaluated in the following order. The first non is used:

  • message type format
  • 'default' type format
  • The old way (for backward compatibility)
    It does not affect the group and general format order which remains the same:
  • sender group specific format
  • general format
  • default format (hard-coded)

Environments tested:

OS: Linux 6.1.25-1-MANJARO

Java version: OpenJDK Runtime Environment (build 19.0.1+10-21)

  • Most recent Paper version (1.XX.Y, git-Paper-BUILD)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

Demonstration:

As it's a small PR, everything is described in the 'Proposed feature' section above.

Additional notes:
I apologize for this PR that aims to close an unreviewed issue.
I will be very busy with personnal stuff in the upcomming weeks and I needed to release this as soon as possible.
It leads to this PR which is clearly not finished as we didn't manage to talk about how to implement it.
Due to its size, it does not matter if it's done another way, the PR is only here to save you some work.
For code notes, you should be aware that I created three inner classes in the Settings class that should be moved.
And as specified in the 'Proposed feature' section, 'local' chat type can't be triggered.
I didn't update the config.yml documentation either.

@pop4959 pop4959 added type: enhancement Features and feature requests. module: chat Issues or PRs for the EssentialsChat module labels May 7, 2023
Copy link
Member

@JRoy JRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, sorry for the very delayed review! This looks good at a glance, can you just add some examples to the config.yml with a brief explanation?

@Flowsqy
Copy link
Contributor Author

Flowsqy commented Nov 25, 2024

Hi, should be good now. I didn't test it after the merge tho.

@Flowsqy Flowsqy requested a review from JRoy November 27, 2024 10:02
JRoy
JRoy previously approved these changes Nov 27, 2024
@JRoy JRoy enabled auto-merge (rebase) November 27, 2024 22:11
@JRoy JRoy merged commit b560bbd into EssentialsX:2.x Nov 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: chat Issues or PRs for the EssentialsChat module type: enhancement Features and feature requests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add chat format configuration for each chat type for a group
3 participants