Add default Sones after resetting the configuration.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / Core.java
index ff50c84..00aefe2 100644 (file)
@@ -505,6 +505,7 @@ public class Core extends AbstractService {
                                                } else {
                                                        addSone(parsedSone);
                                                }
+                                               setSoneStatus(parsedSone, SoneStatus.idle);
                                        }
                                } catch (MalformedURLException mue1) {
                                        logger.log(Level.INFO, "Could not create URI from “" + requestUri + "”.", mue1);
@@ -711,6 +712,16 @@ public class Core extends AbstractService {
        //
 
        /**
+        * Adds some default Sones.
+        */
+       private void addDefaultSones() {
+               /* Sone’s Sone. */
+               loadSone("USK@eRHt0ceFsHjRZ11j6dd68RSdIvfd8f9YjJLZ9lnhEyo,iJWjIWh6TkMZm1NY8qBranKTIuwsCPkVPG6T6c6ft-I,AQACAAE/Sone/0");
+               /* Bombe’s Sone. */
+               loadSone("USK@RuW~uAO35Ipne896-1OmaVJNPuYE4ZIB5oZ5ziaU57A,7rV3uiyztXBDt03DCoRiNwiGjgFCJuznM9Okc1opURU,AQACAAE/Sone/15");
+       }
+
+       /**
         * Loads the configuration.
         */
        @SuppressWarnings("unchecked")
@@ -720,10 +731,7 @@ public class Core extends AbstractService {
                boolean firstStart = configuration.getBooleanValue("FirstStart").getValue(true);
                if (firstStart) {
                        logger.log(Level.INFO, "First start of Sone, adding a couple of default Sones…");
-                       /* Sone’s Sone. */
-                       loadSone("USK@eRHt0ceFsHjRZ11j6dd68RSdIvfd8f9YjJLZ9lnhEyo,iJWjIWh6TkMZm1NY8qBranKTIuwsCPkVPG6T6c6ft-I,AQACAAE/Sone/0");
-                       /* Bombe’s Sone. */
-                       loadSone("USK@RuW~uAO35Ipne896-1OmaVJNPuYE4ZIB5oZ5ziaU57A,7rV3uiyztXBDt03DCoRiNwiGjgFCJuznM9Okc1opURU,AQACAAE/Sone/15");
+                       addDefaultSones();
                        try {
                                configuration.getBooleanValue("FirstStart").setValue(false);
                        } catch (ConfigurationException ce1) {
@@ -754,6 +762,7 @@ public class Core extends AbstractService {
                options.getBooleanOption("ReallyClearOnNextRestart").set(null);
                if (clearConfiguration) {
                        /* stop loading the configuration. */
+                       addDefaultSones();
                        return;
                }