From 8267f9d6c363afdb68f28d84837cb05f95aacc0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 27 Oct 2010 19:22:27 +0200 Subject: [PATCH] =?utf8?q?Add=20=E2=80=9Cfirst=20start=E2=80=9D=20logic=20?= =?utf8?q?that=20adds=20a=20couple=20of=20default=20Sones.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/net/pterodactylus/sone/core/Core.java | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index b6dfdf3..ff50c84 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -717,6 +717,20 @@ public class Core extends AbstractService { private void loadConfiguration() { logger.entering(Core.class.getName(), "loadConfiguration()"); + 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"); + try { + configuration.getBooleanValue("FirstStart").setValue(false); + } catch (ConfigurationException ce1) { + logger.log(Level.WARNING, "Could not clear “first start” flag!"); + } + } + options.addIntegerOption("InsertionDelay", new DefaultOption(60, new OptionWatcher() { @Override @@ -726,9 +740,15 @@ public class Core extends AbstractService { })); - options.addBooleanOption("ClearOnNextRestart", new DefaultOption(false)).set(configuration.getBooleanValue("Option/ClearOnNextRestart").getValue(null)); - options.addBooleanOption("ReallyClearOnNextRestart", new DefaultOption(false)).set(configuration.getBooleanValue("Option/ReallyClearOnNextRestart").getValue(null)); + options.addBooleanOption("ClearOnNextRestart", new DefaultOption(false)); + options.addBooleanOption("ReallyClearOnNextRestart", new DefaultOption(false)); + + if (firstStart) { + return; + } + options.getBooleanOption("ClearOnNextRestart").set(configuration.getBooleanValue("Option/ClearOnNextRestart").getValue(null)); + options.getBooleanOption("ReallyClearOnNextRestart").set(configuration.getBooleanValue("Option/ReallyClearOnNextRestart").getValue(null)); boolean clearConfiguration = options.getBooleanOption("ClearOnNextRestart").get() && options.getBooleanOption("ReallyClearOnNextRestart").get(); options.getBooleanOption("ClearOnNextRestart").set(null); options.getBooleanOption("ReallyClearOnNextRestart").set(null); -- 2.7.4