DiscordSRV

DiscordSRV

86.8k Downloads

Add better option for multi-line text in DiscordCommandFormat, CodeGenerated, DiscordAccountLinked and MinecraftAccountLinked

Andre601 opened this issue ยท 8 comments

commented

It would be a nice improvement, to have a better way of setting multi-line text (Text with line breaks) for the options DiscordCommandFormat, CodeGenerated, DiscordAccountLinked and MinecraftAccountLinked.

Right now can you two things:

  • Use \n for line breaks
  • Use |- to format text differently.

Both have their disadvantages which I will quickly go over with.
The option with \n does work on MC and Discord, but makes the text look a bit ugly, especially if you have many lines.

The second option, while making it look cleaner, has the disadvantage that the text gets lost on migration, from an older message.yml to a newer one.

I can imagine this being implemented in two possible ways.

  • Make the options also work as lists.
  • Have a similar solution like with DiscordGameStatus where you can set multiple options using ["text", "text", "text"]
commented

What | does in yaml is, it keeps the newlines, so that is the same thing as \n (newline 'sequence' depends on operating system), thus there is no need to do something like this

commented

The issue is that migration doesn't support this which requires you to manually fix this each time you update the plugin.

commented

That's not what I said. I said that | preserves newlines (in YAML), thus; it's the same thing as using \n (or other sequence depending on operating system)

commented

That comes with the downside that it may look like this:

Text: |
  Line 1

  Line 2
commented

????

commented

I used | in another place where yaml files where used and there I always needed to have one empty line in between for having a new line set...
I will try it tho.

commented

Alright.
This seems to actually work, which is weird, but the reason for the other case might be the system that reads the yaml file. Sorry to bother you.
I just wonder why this supposedly works for migration (Didn't test it and I just trust your words here) but |- doesn't.

commented

I just wonder why this supposedly works for migration (Didn't test it and I just trust your words here) but |- doesn't.

Because using \n's, you don't have to have a literal line break in the option's value as you would with |. DiscordSRV's config migration only works for single-line values.