Hmm, good question, never tried that! This could work, if it does, I doubt if it will break YAML parsing. PHP: /** @var Config $config */$config->set(" ", "\n");$config->save();
No, that's not how you do it and i think \n would show up as \n This would work (Line count starts from 1) PHP: addLineBreakToFile(string $pathtoyourfile, int $line){ $content = file_get_contents($pathtoyourfile); $lines = explode($content, "\n"); $lines[$line - 1] .= "\n"; $content = implode($lines); file_put_contents($pathtoyourfile, $content);}
Nope Code: --- JoinMessage: $name hat die Welt betreten! JoinMessageColor: GREEN ' ': |2+ QuitMessage: $name hat die Welt verlassen! QuitMessageColor: RED DeathMessage: $name ist gestorben! DeathMessageColor: DARK_RED ...
Why don't you write the default config file while manually adding new lines and then copy it from resources to data folder?
The line number where your line break should occur. Example: becomes with the call addLineBreakToFile($filepath, 4); It's type hinted already. (INT!)
Massive again, sorry I messed up the args of explode() PHP: addLineBreakToFile(string $pathtoyourfile, int $line){ $content = file_get_contents($pathtoyourfile); $lines = explode("\n", $content); $lines[$line - 1] .= "\n"; $content = implode($lines, "\n"); file_put_contents($pathtoyourfile, $content);} Please try that, I actually tested that now and it works. (While testing I also noticed I forgot to readd \n's another massive - Fixed)