handle comments with newlines as individual lines, add anonymous config

This commit is contained in:
jascotty2 2019-10-27 15:52:52 -05:00 committed by Brianna
parent 448a92eebe
commit 039d73598a
2 changed files with 11 additions and 7 deletions

View File

@ -23,24 +23,21 @@ public class Comment {
}
public Comment(String... lines) {
this.lines.addAll(Arrays.asList(lines));
this(null, Arrays.asList(lines));
}
public Comment(List<String> lines) {
if (lines != null) {
this.lines.addAll(lines);
}
this(null, lines);
}
public Comment(CommentStyle commentStyle, String... lines) {
this.commentStyle = commentStyle;
this.lines.addAll(Arrays.asList(lines));
this(commentStyle, Arrays.asList(lines));
}
public Comment(CommentStyle commentStyle, List<String> lines) {
this.commentStyle = commentStyle;
if (lines != null) {
this.lines.addAll(lines);
lines.forEach(s -> this.lines.addAll(Arrays.asList(s.split("\n"))));
}
}

View File

@ -109,6 +109,13 @@ public class Config extends ConfigSection {
*/
int commentSpacing = 1;
public Config() {
this.plugin = null;
this.file = null;
dirName = null;
fileName = null;
}
public Config(@NotNull File file) {
this.plugin = null;
this.file = file.getAbsoluteFile();