From ffec075d5355fbe296b467dfcf647da058c7a282 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 19 Nov 2016 13:54:51 -0500 Subject: [PATCH] Attempted to reintroduce metrics saving --- .../components/metrics/MetricsComponent.java | 12 ++++++++---- .../metrics/listeners/PlayerJoinListener.java | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/alisolarflare/components/metrics/MetricsComponent.java b/src/alisolarflare/components/metrics/MetricsComponent.java index 387734c..fc0673b 100644 --- a/src/alisolarflare/components/metrics/MetricsComponent.java +++ b/src/alisolarflare/components/metrics/MetricsComponent.java @@ -1,14 +1,20 @@ package alisolarflare.components.metrics; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.java.JavaPlugin; import alisolarflare.components.Component; import alisolarflare.components.metrics.commands.GetLoginMetrics; import alisolarflare.components.metrics.listeners.PlayerJoinListener; +import buttondevteam.lib.TBMCCoreAPI; public class MetricsComponent extends Component{ @@ -21,17 +27,15 @@ public class MetricsComponent extends Component{ registerListener(plugin, new PlayerJoinListener(this)); metricsList = new ArrayList(); - /* try { metricsYml = loadFileConfiguration(plugin, "metrics.yml"); metricsList = metricsYml.getStringList("playerLogins"); } catch (IOException | InvalidConfigurationException e) { TBMCCoreAPI.SendException("metrics.yml in AliPresents could not be created!", e); return; - }*/ + } } - /* private FileConfiguration loadFileConfiguration(JavaPlugin plugin, String fileName) throws FileNotFoundException, IOException, InvalidConfigurationException { File file = new File(plugin.getDataFolder(), fileName); @@ -46,5 +50,5 @@ public class MetricsComponent extends Component{ config.load(file); return config; - }*/ + } } diff --git a/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java b/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java index 45cbb20..b82b210 100644 --- a/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java +++ b/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java @@ -14,7 +14,7 @@ public class PlayerJoinListener implements Listener{ } @EventHandler public void onPlayerJoin(PlayerJoinEvent event){ - //module.saveData(module.metricsYml, "loginlog."+System.currentTimeMillis()+event.getPlayer().getName(), event.getPlayer().getName()); + module.saveData(module.metricsYml, "loginlog."+System.currentTimeMillis()+event.getPlayer().getName(), event.getPlayer().getName()); module.metricsList.add("loginlog."+System.currentTimeMillis()+event.getPlayer().getName()); }