Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

Add configuration option for specific chat type format

Open Flowsqy opened this issue 2 years ago • 0 comments

  • 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)

  • [x] 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.

Flowsqy avatar May 06 '23 01:05 Flowsqy