No more logging.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.garbagemule.MobArena;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.PriorityBlockingQueue;
|
||||
@@ -32,11 +31,6 @@ import com.garbagemule.MobArena.autostart.AutoStartTimer;
|
||||
import com.garbagemule.MobArena.events.*;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.leaderboards.Leaderboard;
|
||||
import com.garbagemule.MobArena.log.ArenaLog;
|
||||
import com.garbagemule.MobArena.log.LogSessionBuilder;
|
||||
import com.garbagemule.MobArena.log.LogTotalsBuilder;
|
||||
import com.garbagemule.MobArena.log.YMLSessionBuilder;
|
||||
import com.garbagemule.MobArena.log.YMLTotalsBuilder;
|
||||
import com.garbagemule.MobArena.region.ArenaRegion;
|
||||
import com.garbagemule.MobArena.repairable.*;
|
||||
import com.garbagemule.MobArena.spout.Spouty;
|
||||
@@ -57,7 +51,6 @@ public class ArenaImpl implements Arena
|
||||
private MobArena plugin;
|
||||
private String name;
|
||||
private World world;
|
||||
private File dir;
|
||||
|
||||
// Settings section of the config-file for this arena.
|
||||
private ConfigSection settings;
|
||||
@@ -102,12 +95,6 @@ public class ArenaImpl implements Arena
|
||||
private SheepBouncer sheepBouncer;
|
||||
private Map<Integer,List<ItemStack>> everyWaveMap, afterWaveMap;
|
||||
|
||||
// Logging
|
||||
private boolean logging;
|
||||
private ArenaLog log;
|
||||
private LogSessionBuilder sessionBuilder;
|
||||
private LogTotalsBuilder totalsBuilder;
|
||||
|
||||
// Misc
|
||||
private ArenaListener eventListener;
|
||||
private List<ItemStack> entryFee;
|
||||
@@ -129,7 +116,6 @@ public class ArenaImpl implements Arena
|
||||
|
||||
this.enabled = settings.getBoolean("enabled", false);
|
||||
this.protect = settings.getBoolean("protect", true);
|
||||
this.logging = settings.getBoolean("logging", true);
|
||||
this.running = false;
|
||||
this.edit = false;
|
||||
|
||||
@@ -179,14 +165,6 @@ public class ArenaImpl implements Arena
|
||||
String timeString = settings.getString("player-time-in-arena", "world");
|
||||
Time time = Enums.getEnumFromString(Time.class, timeString);
|
||||
this.timeStrategy = (time != null ? new TimeStrategyLocked(time) : new TimeStrategyNull());
|
||||
|
||||
if (logging) {
|
||||
this.dir = new File(plugin.getDataFolder() + File.separator + "arenas" + File.separator + name);
|
||||
this.sessionBuilder = new YMLSessionBuilder(new File(dir, "log_session.yml"));
|
||||
this.totalsBuilder = new YMLTotalsBuilder(new File(dir, "log_totals.yml"));
|
||||
|
||||
this.log = new ArenaLog(this, sessionBuilder, totalsBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -233,17 +211,6 @@ public class ArenaImpl implements Arena
|
||||
protect = value;
|
||||
settings.set("protect", protect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLogging() {
|
||||
return logging;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogging(boolean value) {
|
||||
logging = value;
|
||||
settings.set("logging", logging);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
@@ -396,11 +363,6 @@ public class ArenaImpl implements Arena
|
||||
return limitManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArenaLog getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -477,10 +439,8 @@ public class ArenaImpl implements Arena
|
||||
// Clear the classes in use map, as they're no longer needed
|
||||
limitManager.clearClassesInUse();
|
||||
|
||||
// Start logging
|
||||
// Reset rewards
|
||||
rewardManager.reset();
|
||||
if (logging)
|
||||
log.start();
|
||||
|
||||
// Initialize leaderboards and start displaying info.
|
||||
leaderboard.initialize();
|
||||
@@ -514,10 +474,6 @@ public class ArenaImpl implements Arena
|
||||
leaderboard.stopTracking();
|
||||
leaderboard.update();
|
||||
|
||||
// Finish logging
|
||||
if (logging)
|
||||
log.end();
|
||||
|
||||
// Stop spawning.
|
||||
stopSpawner();
|
||||
|
||||
@@ -633,16 +589,12 @@ public class ArenaImpl implements Arena
|
||||
removeClassPermissions(p);
|
||||
removePotionEffects(p);
|
||||
|
||||
ArenaPlayer ap = arenaPlayerMap.get(p);
|
||||
if (logging)
|
||||
if (ap != null && running)
|
||||
log.playerDeath(ap);
|
||||
|
||||
restoreInvAndExp(p);
|
||||
if (inLobby(p) || inArena(p)) {
|
||||
refund(p);
|
||||
}
|
||||
|
||||
|
||||
ArenaPlayer ap = arenaPlayerMap.get(p);
|
||||
if (inLobby(p)) {
|
||||
if (ap.getArenaClass() != null) {
|
||||
limitManager.playerLeftClass(ap.getArenaClass());
|
||||
@@ -663,11 +615,6 @@ public class ArenaImpl implements Arena
|
||||
ArenaPlayerDeathEvent event = new ArenaPlayerDeathEvent(p, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
ArenaPlayer ap = arenaPlayerMap.get(p);
|
||||
if (logging)
|
||||
if (ap != null)
|
||||
log.playerDeath(ap);
|
||||
|
||||
arenaPlayers.remove(p);
|
||||
|
||||
if (!settings.getBoolean("auto-respawn", true)) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.garbagemule.MobArena.MobArena;
|
||||
import com.garbagemule.MobArena.MonsterManager;
|
||||
import com.garbagemule.MobArena.RewardManager;
|
||||
import com.garbagemule.MobArena.leaderboards.Leaderboard;
|
||||
import com.garbagemule.MobArena.log.ArenaLog;
|
||||
import com.garbagemule.MobArena.region.ArenaRegion;
|
||||
import com.garbagemule.MobArena.repairable.Repairable;
|
||||
import com.garbagemule.MobArena.util.config.ConfigSection;
|
||||
@@ -49,10 +48,6 @@ public interface Arena
|
||||
|
||||
public void setProtected(boolean value);
|
||||
|
||||
public boolean isLogging();
|
||||
|
||||
public void setLogging(boolean value);
|
||||
|
||||
public boolean isRunning();
|
||||
|
||||
public boolean inEditMode();
|
||||
@@ -109,8 +104,6 @@ public interface Arena
|
||||
|
||||
public void revivePlayer(Player p);
|
||||
|
||||
public ArenaLog getLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.garbagemule.MobArena.log;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.garbagemule.MobArena.ArenaPlayer;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.util.MutableInt;
|
||||
|
||||
public class ArenaLog
|
||||
{
|
||||
private Arena arena;
|
||||
private LogSessionBuilder sessionBuilder;
|
||||
private LogTotalsBuilder totalsBuilder;
|
||||
|
||||
public ArenaLog(Arena arena, LogSessionBuilder sessionBuilder, LogTotalsBuilder totalsBuilder) {
|
||||
this.arena = arena;
|
||||
this.sessionBuilder = sessionBuilder;
|
||||
this.totalsBuilder = totalsBuilder;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
// Log number of players.
|
||||
sessionBuilder.buildNumberOfPlayers(arena.getPlayersInArena().size());
|
||||
|
||||
// Log the distribution of classes.
|
||||
Map<String,MutableInt> classDistribution = new HashMap<String,MutableInt>();
|
||||
for (String classname : arena.getClasses().keySet()) {
|
||||
classDistribution.put(classname, new MutableInt());
|
||||
}
|
||||
for (ArenaPlayer ap : arena.getArenaPlayerSet()) {
|
||||
classDistribution.get(ap.getArenaClass().getLowercaseName()).inc();
|
||||
}
|
||||
sessionBuilder.buildClassDistribution(classDistribution);
|
||||
totalsBuilder.updateClassDistribution(classDistribution);
|
||||
|
||||
// Log the current time and set it as the start time.
|
||||
sessionBuilder.buildStartTime();
|
||||
totalsBuilder.recordStartTime();
|
||||
}
|
||||
|
||||
public void end() {
|
||||
// Log the end time and duration
|
||||
sessionBuilder.buildEndTime();
|
||||
sessionBuilder.buildDuration();
|
||||
|
||||
totalsBuilder.updateTimePlayed();
|
||||
totalsBuilder.updateSessionsPlayed();
|
||||
|
||||
// Update the last wave.
|
||||
totalsBuilder.updateLastWave(arena.getWaveManager().getWaveNumber());
|
||||
|
||||
// Finalize the session.
|
||||
sessionBuilder.finalize();
|
||||
totalsBuilder.finish();
|
||||
}
|
||||
|
||||
public void playerDeath(ArenaPlayer ap) {
|
||||
ArenaLogPlayerEntry entry = ArenaLogPlayerEntry.create(ap);
|
||||
sessionBuilder.buildPlayerEntry(entry, arena.getRewardManager().getRewards(ap.getPlayer()));
|
||||
totalsBuilder.updatePlayerEntry(entry);
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.garbagemule.MobArena.log;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.garbagemule.MobArena.ArenaPlayer;
|
||||
import com.garbagemule.MobArena.ArenaPlayerStatistics;
|
||||
|
||||
public class ArenaLogPlayerEntry
|
||||
{
|
||||
/**
|
||||
* Player name is used as a unique ID.
|
||||
*/
|
||||
protected String playername, classname;
|
||||
|
||||
/**
|
||||
* All recordable statistics.
|
||||
*/
|
||||
protected int kills, dmgDone, dmgTaken, swings, hits, lastWave;
|
||||
|
||||
/**
|
||||
* The time at which the player left or died.
|
||||
*/
|
||||
protected long leaveTime;
|
||||
|
||||
/**
|
||||
* Total amounts of each item rewarded.
|
||||
*/
|
||||
protected Map<Material,Integer> rewards;
|
||||
|
||||
private ArenaLogPlayerEntry() {}
|
||||
|
||||
public static ArenaLogPlayerEntry create(ArenaPlayer ap) {
|
||||
ArenaLogPlayerEntry entry = new ArenaLogPlayerEntry();
|
||||
|
||||
entry.playername = ap.getPlayer().getName();
|
||||
entry.classname = ap.getArenaClass().getLowercaseName();
|
||||
|
||||
ArenaPlayerStatistics stats = ap.getStats();
|
||||
entry.kills = stats.getInt("kills");
|
||||
entry.dmgDone = stats.getInt("dmgDone");
|
||||
entry.dmgTaken = stats.getInt("dmgTaken");
|
||||
entry.swings = stats.getInt("swings");
|
||||
entry.hits = stats.getInt("hits");
|
||||
entry.lastWave = stats.getInt("lastWave");
|
||||
|
||||
entry.leaveTime = (new Date()).getTime();
|
||||
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.garbagemule.MobArena.log;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.garbagemule.MobArena.util.MutableInt;
|
||||
|
||||
public interface LogSessionBuilder
|
||||
{
|
||||
/**
|
||||
* Builds the start time of this session.
|
||||
* The method should be called as soon as the session starts, or as soon
|
||||
* as possible right after for the most precise results.
|
||||
*/
|
||||
public void buildStartTime();
|
||||
|
||||
/**
|
||||
* Builds the start time of this session.
|
||||
* The method should be called as soon as the session ends, or as soon as
|
||||
* possible right after for the most precise results.
|
||||
* @param end the start time
|
||||
*/
|
||||
public void buildEndTime();
|
||||
|
||||
/**
|
||||
* Builds the duration of this session by creating a duration string on
|
||||
* the form HH:MM:SS using the provided start and end times.
|
||||
* PRECONDITION: buildStartTime() and buildEndTime() must be called before
|
||||
* calling this method.
|
||||
*/
|
||||
public void buildDuration();
|
||||
|
||||
/**
|
||||
* Builds the last reached wave of this session.
|
||||
* @param lastWave the wave number of the last reached wave
|
||||
*/
|
||||
public void buildLastWave(int lastWave);
|
||||
|
||||
/**
|
||||
* Builds the number of players that participated in this session.
|
||||
* @param amount the amount of players
|
||||
*/
|
||||
public void buildNumberOfPlayers(int amount);
|
||||
|
||||
/**
|
||||
* Builds the distribution of players over all classes.
|
||||
* @param classDistribution class names mapped to number of players per class
|
||||
*/
|
||||
public void buildClassDistribution(Map<String,MutableInt> classDistribution);
|
||||
|
||||
/**
|
||||
* Builds a player entry when a player has left/died.
|
||||
* @param entry the log entry to build
|
||||
* @param rewards a list of rewards given to the player in question
|
||||
*/
|
||||
public void buildPlayerEntry(ArenaLogPlayerEntry entry, List<ItemStack> rewards);
|
||||
|
||||
/**
|
||||
* Finalizes the session log, possibly writing it to disk or updating a database.
|
||||
* The method should only be called when no more changes are expected.
|
||||
* Behavior is undefined for the other methods after calling this method.
|
||||
*/
|
||||
public void finalize();
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.garbagemule.MobArena.log;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.garbagemule.MobArena.util.MutableInt;
|
||||
|
||||
public interface LogTotalsBuilder
|
||||
{
|
||||
/**
|
||||
* Store the start time of the current session.
|
||||
* Used to add to the total time played per player.
|
||||
*/
|
||||
public void recordStartTime();
|
||||
|
||||
/**
|
||||
* Update the total time played in this arena.
|
||||
* PRECONDITION: recordStartTime() must have been called first.
|
||||
*/
|
||||
public void updateTimePlayed();
|
||||
|
||||
/**
|
||||
* Increment the total number of sessions played.
|
||||
* The method should be called once per session and no more.
|
||||
*/
|
||||
public void updateSessionsPlayed();
|
||||
|
||||
/**
|
||||
* Update the last wave recorded to be the maximum of the current last wave
|
||||
* and the last wave of the last session.
|
||||
* @param wave last wave of the last session
|
||||
*/
|
||||
public void updateLastWave(int lastWave);
|
||||
|
||||
/**
|
||||
* Update the total distribution of players over all classes.
|
||||
* @param classDistribution class names mapped to number of players per class
|
||||
*/
|
||||
public void updateClassDistribution(Map<String,MutableInt> classDistribution);
|
||||
|
||||
/**
|
||||
* Update the totals for a specific player given a log entry.
|
||||
* @param entry a log entry
|
||||
*/
|
||||
public void updatePlayerEntry(ArenaLogPlayerEntry entry);
|
||||
|
||||
/**
|
||||
* Finish updating the totals. Calling this method makes all changes permanent
|
||||
* and resets the builder, making it ready for updates for the next session.
|
||||
*/
|
||||
public void finish();
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package com.garbagemule.MobArena.log;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import com.garbagemule.MobArena.util.MutableInt;
|
||||
import com.garbagemule.MobArena.util.TimeUtils;
|
||||
import com.garbagemule.MobArena.util.config.Config;
|
||||
|
||||
public class YMLSessionBuilder implements LogSessionBuilder
|
||||
{
|
||||
private final String GENERAL = "general-info";
|
||||
private final String PLAYERS = "players";
|
||||
private final String CLASSES = "class-distribution";
|
||||
|
||||
private Config config;
|
||||
private long start, end;
|
||||
|
||||
public YMLSessionBuilder(File file) {
|
||||
config = new Config(file);
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildStartTime() {
|
||||
start = new Date().getTime();
|
||||
config.set(GENERAL + ".start-time", TimeUtils.toDateTime(start));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildEndTime() {
|
||||
end = new Date().getTime();
|
||||
config.set(GENERAL + ".end-time", TimeUtils.toDateTime(end));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDuration() {
|
||||
String duration = TimeUtils.toTime(end - start);
|
||||
config.set(GENERAL + ".duration", duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildLastWave(int lastWave) {
|
||||
config.set(GENERAL + ".last-wave", lastWave);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildNumberOfPlayers(int amount) {
|
||||
config.set(GENERAL + ".number-of-players", amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildClassDistribution(Map<String,MutableInt> classDistribution) {
|
||||
for (Entry<String,MutableInt> entry : classDistribution.entrySet()) {
|
||||
int amount = entry.getValue().value();
|
||||
config.set(CLASSES + "." + entry.getKey(), amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildPlayerEntry(ArenaLogPlayerEntry entry, List<ItemStack> rewards) {
|
||||
String path = PLAYERS + "." + entry.playername + ".";
|
||||
|
||||
// Name and class
|
||||
config.set(path + "name", entry.playername);
|
||||
config.set(path + "class", entry.classname);
|
||||
|
||||
// Stats
|
||||
config.set(path + "kills", entry.kills);
|
||||
config.set(path + "damage-done", entry.dmgDone);
|
||||
config.set(path + "damage-taken", entry.dmgTaken);
|
||||
config.set(path + "swings", entry.swings);
|
||||
config.set(path + "hits", entry.hits);
|
||||
config.set(path + "last-wave", entry.lastWave);
|
||||
config.set(path + "time-played", TimeUtils.toTime(entry.leaveTime - start));
|
||||
|
||||
// Rewards
|
||||
Map<String,MutableInt> summed = new HashMap<String,MutableInt>();
|
||||
|
||||
for (ItemStack stack : rewards) {
|
||||
if (stack == null) continue;
|
||||
|
||||
String type = (stack.getTypeId() == MobArena.ECONOMY_MONEY_ID ? "money" : stack.getType().toString().toLowerCase());
|
||||
if (!summed.containsKey(type)) {
|
||||
summed.put(type, new MutableInt());
|
||||
}
|
||||
summed.get(type).add(stack.getAmount());
|
||||
}
|
||||
|
||||
for (Entry<String,MutableInt> e : summed.entrySet()) {
|
||||
config.set(path + "rewards." + e.getKey(), e.getValue().value());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalize() {
|
||||
config.save();
|
||||
reset();
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
if(config.get(GENERAL) != null)
|
||||
config.set(GENERAL, null);
|
||||
if(config.get(CLASSES) != null)
|
||||
config.set(CLASSES, null);
|
||||
if(config.get(PLAYERS) != null)
|
||||
config.set(PLAYERS, null);
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.garbagemule.MobArena.log;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.garbagemule.MobArena.util.MutableInt;
|
||||
import com.garbagemule.MobArena.util.TimeUtils;
|
||||
import com.garbagemule.MobArena.util.config.Config;
|
||||
|
||||
public class YMLTotalsBuilder implements LogTotalsBuilder
|
||||
{
|
||||
private final String GENERAL = "general-info.";
|
||||
private final String PLAYERS = "players.";
|
||||
private final String CLASSES = "class-distribution.";
|
||||
|
||||
private Config config;
|
||||
private long start;
|
||||
|
||||
public YMLTotalsBuilder(File file) {
|
||||
config = new Config(file);
|
||||
if (file.exists()) {
|
||||
config.load();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordStartTime() {
|
||||
start = new Date().getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSessionsPlayed() {
|
||||
String path = GENERAL + "sessions-played";
|
||||
int games = config.getInt(path, 0);
|
||||
config.set(path, games + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTimePlayed() {
|
||||
long end = new Date().getTime();
|
||||
String duration = TimeUtils.toTime(end - start);
|
||||
|
||||
String path = GENERAL + "time-played";
|
||||
String old = config.getString(path, "00:00:00");
|
||||
config.set(path, TimeUtils.addTimes(old, duration));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastWave(int lastWave) {
|
||||
String path = GENERAL + "last-wave";
|
||||
int old = config.getInt(path, 0);
|
||||
config.set(path, Math.max(old, lastWave));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateClassDistribution(Map<String, MutableInt> classDistribution) {
|
||||
for (Entry<String,MutableInt> entry : classDistribution.entrySet()) {
|
||||
String path = CLASSES + entry.getKey();
|
||||
int old = config.getInt(path, 0);
|
||||
int amount = entry.getValue().value();
|
||||
config.set(path, old + amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlayerEntry(ArenaLogPlayerEntry entry) {
|
||||
String path = PLAYERS + entry.playername + ".";
|
||||
|
||||
// Name and class
|
||||
config.set(path + "name", entry.playername);
|
||||
int old = config.getInt(path + "classes." + entry.classname, 0);
|
||||
config.set(path + "classes." + entry.classname, old + 1);
|
||||
|
||||
// All stats
|
||||
old = config.getInt(path + "kills", 0);
|
||||
config.set(path + "kills", old + entry.kills);
|
||||
|
||||
old = config.getInt(path + "damage-done", 0);
|
||||
config.set(path + "damage-done", old + entry.dmgDone);
|
||||
|
||||
old = config.getInt(path + "damage-taken", 0);
|
||||
config.set(path + "damage-taken", old + entry.dmgTaken);
|
||||
|
||||
old = config.getInt(path + "swings", 0);
|
||||
config.set(path + "swings", old + entry.swings);
|
||||
|
||||
old = config.getInt(path + "hits", 0);
|
||||
config.set(path + "hits", old + entry.hits);
|
||||
|
||||
old = config.getInt(path + "games-played", 0);
|
||||
config.set(path + "games-played", old + 1);
|
||||
|
||||
old = config.getInt(path + "last-wave", 0);
|
||||
config.set(path + "last-wave", Math.max(old, entry.lastWave));
|
||||
|
||||
// Time played
|
||||
long end = new Date().getTime();
|
||||
String session = TimeUtils.toTime(end - start);
|
||||
String played = config.getString(path + "time-played", "00:00:00");
|
||||
config.set(path + "time-played", TimeUtils.addTimes(played, session));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user