package com.github.bjoernpetersen.jmusicbot.config;

import com.github.bjoernpetersen.jmusicbot.MusicBot;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;

/**
 * Collection of default config entries used by the core library.
 */
public final class DefaultConfigEntry {

  /**
   * The folder in which to look for plugin files. Default: "plugins".
   */
  @Nonnull
  public final Config.StringEntry pluginFolder;

  private DefaultConfigEntry(Config config) {
    pluginFolder = config.stringEntry(
        MusicBot.class,
        "pluginFolder",
        "This is where the application looks for plugin files",
        "plugins",
        fileName -> {
          File file = new File(fileName);
          if (file.isFile()) {
            return Optional.of("This is a file, must be a directory");
          }
          return Optional.empty();
        }
    );
  }

  /**
   * Gets a list of all default entries.
   *
   * @return a list of entries
   */
  @Nonnull
  public List<? extends Config.Entry> getEntries() {
    return Collections.unmodifiableList(
        Collections.singletonList(pluginFolder)
    );
  }

  /**
   * Gets the DefaultConfigEntry instance for the specified config.
   *
   * @param config a config
   * @return a DefaultConfigEntry instance
   */
  public static DefaultConfigEntry get(@Nonnull Config config) {
    return new DefaultConfigEntry(config);
  }
}

@@ -826,20 +826,8 @@
 urn 
-Optional.of(
 %22Thi
@@ -859,17 +859,16 @@
 rectory%22
-)
 ;%0A      
@@ -894,24 +894,12 @@
 urn 
-Optional.empty()
+null
 ;%0A  

Fix DefaultConfigEntry