Skip to content

Commit

Permalink
Add AnnoyingFile#getSectionOrCreate(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
srnyx committed Jun 16, 2024
1 parent edbbf3f commit 93d7025
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/xyz/srnyx/annoyingapi/file/AnnoyingFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ public void save() {
*/
public void log(@NotNull Level level, @Nullable String key, @NotNull String message) {
AnnoyingPlugin.log(level, ChatColor.getLastColors(message) + path + (key == null ? "" : ", " + key) + " | " + message);

/**
* Gets the {@link ConfigurationSection} at the path or creates an empty one it if it doesn't exist
*
* @param path the path to the node
*
* @return the {@link ConfigurationSection} at the path or a new one if it doesn't exist
*/
@NotNull
public ConfigurationSection getSectionOrCreate(@NotNull String path) {
final ConfigurationSection section = getConfigurationSection(path);
return section == null ? createSection(path) : section;
}

/**
Expand Down

0 comments on commit 93d7025

Please sign in to comment.