Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
Chiss 2014-11-13 18:10:10 +11:00
commit 112f76a29a
5 changed files with 70 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public class ChampionsDominate extends Domination
this.DisableKillCommand = false; this.DisableKillCommand = false;
registerStatTrackers( registerStatTrackers(
new KillReasonStatTracker(this, "Backstab", "Assassination"), new KillReasonStatTracker(this, "Backstab", "Assassination", false),
new ElectrocutionStatTracker(this), new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this), new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)

View File

@ -67,7 +67,7 @@ public class ChampionsTDM extends TeamDeathmatch
registerStatTrackers( registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this), new KillAllOpposingStatTracker(this),
new KillReasonStatTracker(this, "Backstab", "Assassination"), new KillReasonStatTracker(this, "Backstab", "Assassination", false),
new ElectrocutionStatTracker(this), new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this), new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)

View File

@ -284,10 +284,10 @@ public class MineStrike extends TeamGame
}; };
registerStatTrackers( registerStatTrackers(
new KillReasonStatTracker(this, "Headshot", "BoomHeadshot"), new KillReasonStatTracker(this, "Headshot", "BoomHeadshot", true),
new KillAllOpposingMineStrikeRoundStatTracker(this), new KillAllOpposingMineStrikeRoundStatTracker(this),
new KaboomStatTracker(this), new KaboomStatTracker(this),
new KillReasonStatTracker(this, "Backstab", "Assassination"), new KillReasonStatTracker(this, "Backstab", "Assassination", false),
new MineStrikeLastAliveKillStatTracker(this), new MineStrikeLastAliveKillStatTracker(this),
new KillFastStatTracker(this, 4, 5, "KillingSpree"), new KillFastStatTracker(this, 4, 5, "KillingSpree"),
new KillsWithConditionStatTracker(this, "Blindfolded", ConditionType.BLINDNESS, "Flash Bang", 2) new KillsWithConditionStatTracker(this, "Blindfolded", ConditionType.BLINDNESS, "Flash Bang", 2)

View File

@ -1679,4 +1679,21 @@ public class SurvivalGames extends SoloGame
Scoreboard.Draw(); Scoreboard.Draw();
} }
@Override
public boolean IsLive()
{
return super.IsLive() && !isDeathMatchAboutToStart();
}
public boolean isDeathMatchAboutToStart()
{
if (!_deathmatchLive)
return false;
if (_deathmatchTime <= 0)
return false;
return true;
}
} }

View File

@ -1,5 +1,11 @@
package nautilus.game.arcade.stats; 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.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; 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.CombatComponent;
import mineplex.minecraft.game.core.combat.CombatDamage; import mineplex.minecraft.game.core.combat.CombatDamage;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.core.damage.DamageChange; import mineplex.minecraft.game.core.damage.DamageChange;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
@ -15,13 +22,42 @@ public class KillReasonStatTracker extends StatTracker<Game>
{ {
private final String _reason; private final String _reason;
private final String _statName; private final String _statName;
private final boolean _canBeDamagedByKilledPlayer;
private final Map<UUID, Set<UUID>> _damaged = new HashMap<>();
public KillReasonStatTracker(Game game, String reason, String statName) public KillReasonStatTracker(Game game, String reason, String statName, boolean canBeDamagedByKilledPlayer)
{ {
super(game); super(game);
_reason = reason; _reason = reason;
_statName = statName; _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<UUID> 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) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -50,6 +86,13 @@ public class KillReasonStatTracker extends StatTracker<Game>
if (player == null) if (player == null)
return; return;
if (!canBeDamagedByKilledPlayer())
{
Set<UUID> 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())) if (event.GetLog().GetLastDamager() != null && event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().contains(getReason()))
addStat(killer, getStatName(), 1, false, false); addStat(killer, getStatName(), 1, false, false);
else else
@ -84,4 +127,9 @@ public class KillReasonStatTracker extends StatTracker<Game>
{ {
return _reason; return _reason;
} }
public boolean canBeDamagedByKilledPlayer()
{
return _canBeDamagedByKilledPlayer;
}
} }