diff --git a/Plan/src/main/java/com/djrapitops/plan/data/KillData.java b/Plan/src/main/java/com/djrapitops/plan/data/PlayerKill.java similarity index 91% rename from Plan/src/main/java/com/djrapitops/plan/data/KillData.java rename to Plan/src/main/java/com/djrapitops/plan/data/PlayerKill.java index ffe0e7547..6d83aa9b3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/KillData.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/PlayerKill.java @@ -11,20 +11,20 @@ import java.util.UUID; * * @author Rsl1122 */ -public class KillData { +public class PlayerKill { private final UUID victim; private final long time; private final String weapon; /** - * Creates a KillData object with given parameters. + * Creates a PlayerKill object with given parameters. * * @param victim UUID of the victim. * @param weapon Weapon used. * @param time Epoch millisecond at which the kill occurred. */ - public KillData(UUID victim, String weapon, long time) { + public PlayerKill(UUID victim, String weapon, long time) { this.victim = victim; this.weapon = weapon; this.time = time; @@ -74,7 +74,7 @@ public class KillData { if (getClass() != obj.getClass()) { return false; } - final KillData other = (KillData) obj; + final PlayerKill other = (PlayerKill) obj; return this.time == other.time && Objects.equals(this.weapon, other.weapon) && Objects.equals(this.victim, other.victim); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/Session.java b/Plan/src/main/java/com/djrapitops/plan/data/Session.java index bdd683613..d156b9040 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/Session.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/Session.java @@ -30,7 +30,7 @@ public class Session { private WorldTimes worldTimes; private final long sessionStart; private long sessionEnd; - private List playerKills; + private List playerKills; private int mobKills; private int deaths; @@ -87,7 +87,7 @@ public class Session { worldTimes.updateState(world, gm, time); } - public void playerKilled(KillData kill) { + public void playerKilled(PlayerKill kill) { playerKills.add(kill); } @@ -130,7 +130,7 @@ public class Session { return worldTimes; } - public List getPlayerKills() { + public List getPlayerKills() { return playerKills; } @@ -185,7 +185,7 @@ public class Session { this.worldTimes = worldTimes; } - public void setPlayerKills(List playerKills) { + public void setPlayerKills(List playerKills) { this.playerKills = playerKills; } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/analysis/KillPart.java b/Plan/src/main/java/com/djrapitops/plan/data/analysis/KillPart.java index 8181c32e2..01fddf6a4 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/analysis/KillPart.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/analysis/KillPart.java @@ -1,7 +1,7 @@ package main.java.com.djrapitops.plan.data.analysis; import com.djrapitops.plugin.utilities.Verify; -import main.java.com.djrapitops.plan.data.KillData; +import main.java.com.djrapitops.plan.data.PlayerKill; import main.java.com.djrapitops.plan.utilities.MiscUtils; import java.util.HashMap; @@ -24,7 +24,7 @@ import java.util.UUID; */ public class KillPart extends RawData { - private final Map> playerKills; + private final Map> playerKills; private long mobKills; private long deaths; @@ -49,7 +49,7 @@ public class KillPart extends RawData { * @param kills all kills of a player * @throws IllegalArgumentException if kills is null */ - public void addKills(UUID uuid, List kills) { + public void addKills(UUID uuid, List kills) { Verify.nullCheck(kills); playerKills.put(uuid, kills); } @@ -62,11 +62,11 @@ public class KillPart extends RawData { deaths += amount; } - public Map> getPlayerKills() { + public Map> getPlayerKills() { return playerKills; } - public List getAllPlayerKills() { + public List getAllPlayerKills() { return MiscUtils.flatMap(playerKills.values()); } diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/KillsTable.java b/Plan/src/main/java/com/djrapitops/plan/database/tables/KillsTable.java index 99e524311..1b7c2f816 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/KillsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/database/tables/KillsTable.java @@ -2,7 +2,7 @@ package main.java.com.djrapitops.plan.database.tables; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.Log; -import main.java.com.djrapitops.plan.data.KillData; +import main.java.com.djrapitops.plan.data.PlayerKill; import main.java.com.djrapitops.plan.data.Session; import main.java.com.djrapitops.plan.database.databases.SQLDB; import main.java.com.djrapitops.plan.database.sql.Sql; @@ -74,7 +74,7 @@ public class KillsTable extends UserIDTable { } } - public void savePlayerKills(UUID uuid, long sessionID, List playerKills) throws SQLException { + public void savePlayerKills(UUID uuid, long sessionID, List playerKills) throws SQLException { if (Verify.isEmpty(playerKills)) { return; } @@ -90,7 +90,7 @@ public class KillsTable extends UserIDTable { + usersTable.statementSelectID + ", " + usersTable.statementSelectID + ", " + "?, ?, ?)"); - for (KillData kill : playerKills) { + for (PlayerKill kill : playerKills) { UUID victim = kill.getVictim(); long date = kill.getTime(); String weapon = kill.getWeapon(); @@ -133,7 +133,7 @@ public class KillsTable extends UserIDTable { UUID victim = UUID.fromString(uuidS); long date = set.getLong(columnDate); String weapon = set.getString(columnWeapon); - session.getPlayerKills().add(new KillData(victim, weapon, date)); + session.getPlayerKills().add(new PlayerKill(victim, weapon, date)); } } finally { close(set, statement); diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/KillProcessor.java b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/KillProcessor.java index 1b3d60c87..ee523cf35 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/KillProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/processing/player/KillProcessor.java @@ -1,7 +1,7 @@ package main.java.com.djrapitops.plan.systems.processing.player; import main.java.com.djrapitops.plan.Plan; -import main.java.com.djrapitops.plan.data.KillData; +import main.java.com.djrapitops.plan.data.PlayerKill; import main.java.com.djrapitops.plan.data.Session; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -13,7 +13,7 @@ import java.util.UUID; * Processor Class for KillEvent information when the killer is a * player. *

- * Adds KillData or a Mob kill to the active Session. + * Adds PlayerKill or a Mob kill to the active Session. * * @author Rsl1122 * @since 4.0.0 @@ -53,7 +53,7 @@ public class KillProcessor extends PlayerProcessor { if (dead instanceof Player) { Player deadPlayer = (Player) dead; - session.playerKilled(new KillData(deadPlayer.getUniqueId(), weaponName, time)); + session.playerKilled(new PlayerKill(deadPlayer.getUniqueId(), weaponName, time)); } else { session.mobKilled(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java index 18395eff4..2372971d3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java @@ -289,7 +289,7 @@ public class Analysis { // } else { // activity.addInActive(uuid); // } - //TODO List playerKills = uData.getPlayerKills(); + //TODO List playerKills = uData.getPlayerKills(); // List sessions = uData.getSessions(); // joinInfo.addSessions(uuid, sessions); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/KillDataComparator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/KillDataComparator.java index c50c08940..d4f196d41 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/KillDataComparator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/KillDataComparator.java @@ -1,16 +1,16 @@ package main.java.com.djrapitops.plan.utilities.comparators; -import main.java.com.djrapitops.plan.data.KillData; +import main.java.com.djrapitops.plan.data.PlayerKill; import java.util.Comparator; /** * @author Fuzzlemann */ -public class KillDataComparator implements Comparator { +public class KillDataComparator implements Comparator { @Override - public int compare(KillData o1, KillData o2) { + public int compare(PlayerKill o1, PlayerKill o2) { return Long.compare(o1.getTime(), o2.getTime()); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/KillsTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/KillsTableCreator.java index d1ea18333..72c4ac8ca 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/KillsTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/KillsTableCreator.java @@ -2,7 +2,7 @@ package main.java.com.djrapitops.plan.utilities.html.tables; import com.djrapitops.plugin.utilities.player.Fetch; import com.djrapitops.plugin.utilities.player.IOfflinePlayer; -import main.java.com.djrapitops.plan.data.KillData; +import main.java.com.djrapitops.plan.data.PlayerKill; import main.java.com.djrapitops.plan.locale.Locale; import main.java.com.djrapitops.plan.locale.Msg; import main.java.com.djrapitops.plan.utilities.FormatUtils; @@ -26,20 +26,20 @@ public class KillsTableCreator { } /** - * @param killData The list of the {@link KillData} Objects from which the kill table should be created + * @param playerKills The list of the {@link PlayerKill} Objects from which the kill table should be created * @return The created kills table */ - public static String createKillsTable(List killData) { + public static String createKillsTable(List playerKills) { StringBuilder html = new StringBuilder(Html.TABLE_KILLS_START.parse()); - if (killData.isEmpty()) { + if (playerKills.isEmpty()) { html.append(Html.TABLELINE_3.parse(Locale.get(Msg.HTML_TABLE_NO_KILLS).parse(), "", "")); } else { - killData.sort(new KillDataComparator()); - Collections.reverse(killData); + playerKills.sort(new KillDataComparator()); + Collections.reverse(playerKills); int i = 0; - for (KillData kill : killData) { + for (PlayerKill kill : playerKills) { if (i >= 20) { break; } diff --git a/Plan/test/test/java/main/java/com/djrapitops/plan/data/KillDataTest.java b/Plan/test/test/java/main/java/com/djrapitops/plan/data/PlayerKillTest.java similarity index 82% rename from Plan/test/test/java/main/java/com/djrapitops/plan/data/KillDataTest.java rename to Plan/test/test/java/main/java/com/djrapitops/plan/data/PlayerKillTest.java index 81e8e8aee..2e8b3d9a0 100644 --- a/Plan/test/test/java/main/java/com/djrapitops/plan/data/KillDataTest.java +++ b/Plan/test/test/java/main/java/com/djrapitops/plan/data/PlayerKillTest.java @@ -5,7 +5,7 @@ */ package test.java.main.java.com.djrapitops.plan.data; -import main.java.com.djrapitops.plan.data.KillData; +import main.java.com.djrapitops.plan.data.PlayerKill; import org.junit.Before; import org.junit.Test; @@ -16,21 +16,21 @@ import static org.junit.Assert.assertEquals; /** * @author Rsl1122 */ -public class KillDataTest { +public class PlayerKillTest { - private KillData test; + private PlayerKill test; private UUID testUUID; /** * */ - public KillDataTest() { + public PlayerKillTest() { } @Before public void setUp() throws Exception { testUUID = UUID.fromString("71cfb6f0-c3ef-4954-8abe-13fa07afc340"); - test = new KillData(testUUID, "TestWeapon", 100L); + test = new PlayerKill(testUUID, "TestWeapon", 100L); } /** diff --git a/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java b/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java index 1a088f93e..3ed3cb431 100644 --- a/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java +++ b/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java @@ -311,10 +311,10 @@ public class DatabaseTest { return new WorldTimes(times); } - private List createKills() { - List kills = new ArrayList<>(); - kills.add(new KillData(uuid2, "Iron Sword", 4321L)); - kills.add(new KillData(uuid2, "Gold Sword", 5321L)); + private List createKills() { + List kills = new ArrayList<>(); + kills.add(new PlayerKill(uuid2, "Iron Sword", 4321L)); + kills.add(new PlayerKill(uuid2, "Gold Sword", 5321L)); return kills; }