From 5c3c9f5a8d243d8ebd5ccf36207653ad966c30cd Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Thu, 17 Nov 2016 18:55:29 -0500 Subject: [PATCH] Linked metrics up to main plugin --- src/alisolarflare/AliPresents.java | 16 +++++++++++----- ...{MetricsModule.java => MetricsComponent.java} | 10 ++++++---- .../components/metrics/commands/GetMetrics.java | 6 +++--- .../metrics/listeners/PlayerJoinListener.java | 9 +++++---- ...inigameModule.java => MinigameComponent.java} | 2 +- .../minigames/commands/JoinMinigame.java | 6 +++--- .../minigames/commands/LeaveMinigame.java | 6 +++--- .../minigames/commands/ListFighters.java | 6 +++--- 8 files changed, 35 insertions(+), 26 deletions(-) rename src/alisolarflare/components/metrics/{MetricsModule.java => MetricsComponent.java} (86%) rename src/alisolarflare/components/minigames/{MinigameModule.java => MinigameComponent.java} (92%) diff --git a/src/alisolarflare/AliPresents.java b/src/alisolarflare/AliPresents.java index a68d201..f895dfc 100644 --- a/src/alisolarflare/AliPresents.java +++ b/src/alisolarflare/AliPresents.java @@ -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()+ ")."); diff --git a/src/alisolarflare/components/metrics/MetricsModule.java b/src/alisolarflare/components/metrics/MetricsComponent.java similarity index 86% rename from src/alisolarflare/components/metrics/MetricsModule.java rename to src/alisolarflare/components/metrics/MetricsComponent.java index 9def30c..d6b6cca 100644 --- a/src/alisolarflare/components/metrics/MetricsModule.java +++ b/src/alisolarflare/components/metrics/MetricsComponent.java @@ -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 metricsList; @@ -24,16 +25,17 @@ public class MetricsModule extends Component{ public void register(JavaPlugin plugin){ registerCommand(plugin, new GetMetrics(this)); registerListener(plugin, new PlayerJoinListener(this)); + + metricsList = new ArrayList(); 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(); } private FileConfiguration loadFileConfiguration(JavaPlugin plugin, String fileName) throws FileNotFoundException, IOException, InvalidConfigurationException { diff --git a/src/alisolarflare/components/metrics/commands/GetMetrics.java b/src/alisolarflare/components/metrics/commands/GetMetrics.java index 9ca2186..d36579b 100644 --- a/src/alisolarflare/components/metrics/commands/GetMetrics.java +++ b/src/alisolarflare/components/metrics/commands/GetMetrics.java @@ -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; } diff --git a/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java b/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java index 9fa249b..953b5bb 100644 --- a/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java +++ b/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java @@ -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()); + } } diff --git a/src/alisolarflare/components/minigames/MinigameModule.java b/src/alisolarflare/components/minigames/MinigameComponent.java similarity index 92% rename from src/alisolarflare/components/minigames/MinigameModule.java rename to src/alisolarflare/components/minigames/MinigameComponent.java index 51e332c..aa9d96b 100644 --- a/src/alisolarflare/components/minigames/MinigameModule.java +++ b/src/alisolarflare/components/minigames/MinigameComponent.java @@ -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 fighters; private GameState gameState; diff --git a/src/alisolarflare/components/minigames/commands/JoinMinigame.java b/src/alisolarflare/components/minigames/commands/JoinMinigame.java index 304c407..f7169d5 100644 --- a/src/alisolarflare/components/minigames/commands/JoinMinigame.java +++ b/src/alisolarflare/components/minigames/commands/JoinMinigame.java @@ -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; } diff --git a/src/alisolarflare/components/minigames/commands/LeaveMinigame.java b/src/alisolarflare/components/minigames/commands/LeaveMinigame.java index a05199f..c286607 100644 --- a/src/alisolarflare/components/minigames/commands/LeaveMinigame.java +++ b/src/alisolarflare/components/minigames/commands/LeaveMinigame.java @@ -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; } diff --git a/src/alisolarflare/components/minigames/commands/ListFighters.java b/src/alisolarflare/components/minigames/commands/ListFighters.java index acf2a67..613d1fd 100644 --- a/src/alisolarflare/components/minigames/commands/ListFighters.java +++ b/src/alisolarflare/components/minigames/commands/ListFighters.java @@ -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; }