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

This commit is contained in:
Chiss 2014-08-20 12:07:15 +10:00
commit adf617000d
43 changed files with 1718 additions and 226 deletions

View File

@ -1,18 +1,16 @@
package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.HashMap;
import java.util.*;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.*;
import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -33,6 +31,36 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class SeismicSlam extends SkillActive
{
public static class SeismicSlamEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final List<LivingEntity> _targets;
public SeismicSlamEvent(Player who, Collection<LivingEntity> targets)
{
super(who);
_targets = new ArrayList<>(targets);
}
public List<LivingEntity> getTargets()
{
return _targets;
}
}
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
public SeismicSlam(SkillFactory skills, String name, ClassType classType, SkillType skillType,
@ -141,6 +169,8 @@ public class SeismicSlam extends SkillActive
//Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, targets.keySet()));
Bukkit.getPluginManager().callEvent(new SeismicSlamEvent(player, targets.keySet()));
}
}

View File

@ -1,14 +1,13 @@
package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import java.util.*;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.*;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
@ -24,9 +23,40 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import org.bukkit.event.player.*;
public class LightningOrb extends SkillActive implements IThrown
{
public static class LightningOrbEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final List<Player> _struck;
public LightningOrbEvent(Player who, List<Player> struck)
{
super(who);
_struck = struck;
}
public List<Player> getStruck()
{
return _struck;
}
}
public LightningOrb(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
@ -121,6 +151,8 @@ public class LightningOrb extends SkillActive implements IThrown
Factory.Condition().Factory().Lightning(GetName(), cur, player, 0, 0.5, false, true);
}
List<Player> struck = new ArrayList<>();
//Lightning
for (Player cur : hit.keySet())
{
@ -132,6 +164,8 @@ public class LightningOrb extends SkillActive implements IThrown
//Lightning
cur.getWorld().strikeLightning(cur.getLocation());
struck.add(cur);
}
//Apply Conditions
@ -142,6 +176,8 @@ public class LightningOrb extends SkillActive implements IThrown
Factory.Condition().Factory().Slow(GetName(), cur, player, 2 + (1 * level), 2, false, true, true, true);
}
Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck));
}
@EventHandler

View File

@ -3,13 +3,12 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -19,9 +18,40 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilMath;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import org.bukkit.event.player.*;
public class Longshot extends Skill
{
public static class LongshotHitEvent extends ProjectileHitEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final double _length;
public LongshotHitEvent(Projectile projectile, double length)
{
super(projectile);
_length = length;
}
public double getLength()
{
return _length;
}
}
private HashMap<Entity, Location> _arrows = new HashMap<Entity, Location>();
public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
@ -79,6 +109,8 @@ public class Longshot extends Skill
double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3);
event.AddMod(damager.getName(), GetName(), damage, damage > 0);
Bukkit.getPluginManager().callEvent(new LongshotHitEvent(projectile, length));
}
@EventHandler

View File

@ -1,8 +1,6 @@
package nautilus.game.arcade.game;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.*;
import mineplex.core.common.util.*;
import mineplex.core.updater.event.UpdateEvent;
@ -892,7 +890,7 @@ public abstract class Game implements Listener
Manager.GetChat().Silence(5000, false);
}
public void AnnounceEnd(ArrayList<Player> places)
public void AnnounceEnd(List<Player> places)
{
for (Player player : UtilServer.getPlayers())
{
@ -1068,9 +1066,13 @@ public abstract class Game implements Listener
if (_stats.get(player).containsKey(stat))
past = _stats.get(player).get(stat);
_stats.get(player).put(stat, limitTo1 ? Math.max(1, past + amount) : past + amount);
_stats.get(player).put(stat, limitTo1 ? Math.min(1, past + amount) : past + amount);
}
public abstract List<Player> getWinners();
public abstract List<Player> getLosers();
public NautHashMap<Player, HashMap<String, Integer>> GetStats()
{
return _stats;

View File

@ -1,6 +1,6 @@
package nautilus.game.arcade.game;
import java.util.ArrayList;
import java.util.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -123,4 +123,38 @@ public abstract class SoloGame extends Game
{
return 0;
}
@Override
public List<Player> getWinners()
{
if (!IsLive())
return null;
if (GetPlayers(true).size() <= 1)
{
List<Player> places = _players.GetPlacements(true);
if (places.isEmpty())
return Arrays.asList();
else
return Arrays.asList(places.get(0));
}
else
return null;
}
@Override
public List<Player> getLosers()
{
List<Player> winners = getWinners();
if (winners == null)
return null;
List<Player> losers = _players.GetPlayers(false);
losers.removeAll(winners);
return losers;
}
}

View File

@ -1,29 +1,18 @@
package nautilus.game.arcade.game;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilTime.*;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import nautilus.game.arcade.*;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.GameTeam.*;
import nautilus.game.arcade.kit.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.player.*;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.kit.Kit;
import java.util.*;
public abstract class TeamGame extends Game
{
@ -253,4 +242,30 @@ public abstract class TeamGame extends Game
Scoreboard.Draw();
}
@Override
public List<Player> getWinners()
{
if (WinnerTeam == null)
return null;
return WinnerTeam.GetPlayers(true);
}
@Override
public List<Player> getLosers()
{
if (WinnerTeam == null)
return null;
List<Player> players = new ArrayList<>();
for (GameTeam team : GetTeamList())
{
if (team != WinnerTeam)
players.addAll(team.GetPlayers(false));
}
return players;
}
}

View File

@ -1347,4 +1347,9 @@ public class Bridge extends TeamGame implements OreObsfucation
SetState(GameState.End);
}
}
public boolean isBridgesDown()
{
return _bridgesDown;
}
}

View File

@ -185,6 +185,8 @@ public class Draw extends SoloGame
//End Round
if (_round != null && (_round.IsDone() || _drawers.GetPlayers(true).isEmpty() || _round.AllGuessed(_guessers.GetPlayers(true))))
{
Bukkit.getPluginManager().callEvent(new DrawRoundEndEvent(_round));
Announce(C.cGold + C.Bold + "Round " + (_roundCount + 1) + " Ended: " + C.cYellow + C.Bold + "The word was " + _round.Word + "!");
_textBlocks = UtilText.MakeText(_round.Word, _textLocation, BlockFace.WEST, 159, (byte)15, TextAlign.CENTER);

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.game.games.draw;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class DrawGuessCorrectlyEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final DrawRound _drawRound;
private final int _rank;
public DrawGuessCorrectlyEvent(Player who, DrawRound drawRound, int rank)
{
super(who);
_drawRound = drawRound;
_rank = rank;
}
public DrawRound getDrawRound()
{
return _drawRound;
}
public int getRank()
{
return _rank;
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.draw;
import java.util.ArrayList;
import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -41,6 +42,9 @@ public class DrawRound
if (Guessed.add(player.getName()))
{
TimeMax -= 5;
Bukkit.getPluginManager().callEvent(new DrawGuessCorrectlyEvent(player, this, Guessed.size()));
return true;
}
@ -122,4 +126,9 @@ public class DrawRound
return true;
}
public Player getDrawer()
{
return Drawer;
}
}

View File

@ -0,0 +1,32 @@
package nautilus.game.arcade.game.games.draw;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class DrawRoundEndEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final DrawRound _drawRound;
public DrawRoundEndEvent(DrawRound drawRound)
{
_drawRound = drawRound;
}
public DrawRound getDrawRound()
{
return _drawRound;
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.survivalgames;
import org.bukkit.block.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.player.*;
public class SupplyChestOpenEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Block _chest;
public SupplyChestOpenEvent(Player who, Block chest)
{
super(who);
_chest = chest;
}
public Block getChest()
{
return _chest;
}
}

View File

@ -1,20 +1,11 @@
package nautilus.game.arcade.game.games.survivalgames;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.*;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import mineplex.core.achievement.*;
import org.bukkit.*;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
@ -392,7 +383,7 @@ public class SurvivalGames extends SoloGame
_supplyChests.remove(event.getClickedBlock());
//Manager.GetStatsManager().addStat(event.getPlayer(), GetName(), "chestsOpened", 1);
Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(event.getPlayer(), event.getClickedBlock()));
}
private ItemStack GetChestItem(boolean superChest)
@ -1689,6 +1680,4 @@ public class SurvivalGames extends SoloGame
Scoreboard.Draw();
}
}

View File

@ -7,14 +7,8 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.*;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
@ -395,7 +389,7 @@ public class SurvivalGamesTeams extends TeamGame
_supplyChests.remove(event.getClickedBlock());
//Manager.GetStatsManager().addStat(event.getPlayer(), GetName(), "chestsOpened", 1);
Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(event.getPlayer(), event.getClickedBlock()));
}
private ItemStack GetChestItem(boolean superChest)

View File

@ -1,35 +1,54 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.*;
import mineplex.core.itemstack.*;
import mineplex.core.recharge.*;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import nautilus.game.arcade.kit.*;
import org.bukkit.*;
import org.bukkit.block.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.*;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import nautilus.game.arcade.kit.Perk;
import java.util.*;
public class PerkBomber extends Perk
{
public static class BomberExplodeDiamondBlock extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Block _block;
public BomberExplodeDiamondBlock(Player who, Block block)
{
super(who);
_block = block;
}
public Block getBlock()
{
return _block;
}
}
private HashMap<Entity, Player> _tntMap = new HashMap<Entity, Player>();
private int _spawnRate;
@ -156,14 +175,41 @@ public class PerkBomber extends Perk
@EventHandler
public void ExplosionPrime(ExplosionPrimeEvent event)
{
if (!_tntMap.containsKey(event.getEntity()))
return;
Player player = _tntMap.remove(event.getEntity());
if (player != null)
{
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
{
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false);
}
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event)
{
Player player = _tntMap.remove(event.getEntity());
if (player != null)
{
for (Iterator<Block> it = event.blockList().iterator(); it.hasNext(); )
{
Block block = it.next();
if (block.getType() == Material.DIAMOND_ORE)
{
it.remove();
if (Math.random() < event.getYield())
{
block.breakNaturally();
Bukkit.getPluginManager().callEvent(new BomberExplodeDiamondBlock(player, block));
}
else
block.setType(Material.AIR);
}
}
}
}
}

View File

@ -1,38 +1,56 @@
package nautilus.game.arcade.kit.perks;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Location;
import mineplex.core.common.util.*;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import mineplex.minecraft.game.core.combat.event.*;
import mineplex.minecraft.game.core.damage.*;
import nautilus.game.arcade.kit.*;
import net.minecraft.server.v1_7_R4.*;
import org.bukkit.*;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSkeleton;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.player.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
import java.util.*;
public class PerkSkeletons extends Perk
{
public static class MinionSpawnEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
private final PerkSkeletons _perkSkeletons;
public MinionSpawnEvent(Player who, PerkSkeletons perkSkeletons)
{
super(who);
_perkSkeletons = perkSkeletons;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
public PerkSkeletons getPerkSkeletons()
{
return _perkSkeletons;
}
}
private HashMap<Player, ArrayList<Skeleton>> _minions = new HashMap<Player, ArrayList<Skeleton>>();
private boolean _name;
@ -105,6 +123,8 @@ public class PerkSkeletons extends Perk
_minions.get(killer).add(skel);
killer.playSound(killer.getLocation(), Sound.SKELETON_HURT, 1f, 1f);
Bukkit.getPluginManager().callEvent(new MinionSpawnEvent(killer, this));
}
@EventHandler
@ -266,4 +286,9 @@ public class PerkSkeletons extends Perk
skels.clear();
}
public List<Skeleton> getSkeletons(Player player)
{
return _minions.get(player);
}
}

View File

@ -0,0 +1,31 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.*;
import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
public class AssistsStatTracker extends StatTracker<Game>
{
public AssistsStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
for (CombatComponent log : event.GetLog().GetAttackers())
{
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
continue;
Player player = UtilPlayer.searchExact(log.GetName());
getGame().AddStat(player, "Assists", 1, false, false);
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
}
}
}

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.games.bridge.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
public class BridgesSniperStatTracker extends StatTracker<Bridge>
{
public BridgesSniperStatTracker(Bridge game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().isBridgesDown())
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 (player.getLastDamageCause() instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause();
if (edbee.getDamager() instanceof Arrow)
getGame().AddStat(killer, "Sniper", 1, true, false);
}
}
}

View File

@ -0,0 +1,25 @@
package nautilus.game.arcade.stats;
import mineplex.minecraft.game.core.damage.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
public class DamageDealtStatTracker extends StatTracker<Game>
{
public DamageDealtStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event)
{
Player damager = event.GetDamagerPlayer(false);
if (damager == null)
return;
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
}
}

View File

@ -0,0 +1,25 @@
package nautilus.game.arcade.stats;
import mineplex.minecraft.game.core.damage.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
public class DamageTakenStatTracker extends StatTracker<Game>
{
public DamageTakenStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event)
{
Player damagee = event.GetDamageePlayer();
if (damagee == null)
return;
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
}
}

View File

@ -0,0 +1,61 @@
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 org.bukkit.event.entity.EntityDamageEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class DeathBomberStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _killCount = new HashMap<>();
public DeathBomberStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
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 (player.getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.BLOCK_EXPLOSION
|| player.getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION)
{
Integer count = _killCount.get(killer.getUniqueId());
count = (count == null ? 0 : count) + 1;
_killCount.put(killer.getUniqueId(), count);
if (count >= 5)
getGame().AddStat(killer, "DeathBomber", 1, true, false);
}
}
}

View File

@ -0,0 +1,32 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
public class DeathsStatTracker extends StatTracker<Game>
{
public DeathsStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (event.GetLog().GetPlayer() == null)
return;
if (!event.GetLog().GetPlayer().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
getGame().AddStat(player, "Deaths", 1, false, false);
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
}
}

View File

@ -0,0 +1,20 @@
package nautilus.game.arcade.stats;
import mineplex.minecraft.game.classcombat.Skill.Mage.*;
import nautilus.game.arcade.game.*;
import org.bukkit.event.*;
public class ElectrocutionStatTracker extends StatTracker<Game>
{
public ElectrocutionStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onLightningOrb(LightningOrb.LightningOrbEvent event)
{
if (event.getStruck().size() >= 4)
getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false);
}
}

View File

@ -0,0 +1,89 @@
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 FastKillsStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _killCount = new HashMap<>();
private final Map<UUID, Long> _lastKillTime = new HashMap<>();
private final int _requiredKillCount;
private final int _timeBetweenKills;
public FastKillsStatTracker(Game game, int requiredKillCount, int timeBetweenKills)
{
super(game);
_requiredKillCount = requiredKillCount;
_timeBetweenKills = timeBetweenKills * 1000;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
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;
Long lastTime = _lastKillTime.get(killer.getUniqueId());
long now = System.currentTimeMillis();
Integer killCount;
if (lastTime == null || now - lastTime > getTimeBetweenKills())
killCount = 0;
else
{
killCount = _killCount.get(killer.getUniqueId());
if (killCount == null)
killCount = 0;
}
killCount++;
_killCount.put(killer.getUniqueId(), killCount);
_lastKillTime.put(killer.getUniqueId(), now);
_killCount.remove(player.getUniqueId());
_lastKillTime.remove(player.getUniqueId());
if (killCount >= getRequiredKillCount())
getGame().AddStat(killer, "FastKills", 1, true, false);
}
public int getRequiredKillCount()
{
return _requiredKillCount;
}
public int getTimeBetweenKills()
{
return _timeBetweenKills;
}
}

View File

@ -0,0 +1,26 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.*;
import nautilus.game.arcade.game.games.survivalgames.*;
import org.bukkit.event.*;
public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
{
private boolean first = true;
public FirstSupplyDropOpenStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSupplyChestOpen(SupplyChestOpenEvent event)
{
if (first)
{
getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
first = false;
}
}
}

View File

@ -0,0 +1,37 @@
package nautilus.game.arcade.stats;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.KitAvailability;
public class FreeKitWinStatTracker extends StatTracker<Game>
{
public FreeKitWinStatTracker(Game game)
{
super(game);
}
@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 (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free)
getGame().AddStat(winner, "FreeKitsForever", 1, false, false);
}
}
}
}
}

View File

@ -0,0 +1,48 @@
package nautilus.game.arcade.stats;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.draw.DrawRoundEndEvent;
public class KeenEyeStatTracker extends StatTracker<Draw>
{
private final List<Player> _guessAll = new ArrayList<>();
public KeenEyeStatTracker(Draw game)
{
super(game);
}
@EventHandler
public void onDrawRoundEnd(DrawRoundEndEvent event)
{
for (Iterator<Player> it = _guessAll.iterator(); it.hasNext(); )
{
Player player = it.next();
if (player == event.getDrawRound().Drawer)
continue;
if (!event.getDrawRound().Guessed.contains(player.getName()))
it.remove();
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
for (Player player : _guessAll)
getGame().AddStat(player, "KeenEye", 1, true, false);
}
}
}

View File

@ -0,0 +1,91 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*;
public class KillAllOpposingStatTracker extends StatTracker<TeamGame>
{
private final Map<UUID, Set<UUID>> _kills = new HashMap<>();
public KillAllOpposingStatTracker(TeamGame game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
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 onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
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)
getGame().AddStat(player, "Ace", 1, true, false);
}
}
}
}
}
}

View File

@ -0,0 +1,32 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
public class KillsStatTracker extends StatTracker<Game>
{
public KillsStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
getGame().AddStat(player, "Kills", 1, false, false);
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
}
}

View File

@ -0,0 +1,58 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*;
public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
{
private final int _killCount;
private final int _timeLimit;
private final Map<UUID, Integer> _kills = new HashMap<>();
public KillsWithinTimeLimitStatTracker(Game game, int killCount, int timeLimit)
{
super(game);
_killCount = killCount;
_timeLimit = timeLimit * 1000;
}
public int getKillCount()
{
return _killCount;
}
public int getTimeLimit()
{
return _timeLimit;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
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 == getKillCount() && System.currentTimeMillis() - getGame().GetStateTime() < getTimeLimit())
getGame().AddStat(player, "Bloodlust", 1, true, false);
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*;
public class LoseStatTracker extends StatTracker<Game>
{
public LoseStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> losers = getGame().getLosers();
if (losers != null)
{
for (Player loser : losers)
{
getGame().AddStat(loser, "Losses", 1, false, false);
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
}
}
}
}
}

View File

@ -0,0 +1,60 @@
package nautilus.game.arcade.stats;
import java.util.ArrayList;
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 nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent;
public class MrSquiggleStatTracker extends StatTracker<Draw>
{
private final Map<UUID, List<Long>> _guessTimes = new HashMap<>();
public MrSquiggleStatTracker(Draw game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
{
if (event.getRank() != 1)
return;
Player drawer = event.getDrawRound().getDrawer();
List<Long> times = _guessTimes.get(drawer.getUniqueId());
if (times == null)
{
times = new ArrayList<>();
_guessTimes.put(drawer.getUniqueId(), times);
}
times.add(System.currentTimeMillis() - event.getDrawRound().Time);
if (times.size() >= 2)
{
boolean greaterThan15000 = false;
for (long time : times)
{
if (time > 15000)
{
greaterThan15000 = true;
break;
}
}
if (!greaterThan15000)
getGame().AddStat(drawer, "MrSquiggle", 1, true, false);
}
}
}

View File

@ -0,0 +1,76 @@
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.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
public class OneVThreeStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _killCount = new HashMap<>();
public OneVThreeStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
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;
Integer killCount = _killCount.get(killer.getUniqueId());
if (killCount == null)
killCount = 0;
killCount++;
_killCount.put(killer.getUniqueId(), killCount);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> players = getGame().GetPlayers(false);
if (players.size() >= 4)
return;
for (Player player : players)
{
Integer killCount = _killCount.get(player.getUniqueId());
if (killCount != null && killCount >= 10)
getGame().AddStat(player, "1v3", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent;
public class PureLuckStatTracker extends StatTracker<Draw>
{
public PureLuckStatTracker(Draw game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
{
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false);
}
}

View File

@ -0,0 +1,57 @@
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.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
public class RecoveryMasterStatTracker extends StatTracker<Game>
{
private final Map<UUID, Double> _damageTaken = new HashMap<>();
public RecoveryMasterStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (event.GetLog().GetPlayer() == null)
return;
if (!event.GetLog().GetPlayer().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
_damageTaken.remove(player.getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event)
{
Player damagee = event.GetDamageePlayer();
if (damagee == null)
return;
Double damage = _damageTaken.get(damagee.getUniqueId());
damage = (damage == null ? 0 : damage) + event.GetDamage();
_damageTaken.put(damagee.getUniqueId(), damage);
if (damage >= 200)
getGame().AddStat(damagee, "RecoveryMaster", 1, true, false);
}
}

View File

@ -0,0 +1,20 @@
package nautilus.game.arcade.stats;
import mineplex.minecraft.game.classcombat.Skill.Brute.*;
import nautilus.game.arcade.game.*;
import org.bukkit.event.*;
public class SeismicSlamStatTracker extends StatTracker<Game>
{
public SeismicSlamStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onLongshotHit(SeismicSlam.SeismicSlamEvent event)
{
if (event.getTargets().size() >= 5)
getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false);
}
}

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.*;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*;
public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
{
private final int _requiredCount;
public SimultaneousSkeletonStatTracker(Game game, int requiredCount)
{
super(game);
_requiredCount = requiredCount;
}
@EventHandler
public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event)
{
List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer());
if (skeletons != null)
{
int aliveCount = 0;
for (Skeleton skeleton : skeletons)
{
if (!skeleton.isDead())
aliveCount++;
}
if (aliveCount >= getRequiredCount())
getGame().AddStat(event.getPlayer(), "Skeletons", 1, true, false);
}
}
public int getRequiredCount()
{
return _requiredCount;
}
}

View File

@ -0,0 +1,19 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.*;
import org.bukkit.event.*;
public class StatTracker<G extends Game> implements Listener
{
private final G game;
public StatTracker(G game)
{
this.game = game;
}
public G getGame()
{
return game;
}
}

View File

@ -0,0 +1,19 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.*;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.event.*;
public class TntMinerStatTracker extends StatTracker<Game>
{
public TntMinerStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityExplode(PerkBomber.BomberExplodeDiamondBlock event)
{
getGame().AddStat(event.getPlayer(), "FortuneBomber", 1, false, false);
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*;
public class WinStatTracker extends StatTracker<Game>
{
public WinStatTracker(Game game)
{
super(game);
}
@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)
{
getGame().AddStat(winner, "Wins", 1, false, false);
getGame().AddStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
}
}
}
}
}

View File

@ -0,0 +1,59 @@
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 mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
public class WinWithoutDyingStatTracker extends StatTracker<Game>
{
private final Set<UUID> _hasDied = new HashSet<>();
public WinWithoutDyingStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (event.GetLog().GetPlayer() == null)
return;
if (!event.GetLog().GetPlayer().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
_hasDied.add(player.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 (!_hasDied.contains(winner.getUniqueId()))
getGame().AddStat(winner, "MLGPro", 1, true, false);
}
}
}
}
}

View File

@ -0,0 +1,29 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
{
public WinWithoutLosingTeammateStatTracker(TeamGame game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
GameTeam winner = getGame().WinnerTeam;
if (winner.GetPlayers(true).size() == winner.GetPlayers(false).size())
{
for (Player player : winner.GetPlayers(true))
getGame().AddStat(player, "FlawlessVictory", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,63 @@
package nautilus.game.arcade.stats;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.inventory.*;
import java.util.*;
public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
{
private final Set<UUID> _armorWearers = new HashSet<>();
public WinWithoutWearingArmorStatTracker(Game game)
{
super(game);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK && getGame().GetState() == Game.GameState.Live)
{
for (Player player : getGame().GetPlayers(true))
{
if (_armorWearers.contains(player.getUniqueId()))
continue;
for (ItemStack armor : player.getInventory().getArmorContents())
{
if (armor != null && armor.getType() != Material.AIR)
{
_armorWearers.add(player.getUniqueId());
break;
}
}
}
}
}
@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 (!_armorWearers.contains(winner.getUniqueId()))
getGame().AddStat(winner, "NoArmor", 1, true, false);
}
}
}
}
}