From f524568c392b40753bab4cc0308818d34e2ca9a3 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Thu, 11 Jan 2018 16:29:02 +0200 Subject: [PATCH] Bukkit & Bungee systems --- .../djrapitops/plan/system/BukkitSystem.java | 24 +++++++++++++++++++ .../djrapitops/plan/system/BungeeSystem.java | 24 +++++++++++++++++++ .../settings/config/BukkitConfigSystem.java | 5 ---- .../settings/config/BungeeConfigSystem.java | 5 ---- .../system/settings/config/ConfigSystem.java | 6 ++--- 5 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java create mode 100644 Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java new file mode 100644 index 000000000..af6032991 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java @@ -0,0 +1,24 @@ +/* + * Licence is provided in the jar as license.yml also here: + * https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml + */ +package com.djrapitops.plan.system; + +import com.djrapitops.plan.Plan; +import com.djrapitops.plan.system.file.FileSystem; +import com.djrapitops.plan.system.settings.config.BukkitConfigSystem; +import com.djrapitops.plan.system.update.VersionCheckSystem; + +/** + * Represents PlanSystem for Plan. + * + * @author Rsl1122 + */ +public class BukkitSystem extends PlanSystem { + + public BukkitSystem(Plan plugin) { + versionCheckSystem = new VersionCheckSystem(plugin.getVersion()); + fileSystem = new FileSystem(plugin); + configSystem = new BukkitConfigSystem(); + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java new file mode 100644 index 000000000..d516d5f7d --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java @@ -0,0 +1,24 @@ +/* + * Licence is provided in the jar as license.yml also here: + * https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml + */ +package com.djrapitops.plan.system; + +import com.djrapitops.plan.PlanBungee; +import com.djrapitops.plan.system.file.FileSystem; +import com.djrapitops.plan.system.settings.config.BungeeConfigSystem; +import com.djrapitops.plan.system.update.VersionCheckSystem; + +/** + * Represents PlanSystem for PlanBungee. + * + * @author Rsl1122 + */ +public class BungeeSystem extends PlanSystem { + + public BungeeSystem(PlanBungee plugin) { + versionCheckSystem = new VersionCheckSystem(plugin.getVersion()); + fileSystem = new FileSystem(plugin); + configSystem = new BungeeConfigSystem(); + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BukkitConfigSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BukkitConfigSystem.java index 23aedbdb1..509141b31 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BukkitConfigSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BukkitConfigSystem.java @@ -6,7 +6,6 @@ package com.djrapitops.plan.system.settings.config; import com.djrapitops.plan.system.file.FileSystem; -import java.io.File; import java.io.IOException; /** @@ -16,10 +15,6 @@ import java.io.IOException; */ public class BukkitConfigSystem extends ConfigSystem { - public BukkitConfigSystem(File configFile) { - super(configFile); - } - @Override protected void copyDefaults() throws IOException { config.copyDefaults(FileSystem.readFromResource("config.yml")); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BungeeConfigSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BungeeConfigSystem.java index 1948bd052..2b0d31671 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BungeeConfigSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/BungeeConfigSystem.java @@ -6,7 +6,6 @@ package com.djrapitops.plan.system.settings.config; import com.djrapitops.plan.system.file.FileSystem; -import java.io.File; import java.io.IOException; /** @@ -16,10 +15,6 @@ import java.io.IOException; */ public class BungeeConfigSystem extends ConfigSystem { - public BungeeConfigSystem(File configFile) { - super(configFile); - } - @Override protected void copyDefaults() throws IOException { config.copyDefaults(FileSystem.readFromResource("bungeeconfig.yml")); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java index 426931bc8..368f2ba62 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java @@ -8,12 +8,12 @@ import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.system.SubSystem; +import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.systems.Systems; import com.djrapitops.plan.utilities.NullCheck; import com.djrapitops.plugin.api.config.Config; import com.djrapitops.plugin.api.utility.log.Log; -import java.io.File; import java.io.IOException; /** @@ -27,8 +27,8 @@ public abstract class ConfigSystem implements SubSystem { protected final Locale locale; protected final Theme theme; - public ConfigSystem(File configFile) { - config = new Config(configFile); + public ConfigSystem() { + config = new Config(FileSystem.getConfigFile()); locale = new Locale(); theme = new Theme(); }