Attempted to reintroduce metrics saving

This commit is contained in:
alisolarflare 2016-11-19 13:54:51 -05:00
parent ce3101acf5
commit ffec075d53
2 changed files with 9 additions and 5 deletions

View file

@ -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<String>();
/*
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;
}*/
}
}

View file

@ -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());
}