Work on achievements
This commit is contained in:
parent
508ef65fcf
commit
05686cb584
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -898,7 +896,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())
|
||||
{
|
||||
@ -1074,9 +1072,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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1347,4 +1347,9 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBridgesDown()
|
||||
{
|
||||
return _bridgesDown;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 BomberExplodeEntityEvent(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;
|
||||
@ -51,7 +70,7 @@ public class PerkBomber extends Perk
|
||||
|
||||
public void Apply(Player player)
|
||||
{
|
||||
Recharge.Instance.use(player, GetName(), _spawnRate*1000, false, false);
|
||||
Recharge.Instance.use(player, GetName(), _spawnRate * 1000, false, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -68,14 +87,14 @@ public class PerkBomber extends Perk
|
||||
if (!Manager.GetGame().IsAlive(cur))
|
||||
continue;
|
||||
|
||||
if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false, false))
|
||||
if (!Recharge.Instance.use(cur, GetName(), _spawnRate * 1000, false, false))
|
||||
continue;
|
||||
|
||||
if (UtilInv.contains(cur, Material.TNT, (byte)0, _max))
|
||||
if (UtilInv.contains(cur, Material.TNT, (byte) 0, _max))
|
||||
continue;
|
||||
|
||||
//Add
|
||||
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")));
|
||||
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte) 0, 1, F.item("Throwing TNT")));
|
||||
|
||||
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
|
||||
}
|
||||
@ -87,7 +106,7 @@ public class PerkBomber extends Perk
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte)0))
|
||||
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte) 0))
|
||||
return;
|
||||
|
||||
//Cancel
|
||||
@ -103,7 +122,7 @@ public class PerkBomber extends Perk
|
||||
HashSet<org.bukkit.inventory.ItemStack> remove = new HashSet<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
for (org.bukkit.inventory.ItemStack item : event.getDrops())
|
||||
if (UtilInv.IsItem(item, Material.TNT, (byte)0))
|
||||
if (UtilInv.IsItem(item, Material.TNT, (byte) 0))
|
||||
remove.add(item);
|
||||
|
||||
for (org.bukkit.inventory.ItemStack item : remove)
|
||||
@ -113,7 +132,7 @@ public class PerkBomber extends Perk
|
||||
@EventHandler
|
||||
public void TNTInvClick(InventoryClickEvent event)
|
||||
{
|
||||
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte)0, true);
|
||||
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte) 0, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -125,7 +144,7 @@ public class PerkBomber extends Perk
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte)0))
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
@ -140,7 +159,7 @@ public class PerkBomber extends Perk
|
||||
return;
|
||||
}
|
||||
|
||||
UtilInv.remove(player, Material.TNT, (byte)0, 1);
|
||||
UtilInv.remove(player, Material.TNT, (byte) 0, 1);
|
||||
UtilInv.Update(player);
|
||||
|
||||
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -64,7 +82,7 @@ public class PerkSkeletons extends Perk
|
||||
if (!Kit.HasKit(killer))
|
||||
return;
|
||||
|
||||
Player killed = (Player)event.GetEvent().getEntity();
|
||||
Player killed = (Player) event.GetEvent().getEntity();
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = true;
|
||||
Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class);
|
||||
@ -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
|
||||
@ -154,7 +174,7 @@ public class PerkSkeletons extends Perk
|
||||
|
||||
//Return to Owner
|
||||
double range = 4;
|
||||
if (skel.getTarget() != null || ((CraftSkeleton)skel).getHandle().getGoalTarget() != null)
|
||||
if (skel.getTarget() != null || ((CraftSkeleton) skel).getHandle().getGoalTarget() != null)
|
||||
{
|
||||
range = _maxDist;
|
||||
}
|
||||
@ -168,12 +188,12 @@ public class PerkSkeletons extends Perk
|
||||
//Move
|
||||
Location target = skel.getLocation().add(UtilAlg.getTrajectory(skel, player).multiply(3));
|
||||
|
||||
EntityCreature ec = ((CraftCreature)skel).getHandle();
|
||||
EntityCreature ec = ((CraftCreature) skel).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
nav.a(target.getX(), target.getY(), target.getZ(), speed);
|
||||
|
||||
skel.setTarget(null);
|
||||
((CraftSkeleton)skel).getHandle().setGoalTarget(null);
|
||||
((CraftSkeleton) skel).getHandle().setGoalTarget(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -190,7 +210,7 @@ public class PerkSkeletons extends Perk
|
||||
for (Skeleton skel : skels)
|
||||
{
|
||||
if (skel.getHealth() > 0)
|
||||
skel.setHealth(Math.min(skel.getMaxHealth(), skel.getHealth()+1));
|
||||
skel.setHealth(Math.min(skel.getMaxHealth(), skel.getHealth() + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -231,7 +251,7 @@ public class PerkSkeletons extends Perk
|
||||
|
||||
if (event.GetDamagerEntity(true) instanceof Skeleton)
|
||||
{
|
||||
Skeleton skel = (Skeleton)event.GetDamagerEntity(true);
|
||||
Skeleton skel = (Skeleton) event.GetDamagerEntity(true);
|
||||
|
||||
if (skel.getEquipment().getItemInHand() != null)
|
||||
{
|
||||
@ -266,4 +286,9 @@ public class PerkSkeletons extends Perk
|
||||
|
||||
skels.clear();
|
||||
}
|
||||
|
||||
public List<Skeleton> getSkeletons(Player player)
|
||||
{
|
||||
return _minions.get(player);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Skill.Ranger.*;
|
||||
import nautilus.game.arcade.game.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
|
||||
public class LongshotStatTracker extends StatTracker<Game>
|
||||
{
|
||||
public LongshotStatTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onLongshotHit(Longshot.LongshotHitEvent event)
|
||||
{
|
||||
if (event.getLength() >= 64 && event.getEntity().getShooter() instanceof Player)
|
||||
getGame().AddStat((Player) event.getEntity().getShooter(), "TheLongestShot", 1, true, false);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user