Linked metrics up to main plugin

This commit is contained in:
alisolarflare 2016-11-17 18:55:29 -05:00
parent c2f7726ed1
commit 5c3c9f5a8d
8 changed files with 35 additions and 26 deletions

View file

@ -10,8 +10,11 @@ import alisolarflare.components.alilinks.AliLinkComponent;
import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
import alisolarflare.components.easyuhc.EasyUHCComponent;
import alisolarflare.components.flairdoor.FlairDoorComponent;
import alisolarflare.components.gpowers.GPowerComponent;
import alisolarflare.components.insurance.InsuranceComponent;
import alisolarflare.components.magic.MagicComponent;
import alisolarflare.components.minigames.MinigameModule;
import alisolarflare.components.metrics.MetricsComponent;
import alisolarflare.components.minigames.MinigameComponent;
public class AliPresents extends JavaPlugin{
public void onEnable(){
@ -21,12 +24,15 @@ public class AliPresents extends JavaPlugin{
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
new FlairDoorComponent().register(this);
new AliLinkComponent().register(this);
new EasyUHCComponent().register(this);
new MagicComponent().register(this);
new MinigameModule().register(this);
new CreativeBoundariesComponent().register(this);
new EasyUHCComponent().register(this);
new FlairDoorComponent().register(this);
new GPowerComponent().register(this);
new InsuranceComponent().register(this);
new MagicComponent().register(this);
new MetricsComponent().register(this);
new MinigameComponent().register(this);
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");

View file

@ -14,8 +14,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.Component;
import alisolarflare.components.metrics.commands.GetMetrics;
import alisolarflare.components.metrics.listeners.PlayerJoinListener;
import buttondevteam.lib.TBMCCoreAPI;
public class MetricsModule extends Component{
public class MetricsComponent extends Component{
public FileConfiguration metricsYml; // DATA - STRING
public List<String> metricsList;
@ -25,15 +26,16 @@ public class MetricsModule extends Component{
registerCommand(plugin, new GetMetrics(this));
registerListener(plugin, new PlayerJoinListener(this));
metricsList = new ArrayList<String>();
try {
metricsYml = loadFileConfiguration(plugin, "metrics.yml");
metricsList = metricsYml.getStringList("playerLogins");
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
TBMCCoreAPI.SendException("metrics.yml in AliPresents could not be created!", e);
return;
}
//metricsList = metricsYml.getStringList("playerLogins");
metricsList = new ArrayList<String>();
}
private FileConfiguration loadFileConfiguration(JavaPlugin plugin, String fileName) throws FileNotFoundException, IOException, InvalidConfigurationException {

View file

@ -4,13 +4,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.components.ModCommand;
import alisolarflare.components.metrics.MetricsModule;
import alisolarflare.components.metrics.MetricsComponent;
public class GetMetrics extends ModCommand{
private MetricsModule module;
private MetricsComponent module;
public GetMetrics(MetricsModule metricsModule) {
public GetMetrics(MetricsComponent metricsModule) {
this.module = metricsModule;
}

View file

@ -5,18 +5,19 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import alisolarflare.components.BaseCommand;
import alisolarflare.components.metrics.MetricsModule;
import alisolarflare.components.metrics.MetricsComponent;
public class PlayerJoinListener implements Listener{
private MetricsModule module;
public PlayerJoinListener(MetricsModule module){
private MetricsComponent module;
public PlayerJoinListener(MetricsComponent module){
this.module = module;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
BaseCommand.SendDebugPotato(event.getPlayer(), "loginlog."+System.currentTimeMillis()+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());
BaseCommand.SendDebugPotato(event.getPlayer(), "loginlog."+System.currentTimeMillis()+event.getPlayer().getName());
}
}

View file

@ -11,7 +11,7 @@ import alisolarflare.components.minigames.commands.ListFighters;
import alisolarflare.components.minigames.commands.SetColourSpawn;
import alisolarflare.components.minigames.data.SpawnSet;
public class MinigameModule extends Component{
public class MinigameComponent extends Component{
public SpawnSet spawnSet;
public List<String> fighters;
private GameState gameState;

View file

@ -3,12 +3,12 @@ package alisolarflare.components.minigames.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.components.PlayerCommand;
import alisolarflare.components.minigames.MinigameModule;
import alisolarflare.components.minigames.MinigameComponent;
public class JoinMinigame extends PlayerCommand {
private MinigameModule module;
private MinigameComponent module;
public JoinMinigame(MinigameModule module) {
public JoinMinigame(MinigameComponent module) {
this.module = module;
}

View file

@ -4,13 +4,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.components.PlayerCommand;
import alisolarflare.components.minigames.MinigameModule;
import alisolarflare.components.minigames.MinigameComponent;
public class LeaveMinigame extends PlayerCommand {
private MinigameModule module;
private MinigameComponent module;
public LeaveMinigame(MinigameModule module) {
public LeaveMinigame(MinigameComponent module) {
this.module = module;
}

View file

@ -3,12 +3,12 @@ package alisolarflare.components.minigames.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.components.PlayerCommand;
import alisolarflare.components.minigames.MinigameModule;
import alisolarflare.components.minigames.MinigameComponent;
public class ListFighters extends PlayerCommand {
private MinigameModule lobby;
private MinigameComponent lobby;
public ListFighters(MinigameModule lobby) {
public ListFighters(MinigameComponent lobby) {
this.lobby = lobby;
}