New acheivements

This commit is contained in:
CoderTim 2014-10-10 21:49:03 -04:00
parent 4253c08682
commit 3422f48325
29 changed files with 1281 additions and 376 deletions

View File

@ -389,6 +389,12 @@ public enum Achievement
new int[]{50},
AchievementCategory.RUNNER),
RUNNER_MARATHON_RUNNER("Marathon Runner", 1000,
new String[]{"Runner.MarathonRunner"},
new String[]{"Run over 20,000 blocks"},
new int[]{20000},
AchievementCategory.RUNNER),
//Dragon Escape
DRAGON_ESCAPE_WINS("Douglas Defeater", 600,
new String[]{"Dragon Escape.Wins"},
@ -439,6 +445,12 @@ public enum Achievement
new int[]{1},
AchievementCategory.ONE_IN_THE_QUIVER),
OITQ_WHATS_A_BOW("What's A Bow?", 1200,
new String[]{"One in the Quiver.WhatsANow"},
new String[]{"Win a game without using a bow"},
new int[]{1},
AchievementCategory.ONE_IN_THE_QUIVER),
//Super Spleef
SPLEEF_WINS("Spleef King (or Queen)", 600,
new String[]{"Super Spleef.Wins"},
@ -460,6 +472,18 @@ public enum Achievement
new int[]{50},
AchievementCategory.SNEAKY_ASSASSINS),
SNEAK_ASSASSINS_MASTER_ASSASSIN("Master Assassin", 600,
new String[]{"Sneaky Assassins.MasterAssassin"},
new String[]{"Get Master Assassin 10 times"},
new int[]{10},
AchievementCategory.SNEAKY_ASSASSINS),
SNEAK_ASSASSINS_THE_MASTERS_MASTER("The Master's Master", 700,
new String[]{"Sneaky Assassins.TheMastersMaster"},
new String[]{"Kill a Master Assassin without having a single power-up."},
new int[]{1},
AchievementCategory.SNEAKY_ASSASSINS),
//Micro Battle
MICRO_BATTLE_WINS("Micro Champion", 600,
new String[]{"Micro Battle.Wins"},
@ -467,10 +491,11 @@ public enum Achievement
new int[]{100},
AchievementCategory.MICRO_BATTLE),
;
MICRO_BATTLE_ANNIHILATION("Annihilation", 1200,
new String[]{"Micro Battle.Annihilation"},
new String[]{"Kill 12 players in one game"},
new int[]{12},
AchievementCategory.MICRO_BATTLE),;
private String _name;
private String[] _desc;

View File

@ -41,10 +41,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
@ -67,7 +65,7 @@ import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.BridgesSniperStatTracker;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.FoodForTheMassesStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
@ -197,7 +195,7 @@ public class Bridge extends TeamGame implements OreObsfucation
new FoodForTheMassesStatTracker(this),
new BridgesSniperStatTracker(this),
new TntMinerStatTracker(this),
new FastKillsStatTracker(this, 4, 10, "Rampage"),
new KillFastStatTracker(this, 4, 10, "Rampage"),
new DeathBomberStatTracker(this)
);
}

View File

@ -59,7 +59,7 @@ public class ChampionsDominate extends Domination
EloStart = 1000;
registerStatTrackers(
new BackstabKillStatTracker(this),
new BackstabKillStatTracker(this, "Assassination"),
new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)

View File

@ -59,7 +59,7 @@ public class ChampionsTDM extends TeamDeathmatch
registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this),
new BackstabKillStatTracker(this),
new BackstabKillStatTracker(this, "Assassination"),
new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)

View File

@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
@ -24,8 +25,10 @@ import org.bukkit.entity.Painting;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ItemDespawnEvent;
@ -36,6 +39,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.painting.PaintingBreakEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
@ -91,6 +95,7 @@ import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Armor;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.grenades.HighExplosive;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
import nautilus.game.arcade.game.games.minestrike.items.guns.pistol.Glock18;
@ -101,6 +106,64 @@ import net.minecraft.server.v1_7_R4.EntityArrow;
public class MineStrike extends TeamGame
{
public static class PlayerHeadshotEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Player _shooter;
public PlayerHeadshotEvent(Player who, Player shooter)
{
super(who);
_shooter = shooter;
}
public Player getShooter()
{
return _shooter;
}
}
public static class RoundOverEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Game _game;
public RoundOverEvent(Game game)
{
_game = game;
}
public Game getGame()
{
return _game;
}
}
//Managers
private ShopManager _shopManager;
@ -1069,7 +1132,7 @@ public class MineStrike extends TeamGame
if (check.subtract(from).length() < 0.8)
{
//Damage
event.AddMod(damager.getName(), "Knife", 40 - event.GetDamage(), false);
event.AddMod(damager.getName(), "Knife (Backstab)", 40 - event.GetDamage(), false);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.IRONGOLEM_DEATH, 1f, 1f);
@ -1139,6 +1202,8 @@ public class MineStrike extends TeamGame
//Headshot
if (hitArea == 1)
{
Bukkit.getPluginManager().callEvent(new PlayerHeadshotEvent(bullet.Shooter, event.GetDamageePlayer()));
event.AddMod(bullet.Shooter.getName(), "Headshot", damage*2, true);
//Wearing Helmet
@ -1688,6 +1753,8 @@ public class MineStrike extends TeamGame
if (_roundOver)
return;
Bukkit.getPluginManager().callEvent(new RoundOverEvent(this));
_roundOver = true;
String winnerLine = C.Bold + "The round was a draw!";

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -8,6 +9,8 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
@ -21,6 +24,48 @@ import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
public abstract class Grenade extends StrikeItem
{
public static class GrenadeExplodeEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Grenade _grenade;
private final Player _thrower;
private final List<Player> _damagedPlayers;
public GrenadeExplodeEvent(Grenade grenade, Player thrower, List<Player> damagedPlayers)
{
_grenade = grenade;
_thrower = thrower;
_damagedPlayers = damagedPlayers;
}
public Grenade getGrenade()
{
return _grenade;
}
public List<Player> getDamagedPlayers()
{
return _damagedPlayers;
}
public Player getThrower()
{
return _thrower;
}
}
protected Player _thrower = null;
protected Vector _vel;

View File

@ -1,6 +1,8 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -9,6 +11,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Radio;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -38,6 +41,7 @@ public class HighExplosive extends Grenade
Sound.EXPLODE, 3f, 0.8f);
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 10);
List<Player> damagedPlayers = new ArrayList<>();
for (Player player : players.keySet())
{
if (!game.IsAlive(player))
@ -47,8 +51,12 @@ public class HighExplosive extends Grenade
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null,
DamageCause.CUSTOM, 1 + (players.get(player) * 18),
true, true, false, _thrower.getName(), getName());
damagedPlayers.add(player);
}
Bukkit.getPluginManager().callEvent(new GrenadeExplodeEvent(this, _thrower, damagedPlayers));
return true;
}

View File

@ -27,7 +27,6 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -56,7 +55,7 @@ import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.paintball.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.LastStandStatTracker;
import nautilus.game.arcade.stats.MedicStatTracker;
import nautilus.game.arcade.stats.WinFastStatTracker;
@ -118,7 +117,7 @@ public class Paintball extends TeamGame
this.HungerSet = 20;
registerStatTrackers(
new FastKillsStatTracker(this, 4, 5, "KillingSpree"),
new KillFastStatTracker(this, 4, 5, "KillingSpree"),
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new MedicStatTracker(this),
new WinFastStatTracker(this, 20, "Speedrunner"),

View File

@ -32,7 +32,7 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.FreeKitWinStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
@ -95,7 +95,7 @@ public class SuperSmash extends SoloGame
new WinWithoutDyingStatTracker(this, "MLGPro"),
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new FastKillsStatTracker(this, 3, 10, "TripleKill"),
new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
}

View File

@ -0,0 +1,41 @@
package nautilus.game.arcade.game.games.sneakyassassins.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class PlayerMasterAssassinEvent extends PlayerEvent implements Cancellable
{
private static final HandlerList _handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private boolean _cancelled = false;
@Override
public boolean isCancelled()
{
return _cancelled;
}
@Override
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public PlayerMasterAssassinEvent(Player who)
{
super(who);
}
}

View File

@ -7,6 +7,8 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import nautilus.game.arcade.game.Game.*;
import nautilus.game.arcade.game.games.sneakyassassins.event.PlayerMasterAssassinEvent;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
@ -189,6 +191,12 @@ public class PowerUpManager implements Listener
//Master
if (count == 4)
{
PlayerMasterAssassinEvent pmae = new PlayerMasterAssassinEvent(closestPlayer);
Bukkit.getPluginManager().callEvent(pmae);
if (!pmae.isCancelled())
{
PowerUpType.COMPASS.powerUpPlayer(closestPlayer, getRandom());
@ -198,6 +206,9 @@ public class PowerUpManager implements Listener
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
incrementPowerUpCount(closestPlayer);
}
}
//Armor + Weapon
else
@ -208,10 +219,10 @@ public class PowerUpManager implements Listener
UtilPlayer.message(closestPlayer, F.main("Game", "Your " + F.item("Sword") + " and " + F.item("Armor") + " have been upgraded!"));
getGame().Announce(F.main("Game", F.name(closestPlayer.getName()) + " collected a " + F.skill("Powerup") + "."));
}
incrementPowerUpCount(closestPlayer);
}
}
schedulePowerUpSpawn(10);
}

View File

@ -3,34 +3,28 @@ package nautilus.game.arcade.game.games.survivalgames;
import java.util.*;
import java.util.Map.Entry;
import mineplex.core.achievement.*;
import org.bukkit.*;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Firework;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@ -71,10 +65,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.survivalgames.kit.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker;
import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;

View File

@ -19,6 +19,36 @@ import java.util.*;
public class PerkRevealer extends Perk implements IThrown
{
public static class PlayerRevealEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final LivingEntity _revealer;
public PlayerRevealEvent(Player who, LivingEntity revealer)
{
super(who);
_revealer = revealer;
}
public LivingEntity getRevealer()
{
return _revealer;
}
}
private static final FireworkEffect REVEALER_FIREWORK_EFFECT = FireworkEffect
.builder()
.flicker(false)
@ -132,6 +162,8 @@ public class PerkRevealer extends Perk implements IThrown
if (info == null)
{
Bukkit.getPluginManager().callEvent(new PlayerRevealEvent(player, data.GetThrower()));
info = new RevealedPlayerInfo(Manager.GetDisguise().getDisguise(player));
getRevealedPlayers().put(player, info);

View File

@ -18,10 +18,13 @@ import nautilus.game.arcade.game.Game;
public class BackstabKillStatTracker extends StatTracker<Game>
{
private final Map<UUID, Set<UUID>> _hasDamaged = new HashMap<>();
private final String _statName;
public BackstabKillStatTracker(Game game)
public BackstabKillStatTracker(Game game, String statName)
{
super(game);
_statName = statName;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -55,7 +58,7 @@ public class BackstabKillStatTracker extends StatTracker<Game>
Set<UUID> hasDamaged = _hasDamaged.get(player.getUniqueId());
if (hasDamaged == null || !hasDamaged.contains(killer.getUniqueId()))
addStat(killer, "Assassination", 1, false, false);
addStat(killer, getStatName(), 1, false, false);
}
}
@ -78,4 +81,9 @@ public class BackstabKillStatTracker extends StatTracker<Game>
hasDamaged.add(event.GetDamageePlayer().getUniqueId());
}
}
public String getStatName()
{
return _statName;
}
}

View File

@ -0,0 +1,84 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerTeleportEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
public class DistanceTraveledStatTracker extends StatTracker<Game>
{
private final Map<Player, Location> _lastLocation = new HashMap<>();
private final Map<Player, Double> _distanceTraveled = new HashMap<>();
private final String _statName;
public DistanceTraveledStatTracker(Game game, String statName)
{
super(game);
_statName = statName;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.Live)
{
for (Player player : getGame().GetPlayers(true))
_lastLocation.put(player, player.getLocation());
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onUpdate(UpdateEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getType() == UpdateType.SEC)
{
for (Player player : getGame().GetPlayers(true))
{
Location lastLocation = _lastLocation.put(player, player.getLocation());
if (lastLocation != null && lastLocation.getWorld() == player.getLocation().getWorld())
{
Double distance = _distanceTraveled.get(player);
if (distance == null)
distance = 0.0;
_distanceTraveled.put(player, distance + lastLocation.distance(player.getLocation()));
}
}
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
_lastLocation.remove(event.getPlayer());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
for (Map.Entry<Player, Double> entry : _distanceTraveled.entrySet())
getGame().AddStat(entry.getKey(), getStatName(), (int) Math.round(entry.getValue()), false, false);
}
}
public String getStatName()
{
return _statName;
}
}

View File

@ -20,7 +20,7 @@ public class GamesPlayedStatTracker extends StatTracker<Game>
if (event.GetState() == Game.GameState.Live)
{
for (Player player : getGame().GetPlayers(true))
getGame().AddStat(player, "GamesPlayed", 1, false, true);
addStat(player, "GamesPlayed", 1, false, true);
}
}
}

View File

@ -0,0 +1,30 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
public class HeadShotStatTracker extends StatTracker<Game>
{
private final String _statName;
public HeadShotStatTracker(Game game, String statName)
{
super(game);
_statName = statName;
}
public String getStatName()
{
return _statName;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerHeadshot(MineStrike.PlayerHeadshotEvent event)
{
addStat(event.getShooter(), "Headshot", 1, false, false);
}
}

View File

@ -0,0 +1,35 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.grenades.HighExplosive;
public class KaboomStatTracker extends StatTracker<MineStrike>
{
public KaboomStatTracker(MineStrike game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGrenadeExplode(Grenade.GrenadeExplodeEvent event)
{
if (event.getGrenade() instanceof HighExplosive)
{
if (event.getDamagedPlayers().size() >= 2)
{
for (Player player : event.getDamagedPlayers())
{
if (!player.isDead())
return;
}
addStat(event.getThrower(), "Kaboom", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,101 @@
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;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
public class KillAllOpposingMineStrikeRoundStatTracker extends StatTracker<MineStrike>
{
private final Map<UUID, Set<UUID>> _kills = new HashMap<>();
public KillAllOpposingMineStrikeRoundStatTracker(MineStrike game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
if (event.GetLog().GetPlayer() == null)
return;
if (!event.GetLog().GetPlayer().IsPlayer())
return;
Player killed = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (killed == null)
return;
Set<UUID> kills = _kills.get(killer.getUniqueId());
if (kills == null)
{
kills = new HashSet<>();
_kills.put(killer.getUniqueId(), kills);
}
kills.add(killed.getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onRoundOver(MineStrike.RoundOverEvent event)
{
for (GameTeam team : getGame().GetTeamList())
{
for (Player player : team.GetPlayers(false))
{
Set<UUID> kills = _kills.get(player.getUniqueId());
if (kills == null)
continue;
for (GameTeam otherTeam : getGame().GetTeamList())
{
if (otherTeam == team)
continue;
boolean killedAll = true;
for (Player otherPlayer : otherTeam.GetPlayers(true))
{
if (!kills.contains(otherPlayer.getUniqueId()))
{
killedAll = false;
break;
}
}
if (killedAll)
addStat(player, "Ace", 1, true, false);
}
}
}
_kills.clear();
}
}

View File

@ -12,7 +12,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class FastKillsStatTracker extends StatTracker<Game>
public class KillFastStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _killCount = new HashMap<>();
private final Map<UUID, Long> _lastKillTime = new HashMap<>();
@ -21,7 +21,7 @@ public class FastKillsStatTracker extends StatTracker<Game>
private final String _stat;
private final int _timeBetweenKills;
public FastKillsStatTracker(Game game, int requiredKillCount, int timeBetweenKills, String stat)
public KillFastStatTracker(Game game, int requiredKillCount, int timeBetweenKills, String stat)
{
super(game);

View File

@ -0,0 +1,48 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import nautilus.game.arcade.game.Game;
public class KillVillagersStatTracker extends StatTracker<Game>
{
private final String _statName;
public KillVillagersStatTracker(Game game, String statName)
{
super(game);
_statName = statName;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event)
{
if (!(event.getEntity() instanceof Villager))
return;
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent))
return;
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) event.getEntity();
Player damager = null;
if (edbee.getDamager() instanceof Player)
damager = (Player) edbee.getDamager();
else if (edbee.getDamager() instanceof Projectile && ((Projectile) edbee.getDamager()).getShooter() instanceof Player)
damager = (Player) ((Projectile) edbee.getDamager()).getShooter();
if (damager != null)
addStat(damager, getStatName(), 1, false, false);
}
public String getStatName()
{
return _statName;
}
}

View File

@ -0,0 +1,94 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import nautilus.game.arcade.game.Game;
public class KillsWithConditionStatTracker extends StatTracker<Game>
{
private final String _statName;
private final Condition.ConditionType _conditionType;
private final String _conditionReason;
private final int _necessaryKillCount;
private final Map<UUID, Integer> _kills = new HashMap<>();
public KillsWithConditionStatTracker(Game game, String statName, Condition.ConditionType conditionType, String conditionReason, int necessaryKillCount)
{
super(game);
_statName = statName;
_conditionType = conditionType;
_conditionReason = conditionReason;
_necessaryKillCount = necessaryKillCount;
}
public String getStatName()
{
return _statName;
}
public int getNecessaryKillCount()
{
return _necessaryKillCount;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onConditionApply(ConditionApplyEvent event)
{
if (event.GetCondition().GetEnt() instanceof Player)
{
if (event.GetCondition().GetReason() != null && event.GetCondition().GetReason().contains(getConditionReason()))
_kills.remove(event.GetCondition().GetEnt().getUniqueId());
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
Condition condition = getGame().Manager.GetCondition().GetActiveCondition(player, getConditionType());
if (condition != null && condition.GetType() == getConditionType() && condition.GetReason() != null && condition.GetReason().contains("Flash Bang"))
{
Integer kills = _kills.get(player.getUniqueId());
kills = (kills == null ? 0 : kills) + 1;
_kills.put(player.getUniqueId(), kills);
if (kills == getNecessaryKillCount())
addStat(player, getStatName(), 1, true, false);
}
else
_kills.remove(player.getUniqueId());
}
public Condition.ConditionType getConditionType()
{
return _conditionType;
}
public String getConditionReason()
{
return _conditionReason;
}
}

View File

@ -0,0 +1,62 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class KillsWithinGameStatTracker extends StatTracker<Game>
{
private final int _necessarykillCount;
private final String _statName;
private final Map<UUID, Integer> _kills = new HashMap<>();
public KillsWithinGameStatTracker(Game game, int necessarykillCount, String statName)
{
super(game);
_necessarykillCount = necessarykillCount;
_statName = statName;
}
public String getStatName()
{
return _statName;
}
public int getNecessarykillCount()
{
return _necessarykillCount;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
Integer killCount = _kills.get(player.getUniqueId());
killCount = (killCount == null ? 0 : killCount) + 1;
_kills.put(player.getUniqueId(), killCount);
if (killCount == 12)
addStat(player, getStatName(), 1, true, false);
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.sneakyassassins.event.PlayerMasterAssassinEvent;
public class MasterAssassinStatTracker extends StatTracker<Game>
{
public MasterAssassinStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerMasterAssassin(PlayerMasterAssassinEvent event)
{
addStat(event.getPlayer(), "MasterAssassin", 1, false, false);
}
}

View File

@ -0,0 +1,66 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
public class MineStrikeLastAliveKillStatTracker extends StatTracker<MineStrike>
{
private final Map<UUID, Integer> _killCount = new HashMap<>();
public MineStrikeLastAliveKillStatTracker(MineStrike game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
Integer killCount = _killCount.get(player.getUniqueId());
_killCount.put(player.getUniqueId(), (killCount == null ? 0 : killCount) + 1);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onRoundOver(MineStrike.RoundOverEvent event)
{
for (GameTeam team : getGame().GetTeamList())
{
List<Player> players = team.GetPlayers(true);
if (players.size() == 1)
{
Player player = players.get(0);
Integer killCount = _killCount.get(player.getUniqueId());
if (killCount != null && killCount >= 3)
addStat(player, "ClutchOrKick", 1, true, false);
}
}
_killCount.clear();
}
}

View File

@ -0,0 +1,32 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
import nautilus.game.arcade.kit.perks.PerkRevealer;
public class SneakyAssassinsRevealStatTracker extends StatTracker<SneakyAssassins>
{
private final String _statName;
public SneakyAssassinsRevealStatTracker(SneakyAssassins game, String statName)
{
super(game);
_statName = statName;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerReveal(PerkRevealer.PlayerRevealEvent event)
{
if (event.getRevealer() instanceof Player)
addStat((Player) event.getRevealer(), getStatName(), 1, false, false);
}
public String getStatName()
{
return _statName;
}
}

View File

@ -0,0 +1,48 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
public class TheMastersMasterStatTracker extends StatTracker<SneakyAssassins>
{
public TheMastersMasterStatTracker(SneakyAssassins game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
if (event.GetLog().GetPlayer() == null)
return;
if (!event.GetLog().GetPlayer().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
if (getGame().getPowerUpManager().getPowerUpCount(killer) == 0 && getGame().getPowerUpManager().getPowerUpCount(player) >= 4)
addStat(killer, "TheMastersMaster", 1, true, false);
}
}

View File

@ -33,7 +33,7 @@ public class TimeInGameStatTracker extends StatTracker<Game>
if (joinTime != null)
{
int timeInGame = (int) ((System.currentTimeMillis() - joinTime) / 1000);
getGame().AddStat(event.getPlayer(), "TimeInGame", timeInGame, false, true);
addStat(event.getPlayer(), "TimeInGame", timeInGame, false, true);
}
}
}

View File

@ -0,0 +1,58 @@
package nautilus.game.arcade.stats;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
public class WinWithoutBowStatTracker extends StatTracker<Game>
{
private final String _statName;
private final Set<UUID> _hasUsedBow = new HashSet<>();
public WinWithoutBowStatTracker(Game game, String statName)
{
super(game);
_statName = statName;
}
public String getStatName()
{
return _statName;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityShootBow(EntityShootBowEvent event)
{
if (event.getEntity() instanceof Player)
_hasUsedBow.add(event.getEntity().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
{
if (!_hasUsedBow.contains(winner.getUniqueId()))
addStat(winner, getStatName(), 1, true, false);
}
}
}
}
}