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

Open
wants to merge 5 commits into
base: 2.x
Choose a base branch
from

Conversation

Flowsqy
Copy link

@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
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
2 participants