Merge pull request #5 from alkyaly/fix/multiline
Fixes multi-line comments breaking
This commit is contained in:
@@ -120,14 +120,18 @@ public class OmegaConfig {
|
|||||||
// Find areas we should insert comments into...
|
// Find areas we should insert comments into...
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
String at = lines.get(i);
|
String at = lines.get(i);
|
||||||
|
String startingWhitespace = getStartingWhitespace(at);
|
||||||
|
|
||||||
// Check if we should insert comment
|
|
||||||
for (Map.Entry<String, String> entry : keyToComments.entrySet()) {
|
for (Map.Entry<String, String> entry : keyToComments.entrySet()) {
|
||||||
String key = entry.getKey();
|
|
||||||
String comment = entry.getValue();
|
String comment = entry.getValue();
|
||||||
|
// Check if we should insert comment
|
||||||
if (at.trim().startsWith(String.format("\"%s\"", key))) {
|
if (at.trim().startsWith(String.format("\"%s\"", entry.getKey()))) {
|
||||||
insertions.put(i + insertions.size(), String.format("%s//%s", getStartingWhitespace(at), comment));
|
if (comment.contains("\n")) {
|
||||||
|
comment = startingWhitespace + "//" + String.join(String.format("\n%s//", startingWhitespace), comment.split("\n"));
|
||||||
|
} else {
|
||||||
|
comment = String.format("%s//%s", startingWhitespace, comment);
|
||||||
|
}
|
||||||
|
insertions.put(i + insertions.size(), comment);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ public class StructuresConfigTest implements Config {
|
|||||||
|
|
||||||
@Comment("""
|
@Comment("""
|
||||||
Welcome to Mo'Structures Config!
|
Welcome to Mo'Structures Config!
|
||||||
//
|
|
||||||
// Here, you can turn off structures, change their chance, and also change their salt.
|
Here, you can turn off structures, change their chance, and also change their salt.
|
||||||
//
|
|
||||||
// To turn off a structure, simply go to the corresponding entry and set `activated` to false.
|
To turn off a structure, simply go to the corresponding entry and set `activated` to false.
|
||||||
//
|
|
||||||
// Mo' Structures uses the vanilla structure spawning system. That is-
|
Mo' Structures uses the vanilla structure spawning system. That is-
|
||||||
// - Seperation is the minimum chunks between structures
|
- Seperation is the minimum chunks between structures
|
||||||
// - Spacing is the average chunks between structures
|
- Spacing is the average chunks between structures
|
||||||
//
|
|
||||||
// Salt is a special field that gives structures unique spawning positions. DO NOT TOUCH IT, ONLY ADVANCED TROUBLESHOOTING!
|
Salt is a special field that gives structures unique spawning positions. DO NOT TOUCH IT, ONLY ADVANCED TROUBLESHOOTING!
|
||||||
|
|
||||||
""")
|
""")
|
||||||
public final Map<String, StructureConfigEntry> structureConfigEntries = new HashMap<>(17);
|
public final Map<String, StructureConfigEntry> structureConfigEntries = new HashMap<>(17);
|
||||||
|
|||||||
Reference in New Issue
Block a user