Started work on a metrics system
Tracking player login events, etc
This commit is contained in:
parent
8f9a3b7457
commit
0f1e896722
15 changed files with 69 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
package alisolarflare.modules;
|
package alisolarflare.modules;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class Module{
|
public abstract class Module{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the module, when called by the JavaPlugin class. Call
|
* Registers the module, when called by the JavaPlugin class. Call
|
||||||
* registerCommand() and registerListener() within this method.
|
* registerCommand() and registerListener() within this method.
|
||||||
|
@ -47,4 +49,23 @@ public abstract class Module{
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveData(FileConfiguration config, String pathToData, Object data){
|
||||||
|
|
||||||
|
config.set("moduledata." + this.getClassName() + "." + pathToData, data);
|
||||||
|
}
|
||||||
|
public Object getData(FileConfiguration config, String pathToData, Object data){
|
||||||
|
return config.get("moduledata." + this.getClassName() + "." + pathToData, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName(){
|
||||||
|
Class<?> enclosingClass = getClass().getEnclosingClass();
|
||||||
|
String className = "nullModule";
|
||||||
|
if (enclosingClass != null) {
|
||||||
|
className = (enclosingClass.getName());
|
||||||
|
} else {
|
||||||
|
className = (getClass().getName());
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
16
src/alisolarflare/modules/metrics/MetricsModule.java
Normal file
16
src/alisolarflare/modules/metrics/MetricsModule.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package alisolarflare.modules.metrics;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import alisolarflare.modules.Module;
|
||||||
|
|
||||||
|
public class MetricsModule extends Module{
|
||||||
|
|
||||||
|
public FileConfiguration config;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
this.config = plugin.getConfig();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package alisolarflare.modules.metrics.listeners;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
|
|
||||||
|
import alisolarflare.modules.metrics.MetricsModule;
|
||||||
|
|
||||||
|
public class PlayerLoginListener implements Listener{
|
||||||
|
|
||||||
|
private MetricsModule module;
|
||||||
|
public PlayerLoginListener(MetricsModule module){
|
||||||
|
this.module = module;
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerLogin(PlayerLoginEvent event){
|
||||||
|
module.saveData(module.config, "loginlog."+System.currentTimeMillis(), event.getPlayer().getName());
|
||||||
|
event.getPlayer();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package graveyard.autouhc;
|
package graveyard.autouhc;
|
||||||
/**@deprecated*/
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import alisolarflare.modules.Module;
|
import alisolarflare.modules.Module;
|
||||||
import graveyard.autouhc.memory.MatchState;
|
import graveyard.autouhc.memory.MatchState;
|
||||||
import graveyard.autouhc.memory.UHCMatch;
|
import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
|
||||||
|
/**@deprecated*/
|
||||||
public class UHCModule extends Module {
|
public class UHCModule extends Module {
|
||||||
public UHCMatch match;
|
public UHCMatch match;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||||
import alisolarflare.modules.ModCommand;
|
import alisolarflare.modules.ModCommand;
|
||||||
import graveyard.autouhc.memory.MatchState;
|
import graveyard.autouhc.memory.MatchState;
|
||||||
import graveyard.autouhc.memory.UHCMatch;
|
import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
/**@deprecated*/
|
||||||
public class SetMatchState extends ModCommand{
|
public class SetMatchState extends ModCommand{
|
||||||
|
|
||||||
UHCMatch match;
|
UHCMatch match;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import graveyard.autouhc.memory.UHCMatch;
|
||||||
*
|
*
|
||||||
* @author Alisolarflare
|
* @author Alisolarflare
|
||||||
*/
|
*/
|
||||||
|
/**@deprecated*/
|
||||||
public class AddToUHC extends ModCommand {
|
public class AddToUHC extends ModCommand {
|
||||||
private UHCMatch match;
|
private UHCMatch match;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.modules.ModCommand;
|
import alisolarflare.modules.ModCommand;
|
||||||
import graveyard.autouhc.memory.UHCMatch;
|
import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
/**@deprecated*/
|
||||||
public class JoinUHC extends ModCommand{
|
public class JoinUHC extends ModCommand{
|
||||||
|
|
||||||
private UHCMatch match;
|
private UHCMatch match;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import alisolarflare.modules.ModCommand;
|
import alisolarflare.modules.ModCommand;
|
||||||
import graveyard.autouhc.memory.UHCMatch;
|
import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
/**@deprecated*/
|
||||||
public class ConfigureMatch extends ModCommand{
|
public class ConfigureMatch extends ModCommand{
|
||||||
|
|
||||||
public ConfigureMatch(UHCMatch match) {
|
public ConfigureMatch(UHCMatch match) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package graveyard.autouhc.intro;
|
package graveyard.autouhc.intro;
|
||||||
|
/**@deprecated*/
|
||||||
public class IntroductionCutscene {
|
public class IntroductionCutscene {
|
||||||
//TODO: Teleport all players to the area.
|
//TODO: Teleport all players to the area.
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import alisolarflare.modules.ModCommand;
|
import alisolarflare.modules.ModCommand;
|
||||||
import graveyard.autouhc.memory.UHCMatch;
|
import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
/**@deprecated*/
|
||||||
public class ScheduleMatch extends ModCommand{
|
public class ScheduleMatch extends ModCommand{
|
||||||
|
|
||||||
public ScheduleMatch(UHCMatch match) {
|
public ScheduleMatch(UHCMatch match) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
|
||||||
public class StartMatch extends ModCommand {
|
public class StartMatch extends ModCommand {
|
||||||
private UHCMatch match;
|
private UHCMatch match;
|
||||||
|
/**@deprecated*/
|
||||||
public StartMatch(UHCMatch match) {
|
public StartMatch(UHCMatch match) {
|
||||||
this.match = match;
|
this.match = match;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||||
* ghostie powers if an Ultrahardcore Match is going on,
|
* ghostie powers if an Ultrahardcore Match is going on,
|
||||||
* and it's time for powers to activate
|
* and it's time for powers to activate
|
||||||
*/
|
*/
|
||||||
|
/**@deprecated*/
|
||||||
public class MatchCyclingListener implements Listener {
|
public class MatchCyclingListener implements Listener {
|
||||||
public BukkitTask PowerCyclingTask;
|
public BukkitTask PowerCyclingTask;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package graveyard.autouhc.listeners;
|
package graveyard.autouhc.listeners;
|
||||||
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
/**@deprecated*/
|
||||||
public class MatchMainLoop extends BukkitRunnable{
|
public class MatchMainLoop extends BukkitRunnable{
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package graveyard.autouhc.memory;
|
package graveyard.autouhc.memory;
|
||||||
|
/**@deprecated*/
|
||||||
public enum MatchState {
|
public enum MatchState {
|
||||||
IDLE, //Idle: Configure Match, Wait: Schedule Match, Intro: Start Match
|
IDLE, //Idle: Configure Match, Wait: Schedule Match, Intro: Start Match
|
||||||
WAITING, //SETUP: Scheduled Time, INTRO: No Setup
|
WAITING, //SETUP: Scheduled Time, INTRO: No Setup
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
/**@deprecated*/
|
||||||
public class UHCMatch {
|
public class UHCMatch {
|
||||||
private FileConfiguration config;
|
private FileConfiguration config;
|
||||||
private MatchState matchState = MatchState.IDLE;
|
private MatchState matchState = MatchState.IDLE;
|
||||||
|
|
Loading…
Reference in a new issue