diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index d1520a970..59f2f34d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -67,7 +67,7 @@ public class ChampionsDominate extends Domination this.DisableKillCommand = false; registerStatTrackers( - new KillReasonStatTracker(this, "Backstab", "Assassination"), + new KillReasonStatTracker(this, "Backstab", "Assassination", false), new ElectrocutionStatTracker(this), new TheLongestShotStatTracker(this), new SeismicSlamStatTracker(this) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index be9446396..9af73ce5c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -67,7 +67,7 @@ public class ChampionsTDM extends TeamDeathmatch registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new KillAllOpposingStatTracker(this), - new KillReasonStatTracker(this, "Backstab", "Assassination"), + new KillReasonStatTracker(this, "Backstab", "Assassination", false), new ElectrocutionStatTracker(this), new TheLongestShotStatTracker(this), new SeismicSlamStatTracker(this) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index 1066109db..755d91281 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -284,10 +284,10 @@ public class MineStrike extends TeamGame }; registerStatTrackers( - new KillReasonStatTracker(this, "Headshot", "BoomHeadshot"), + new KillReasonStatTracker(this, "Headshot", "BoomHeadshot", true), new KillAllOpposingMineStrikeRoundStatTracker(this), new KaboomStatTracker(this), - new KillReasonStatTracker(this, "Backstab", "Assassination"), + new KillReasonStatTracker(this, "Backstab", "Assassination", false), new MineStrikeLastAliveKillStatTracker(this), new KillFastStatTracker(this, 4, 5, "KillingSpree"), new KillsWithConditionStatTracker(this, "Blindfolded", ConditionType.BLINDNESS, "Flash Bang", 2) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 048dd9f8f..5b162544b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -1679,4 +1679,21 @@ public class SurvivalGames extends SoloGame Scoreboard.Draw(); } + + @Override + public boolean IsLive() + { + return super.IsLive() && !isDeathMatchAboutToStart(); + } + + public boolean isDeathMatchAboutToStart() + { + if (!_deathmatchLive) + return false; + + if (_deathmatchTime <= 0) + return false; + + return true; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillReasonStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillReasonStatTracker.java index 291951292..84386faf2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillReasonStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillReasonStatTracker.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.stats; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -8,6 +14,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.CombatDamage; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.DamageChange; import nautilus.game.arcade.game.Game; @@ -15,13 +22,42 @@ public class KillReasonStatTracker extends StatTracker { private final String _reason; private final String _statName; + private final boolean _canBeDamagedByKilledPlayer; + private final Map> _damaged = new HashMap<>(); - public KillReasonStatTracker(Game game, String reason, String statName) + public KillReasonStatTracker(Game game, String reason, String statName, boolean canBeDamagedByKilledPlayer) { super(game); _reason = reason; _statName = statName; + _canBeDamagedByKilledPlayer = canBeDamagedByKilledPlayer; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCustomDamage(CustomDamageEvent event) + { + if (canBeDamagedByKilledPlayer()) + return; + + if (getGame().GetState() != Game.GameState.Live) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) + return; + + Set set = _damaged.get(damagee.getUniqueId()); + if (set == null) + { + set = new HashSet<>(); + _damaged.put(damagee.getUniqueId(), set); + } + set.add(damager.getUniqueId()); } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @@ -50,6 +86,13 @@ public class KillReasonStatTracker extends StatTracker if (player == null) return; + if (!canBeDamagedByKilledPlayer()) + { + Set set = _damaged.remove(killer.getUniqueId()); + if (set != null && set.contains(player.getUniqueId())) + return; + } + if (event.GetLog().GetLastDamager() != null && event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().contains(getReason())) addStat(killer, getStatName(), 1, false, false); else @@ -84,4 +127,9 @@ public class KillReasonStatTracker extends StatTracker { return _reason; } + + public boolean canBeDamagedByKilledPlayer() + { + return _canBeDamagedByKilledPlayer; + } }