Skip to content

Commit

Permalink
Remove present checks and update getters
Browse files Browse the repository at this point in the history
Signed-off-by: Pugzy <[email protected]>
  • Loading branch information
Pugzy committed Aug 8, 2023
1 parent 2bae890 commit 8f887cc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/src/main/java/tc/oc/pgm/stats/StatsMatchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -52,7 +53,6 @@
import tc.oc.pgm.api.player.event.MatchPlayerDeathEvent;
import tc.oc.pgm.api.setting.SettingKey;
import tc.oc.pgm.api.setting.SettingValue;
import tc.oc.pgm.controlpoint.events.ControlPointEvent;
import tc.oc.pgm.core.CoreLeakEvent;
import tc.oc.pgm.destroyable.DestroyableDestroyedEvent;
import tc.oc.pgm.destroyable.DestroyableHealthChange;
Expand Down Expand Up @@ -107,11 +107,11 @@ public StatsMatchModule(Match match) {
this.match = match;
}

public Map<UUID, PlayerStats> getGlobalStats() {
return allPlayerStats;
public Map<UUID, PlayerStats> getStats() {
return Collections.unmodifiableMap(allPlayerStats);
}

public Table<Team, UUID, PlayerStats> getStats() {
public Table<Team, UUID, PlayerStats> getParticipationStats() {
return Tables.unmodifiableTable(stats);
}

Expand Down Expand Up @@ -172,15 +172,14 @@ public void onCoreLeak(CoreLeakEvent event) {
.forEach(
leaker -> {
if (leaker.getPlayerState() != null) {
// TODO: wrong method
getPlayerStat(leaker.getPlayerState()).onCoreLeak();
}
});
}

@EventHandler(priority = EventPriority.MONITOR)
public void onGoalTouch(GoalTouchEvent event) {
if (event.getPlayer() == null || !event.getPlayer().getPlayer().isPresent()) return;
if (event.getPlayer() == null) return;

if (event.getGoal() instanceof MonumentWool) {
if (event.isFirstForPlayer()) {
Expand All @@ -195,7 +194,7 @@ public void onGoalTouch(GoalTouchEvent event) {

@EventHandler(priority = EventPriority.MONITOR)
public void onWoolCapture(PlayerWoolPlaceEvent event) {
if (event.getPlayer() != null && event.getPlayer().getPlayer().isPresent()) {
if (event.getPlayer() != null) {
getPlayerStat(event.getPlayer()).onWoolCapture();
}
}
Expand Down

0 comments on commit 8f887cc

Please sign in to comment.