package io.github.satoshinm.WebSandboxMC.sponge;

import com.google.inject.Inject;
import org.slf4j.Logger;
import org.spongepowered.api.Game;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
import org.spongepowered.api.plugin.Plugin;

import java.io.File;
import java.nio.file.Path;

@Plugin(id = "websandboxmc", name = "WebSandboxMC", version = "1.6.0")
public class WebSandboxSpongePlugin {

    @Inject
    private Logger logger;

    @Inject
    @ConfigDir(sharedRoot = false)
    private Path configDir;

    @Inject
    private Game game;

    @Listener
    public void onServerStart(GameStartedServerEvent event) {
        logger.info("WebSandboxMC/Sponge starting");
        logger.info("config path: " + configDir);
    }
}

@@ -87,106 +87,547 @@
 ort 
-org.slf4j.Logger;%0Aimport org.spongepowered.api.Game;%0Aimport org.spongepowered.api.config.ConfigDir
+com.sun.javafx.beans.annotations.Default;%0Aimport ninja.leaping.configurate.ConfigurationNode;%0Aimport ninja.leaping.configurate.ConfigurationOptions;%0Aimport ninja.leaping.configurate.commented.CommentedConfigurationNode;%0Aimport ninja.leaping.configurate.hocon.HoconConfigurationLoader;%0Aimport ninja.leaping.configurate.loader.ConfigurationLoader;%0Aimport org.slf4j.Logger;%0Aimport org.spongepowered.api.Game;%0Aimport org.spongepowered.api.Sponge;%0Aimport org.spongepowered.api.config.ConfigDir;%0Aimport org.spongepowered.api.config.DefaultConfig
 ;%0Aim
@@ -805,16 +805,37 @@
 o.File;%0A
+import java.net.URL;%0A
 import j
@@ -1000,24 +1000,235 @@
 er logger;%0A%0A
+    @Inject%0A    @DefaultConfig(sharedRoot = false)%0A    private Path defaultConfig;%0A%0A    @Inject%0A    @DefaultConfig(sharedRoot = false)%0A    private ConfigurationLoader%3CCommentedConfigurationNode%3E configManager;%0A%0A
     @Inject%0A
@@ -1506,16 +1506,367 @@
 igDir);%0A
+%0A        ConfigurationLoader%3CCommentedConfigurationNode%3E loader = HoconConfigurationLoader.builder().setPath(configDir).build();%0A        ConfigurationNode rootNode = loader.createEmptyNode(ConfigurationOptions.defaults());%0A        //URL jarConfigFile = Sponge.getAssetManager().getAsset(%22defaultConfig.conf%22).get().getURL(); // TODO: can't find get?%0A%0A
     %7D%0A%7D%0A

Add sponge config injections