lambda icon indicating copy to clipboard operation
lambda copied to clipboard

AbstractSetting: Add "formatter" parameter

Open Baitinq opened this issue 3 years ago • 1 comments

This patch adds a new "formatter: (T) -> String" parameter to the AbstractSetting abstract class. This allows for formatter functions to be passed to settings for them to display their value in a more user friendly way :)

A possible usage of this would be to replace the unit parameter, as it simply concatenates the unit string to the setting value, which is a bit misleading IMO.

P.S. This PR also includes an actual usage of this new parameter in the AntiDisconnect module

Baitinq avatar Jan 20 '23 01:01 Baitinq

this is very similar to the unit parameter which is only suffix. yours can be any format. so if you want you can add some default formattings like "x ticks" or "x blocks" and remove unit.

Avanatiker avatar Jan 22 '23 03:01 Avanatiker