Some TODO things done in analysis data.

This commit is contained in:
Rsl1122 2017-09-02 13:27:42 +03:00
parent 555840c238
commit bd7f2b809e
4 changed files with 18 additions and 25 deletions

View File

@ -49,7 +49,7 @@ public class AnalysisData extends RawData {
joinInfoPart = new JoinInfoPart();
playerCountPart = new PlayerCountPart();
playtimePart = new PlaytimePart();
killPart = new KillPart();
killPart = new KillPart(joinInfoPart);
tpsPart = new TPSPart();
activityPart = new ActivityPart(joinInfoPart, tpsPart);
worldPart = new WorldPart();

View File

@ -30,7 +30,7 @@ import java.util.stream.Collectors;
* ${playersNewAverageDay} - (Number)
* ${playersNewAverageWeek} - (Number)
* ${playersNewAverageMonth} - (Number)
* //TODO ${tableBodySessions}, ${sessionCount}, ${lastPeakTime}, ${playersLastPeak}, ${bestPeakTime}, ${playersBestPeak}
* //TODO ${tableBodySessions}
*
* @author Rsl1122
* @since 3.5.2

View File

@ -1,5 +1,10 @@
package main.java.com.djrapitops.plan.data.analysis;
import main.java.com.djrapitops.plan.data.Session;
import java.util.Collection;
import java.util.List;
/**
* Part responsible for all Death related analysis.
* <p>
@ -15,43 +20,32 @@ package main.java.com.djrapitops.plan.data.analysis;
*/
public class KillPart extends RawData {
private final JoinInfoPart joinInfoPart;
private long playerKills;
private long mobKills;
private long deaths;
public KillPart() {
public KillPart(JoinInfoPart joinInfoPart) {
this.joinInfoPart = joinInfoPart;
playerKills = 0;
mobKills = 0;
deaths = 0;
}
// TODO JoinInfo Part, sessions for kills.
@Override
public void analyse() {
addValue("deathCount", deaths);
List<Session> sessions = joinInfoPart.getAllSessions();
deaths += sessions.stream().mapToLong(Session::getDeaths).sum();
mobKills += sessions.stream().mapToLong(Session::getMobKills).sum();
playerKills += sessions.stream().map(Session::getPlayerKills).mapToLong(Collection::size).sum();
addValue("deathCount", this.deaths);
addValue("mobKillCount", mobKills);
addValue("killCount", playerKills);
}
/**
* Adds kills to the dataset.
*
* @param amount amount of kills
* @throws IllegalArgumentException if kills is null
*/
public void addKills(long amount) {
playerKills += amount;
}
public void addMobKills(long amount) {
mobKills += amount;
}
public void addDeaths(long amount) {
deaths += amount;
}
public long getPlayerKills() {
return playerKills;
}

View File

@ -14,7 +14,6 @@ import java.util.UUID;
* <p>
* Contains following placeholders after analyzed:
* ${playersTotal}
* //TODO ${playersOnline}, ${playersMax}
*
* @author Rsl1122
* @since 3.5.2