tritonmc / Triton

Translate your server! Sends the same message in different languages... Hooks into all plugins!
https://triton.rexcantor64.com
GNU General Public License v3.0
87 stars 34 forks source link

PlaceholderAPI and working with arguments #376

Open DormantCat opened 10 months ago

DormantCat commented 10 months ago

Describe the Feature

A copy of my message from Discord.

I have a question. And why not actually add the ability for arguments to work in the Placeholder API (example: %triton_message_with_arguments:<arg1><arg2>%) ? or in any other way? Even in the official documentation of the placeholder api, there are many examples of using substitutes with several variables, including placeholders.

make a structure: %triton_ is the required part message_with_arguments - this is the message key : - this is the separator, then what will the arguments go on <arg> - where <> is the selection (input and output) of the argument. if necessary, insert a placeholder For example <{placeholder}> % - completion

at the output we get: %triton_key:<arg><{placeholder}><arg_2>%

In my head, the logic is simple. (in fact, everything is much more complicated)

1 - there is a request for a substitute 2 - a message is received by key (depending on the language) 3 - message output

the situation is similar with the placeholder api , but it's a little more difficult to do 3 - split keys by the character : 4 - replacement of variables in the message (2), with the argument in {} get placeholder 5 message output

the logic of the work is very similar to [args][arg]some argument[/arg][/args]