rexlManu / FairyChat

The next generation chat plugin for managing your server's chat.
https://modrinth.com/plugin/fairychat
MIT License
20 stars 0 forks source link

[Feature Suggestion] Custom Chat Completion like @playerName Format #21

Closed g2213swo closed 1 year ago

g2213swo commented 1 year ago

Scope: Leverage Paper's custom Tab completion feature to enhance the chat experience in the context of @playerName format.

Why: The new API from Paper could potentially make the usage of @playerName format more user-friendly and intuitive.

Reference:

Example Implementation: Utilizing this could look something like:

// An example of how to add/remove a player's name to/from the tab completion list

// An example of how to get a player by name
Player player = Bukkit.getPlayer("g2213swo");
// It will add the player's name to the tab completion list
player.addCustomChatCompletions(Collections.singletonList("@" + player.getName()));
// It will remove the player's name from the tab completion list
player.removeCustomChatCompletions(Collections.singletonList("@" + player.getName()));

// It will set the player's tab completion list to only contain the player's name
player.setCustomChatCompletions(Collections.singletonList("@" + player.getName()));

Thank you for your dedication to this plugin. Its simplicity and efficiency have been a boon to the community. Your efforts are greatly appreciated.

rexlManu commented 1 year ago

Hi,

I didn't know that this exists. I'm following always the paper release news but have missed it.

I will add it to my todo and implement it in near future.

Thanks for your suggestion and your kindly words about my work!

g2213swo commented 1 year ago

Hello,

Thank you for considering this feature!

In addition, I have an extra suggestion: Could it be possible for server administrators to add custom hints for ChatCompletions via the plugin's configuration file? This way, admins could provide players with specific hints, such as the <item> format, making chat or command execution more convenient for them.

Regarding some observations I've made: Color codes may not be very appropriate within completions. Using Minimessage seems not to work, and while Legacy formatting symbols like § or & appear functional, they lead players to directly output Legacy color codes, wrongly resulting in them being kicked out, as illustrated below: 7% 52E``TW3(BDANYW$IZYD

Furthermore, I'm uncertain if variable parsing from the MiniPlaceholders plugin can be incorporated here, but if it's feasible, I think it'd be a pretty cool addition!

Thank you again for your swift response and dedication to the plugin. Looking forward to the next update!

rexlManu commented 1 year ago

In addition, I have an extra suggestion: Could it be possible for server administrators to add custom hints for ChatCompletions via the plugin's configuration file? This way, admins could provide players with specific hints, such as the <item> format, making chat or command execution more convenient for them.

I will think about the idea to configure custom completions

Regarding some observations I've made: Color codes may not be very appropriate within completions. Using Minimessage seems not to work, and while Legacy formatting symbols like § or & appear functional, they lead players to directly output Legacy color codes, wrongly resulting in them being kicked out, as illustrated below:

Players with the required permission should be able to use minimessage tags for coloring and decoration and also legacy chat colors

Edit: Sorry I misunderstood you. You meant the completion with colors. The server doesn't allow § in player messages. I don't see a solution with previewing with colors. It could be possible to support completion for tags though

Furthermore, I'm uncertain if variable parsing from the MiniPlaceholders plugin can be incorporated here, but if it's feasible, I think it'd be a pretty cool addition!

I don't think that it's a good idea to let players use placeholders from MP or PAPI in their messages

g2213swo commented 1 year ago

I don't think that it's a good idea to let players use placeholders from MP or PAPI in their messages

Indeed, you're right. MP and PAPI are designed for server administrators. Allowing players to use them might cause them unease or confusion.

rexlManu commented 1 year ago

Hi, I checked it out and it's pretty funky and not really stable. It also bugs with commands, so highlights don't work with them. So for now I will not add this until I found a b etter solution for it.