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

This commit is contained in:
Jonathan Williams 2014-08-22 18:21:38 -05:00
commit a84468157c
94 changed files with 2909 additions and 488 deletions

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="bukkit">
<CLASSES>
<root url="jar://$PROJECT_DIR$/Libraries/bukkit.jar!/" />
</CLASSES>
<JAVADOC>
<root url="http://jd.bukkit.org/dev/apidocs/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/Libraries/bukkit.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -29,6 +30,7 @@ import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.types.MorphGadget.ArmorSlot;
import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager;
@ -86,7 +88,9 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemTNT(this));
addGadget(new ItemFleshHook(this));
addGadget(new ItemMelonLauncher(this));
//addGadget(new ItemFootball(this));
//addGadget(new ItemDuelingSword(this));
// Morphs
addGadget(new MorphBlaze(this));
addGadget(new MorphPumpkinKing(this));
@ -95,14 +99,31 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphPig(this));
addGadget(new MorphBat(this));
addGadget(new MorphBlock(this));
addGadget(new MorphVillager(this));
addGadget(new MorphCow(this));
//addGadget(new MorphNotch(this));
// Particles
addGadget(new ParticleGreen(this));
addGadget(new ParticleFoot(this));
addGadget(new ParticleEnchant(this));
addGadget(new ParticleFireRings(this));
addGadget(new ParticleRain(this));
addGadget(new ParticleRain(this));
addGadget(new ParticleHelix(this));
// Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, 5000, 2256, 178000));
addGadget(new MusicGadget(this, "Cat Disc", new String[] {""}, 5000, 2257, 185000));
addGadget(new MusicGadget(this, "Blocks Disc", new String[] {""}, 5000, 2258, 345000));
addGadget(new MusicGadget(this, "Chirp Disc", new String[] {""}, 5000, 2259, 185000));
addGadget(new MusicGadget(this, "Far Disc", new String[] {""}, 5000, 2260, 174000));
addGadget(new MusicGadget(this, "Mall Disc", new String[] {""}, 5000, 2261, 197000));
addGadget(new MusicGadget(this, "Mellohi Disc", new String[] {""}, 5000, 2262, 96000));
addGadget(new MusicGadget(this, "Stal Disc", new String[] {""}, 5000, 2263, 150000));
addGadget(new MusicGadget(this, "Strad Disc", new String[] {""}, 5000, 2264, 188000));
addGadget(new MusicGadget(this, "Ward Disc", new String[] {""}, 5000, 2265, 251000));
addGadget(new MusicGadget(this, "11 Disc", new String[] {""}, 5000, 2266, 71000));
addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, 5000, 2267, 238000));
}
private void addGadget(Gadget gadget)
@ -303,6 +324,14 @@ public class GadgetManager extends MiniPlugin
_playerActiveGadgetMap.remove(event.getPlayer());
}
@EventHandler
public void death(PlayerDeathEvent event)
{
_lastMove.remove(event.getEntity());
_playerActiveGadgetMap.remove(event.getEntity());
}
public void setActive(Player player, Gadget gadget)
{

View File

@ -0,0 +1,66 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget;
public class ItemDuelingSword extends ItemGadget
{
public ItemDuelingSword(GadgetManager manager)
{
super(manager, "Dueling Sword", new String[]
{
C.cWhite + "While active, you are able to fight",
C.cWhite + "against other people who are also",
C.cWhite + "wielding a dueling sword.",
},
-1,
Material.WOOD_SWORD, (byte)3,
1000, new Ammo("Dueling Sword", "10 Swords", Material.WOOD_SWORD, (byte)0, new String[] { C.cWhite + "10 Swords to duel with" }, 1000, 10));
}
@Override
public void ActivateCustom(Player player)
{
ItemStack stack = new ItemStack(Material.GOLD_SWORD);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName("Dueling Sword");
stack.setItemMeta(meta);
player.getInventory().setItem(Manager.getActiveItemSlot(), stack);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void damage(EntityDamageByEntityEvent event)
{
if (!(event.getEntity() instanceof Player) || !(event.getDamager() instanceof Player))
return;
Player damager = (Player)event.getDamager();
Player damagee = (Player)event.getEntity();
if (!UtilGear.isMat(damager.getItemInHand(), Material.GOLD_SWORD) || !UtilGear.isMat(damagee.getItemInHand(), Material.GOLD_SWORD))
return;
event.setCancelled(false);
event.setDamage(4);
}
}

View File

@ -0,0 +1,125 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
import org.bukkit.entity.Bat;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemFootball extends ItemGadget
{
private HashSet<Bat> _active = new HashSet<Bat>();
public ItemFootball(GadgetManager manager)
{
super(manager, "Football", new String[]
{
C.cWhite + "An amazing souvenier from the",
C.cWhite + "Mineplex World Cup in 2053!",
},
-1,
Material.CLAY_BALL, (byte)3,
1000, new Ammo("Melon Launcher", "10 Footballs", Material.CLAY_BALL, (byte)0, new String[] { C.cWhite + "10 Footballs to play with" }, 1000, 10));
}
@Override
public void ActivateCustom(Player player)
{
//Action
FallingBlock ball = player.getWorld().spawnFallingBlock(player.getLocation().add(0, 1, 0), Material.SKULL, (byte) 3);
Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class);
UtilEnt.Vegetate(bat);
UtilEnt.ghost(bat, true, true);
UtilEnt.silence(bat, true);
bat.setPassenger(ball);
_active.add(bat);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Collide(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Bat ball : _active)
{
if (ball.getPassenger() != null)
{
((CraftFallingSand)ball.getPassenger()).getHandle().ticksLived = 1;
ball.getPassenger().setTicksLived(1);
}
for (Player other : UtilServer.getPlayers())
{
if (UtilMath.offset(ball, other) > 1.5)
continue;
if (!Recharge.Instance.use(other, GetName() + " Bump", 200, false, false))
continue;
double power = 0.4;
if (other.isSprinting())
power = 0.7;
//Velocity
UtilAction.velocity(ball, UtilAlg.getTrajectory2d(other, ball), power, false, 0, 0, 0, false);
other.getWorld().playSound(other.getLocation(), Sound.ITEM_PICKUP, 0.2f, 0.2f);
}
}
}
@EventHandler
public void Snort(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!UtilEvent.isAction(event, ActionType.L))
return;
for (Bat ball : _active)
{
if (UtilMath.offset(ball, player) > 2)
continue;
if (!Recharge.Instance.use(player, GetName() + " Kick", 1000, false, false))
return;
Recharge.Instance.useForce(player, GetName() + " Bump", 1000);
//Velocity
UtilAction.velocity(ball, UtilAlg.getTrajectory2d(player, ball), 2, false, 0, 0, 0, false);
player.getWorld().playSound(player.getLocation(), Sound.ITEM_PICKUP, 1f, 0.1f);
}
}
}

View File

@ -10,11 +10,13 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBlock;
import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -32,7 +34,7 @@ public class MorphBlock extends MorphGadget
C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify",
},
40000,
ArmorSlot.Helmet, Material.LEAVES, (byte)0);
ArmorSlot.Helmet, Material.EMERALD_BLOCK, (byte)0);
}
@Override
@ -40,7 +42,7 @@ public class MorphBlock extends MorphGadget
{
this.ApplyArmor(player);
_active.put(player, new BlockForm(this, player, Material.DIRT));
_active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK));
}
@Override
@ -76,7 +78,10 @@ public class MorphBlock extends MorphGadget
if (event.getClickedBlock() == null)
return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (UtilEvent.isAction(event, ActionType.L_BLOCK) || UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
if (!Recharge.Instance.use(event.getPlayer(), GetName(), 500, false, false))
return;
BlockForm form = _active.get(event.getPlayer());

View File

@ -0,0 +1,66 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.recharge.Recharge;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
public class MorphCow extends MorphGadget
{
public MorphCow(GadgetManager manager)
{
super(manager, "Cow Morph", new String[]
{
C.cWhite + "How now brown cow?",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Moo",
},
6000,
ArmorSlot.Helmet, Material.LEATHER, (byte)0);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguiseCow disguise = new DisguiseCow(player);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void Audio(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 2500, false, false))
return;
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 1f, 1f);
}
}

View File

@ -0,0 +1,63 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
public class MorphNotch extends MorphGadget
{
public MorphNotch(GadgetManager manager)
{
super(manager, "Notch", new String[]
{
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Enforce EULA",
},
50000,
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)3);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguisePlayer disguise = new DisguisePlayer(player);
disguise.setName("Notch");
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void Audio(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 1500, false, false))
return;
player.sendMessage("You have enforced the EULA.");
}
}

View File

@ -73,7 +73,7 @@ public class MorphPig extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 100, false, false))
if (!Recharge.Instance.use(player, GetName(), 400, false, false))
return;
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5));

View File

@ -0,0 +1,68 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseVillager;
import mineplex.core.recharge.Recharge;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
public class MorphVillager extends MorphGadget
{
public MorphVillager(GadgetManager manager)
{
super(manager, "Villager Morph", new String[]
{
C.cWhite + "HURRRR! MURR HURRR!",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "HURRR",
},
12000,
ArmorSlot.Helmet, Material.EMERALD, (byte)0);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguiseVillager disguise = new DisguiseVillager(player);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void Audio(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 1500, false, false))
return;
player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_IDLE, 1f, 1f);
}
}

View File

@ -0,0 +1,34 @@
package mineplex.core.gadget.gadgets;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class SongData
{
public Block Block;
public long EndTime;
public SongData(Block block, long duration)
{
Block = block;
EndTime = System.currentTimeMillis() + duration;
Block.setType(Material.JUKEBOX);
}
public boolean update()
{
if (System.currentTimeMillis() > EndTime)
{
Block.setType(Material.AIR);
return true;
}
UtilParticle.PlayParticle(ParticleType.NOTE, Block.getLocation().add(0.5, 1, 0.5), 0.5f, 0.5f, 0.5f, 0f, 2);
return false;
}
}

View File

@ -5,4 +5,5 @@ public enum GadgetType
Item,
Morph,
Particle,
MusicDisc,
}

View File

@ -0,0 +1,85 @@
package mineplex.core.gadget.types;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.gadgets.SongData;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class MusicGadget extends Gadget
{
private int _id;
private long _duration;
private ArrayList<SongData> _songs = new ArrayList<SongData>();
public MusicGadget(GadgetManager manager, String name, String[] desc, int cost, int id, long duration)
{
super(manager, GadgetType.MusicDisc, name, desc, cost, Material.getMaterial(id), (byte)0);
_id = id;
_duration = duration;
}
@Override
public void Enable(Player player)
{
GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this);
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
if (gadgetEvent.isCancelled())
{
UtilPlayer.message(player, F.main("Inventory", "You cannot use Inventory Items."));
return;
}
if (!Recharge.Instance.use(player, "Play Disc", _duration, true, false))
return;
player.getWorld().playEffect(player.getLocation(), Effect.RECORD_PLAY, _id);
_songs.add(new SongData(player.getLocation().getBlock(), _duration));
}
@Override
public void EnableCustom(Player player)
{
}
@Override
public void DisableCustom(Player player)
{
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
Iterator<SongData> songIterator = _songs.iterator();
while (songIterator.hasNext())
{
SongData song = songIterator.next();
if (song.update())
songIterator.remove();
}
}
}

View File

@ -9,7 +9,9 @@ import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
@ -113,6 +115,18 @@ public class MountManager extends MiniPlugin
mount.Disable(player);
}
@EventHandler
public void quit(PlayerQuitEvent event)
{
_playerActiveMountMap.remove(event.getPlayer());
}
@EventHandler
public void death(PlayerDeathEvent event)
{
_playerActiveMountMap.remove(event.getEntity());
}
public void setActive(Player player, Mount<?> mount)
{
_playerActiveMountMap.put(player, mount);

View File

@ -41,20 +41,23 @@ public class MountSheep extends HorseMount
Manager.DeregisterAll(player);
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
horse.setAdult();
/*horse.setAdult();
horse.setAgeLock(true);
horse.setColor(_color);
horse.setStyle(_style);
horse.setVariant(_variant);
*/
horse.setOwner(player);
horse.setMaxDomestication(1);
horse.setJumpStrength(_jump);
//horse.setJumpStrength(_jump);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
//disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
Manager.getDisguiseManager().disguise(disguise);
//Inform

View File

@ -19,7 +19,9 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -410,12 +412,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
}
@EventHandler
public void PlayerRespawn(PlayerRespawnEvent event)
{
event.setRespawnLocation(GetSpawn());
}
@EventHandler(priority = EventPriority.MONITOR)
public void OnChunkLoad(ChunkLoadEvent event)
{
@ -475,79 +471,88 @@ public class HubManager extends MiniClientPlugin<HubClient>
else
event.getPlayer().setOp(false);
}
@EventHandler
public void PlayerRespawn(PlayerRespawnEvent event)
{
event.setRespawnLocation(GetSpawn().add(0, 10, 0));
}
@EventHandler(priority = EventPriority.LOW)
public void PlayerJoin(PlayerJoinEvent event)
{
try
Player player = event.getPlayer();
//Public Message
event.setJoinMessage(null);
//Teleport
player.teleport(GetSpawn().add(0, 10, 0));
//Survival
player.setGameMode(GameMode.SURVIVAL);
//Clear Inv
UtilInv.Clear(player);
//Allow Double Jump
player.setAllowFlight(true);
//Health
player.setHealth(20);
//Rules
player.getInventory().setItem(6, _ruleBook);
//Scoreboard
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
player.setScoreboard(board);
_scoreboards.put(player, board);
//Objective
Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
for (Rank rank : Rank.values())
{
final Player player = event.getPlayer();
if (rank != Rank.ALL)
board.registerNewTeam(rank.Name).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " ");
else
board.registerNewTeam(rank.Name).setPrefix("");
}
//Survival
player.setGameMode(GameMode.SURVIVAL);
for (Player otherPlayer : Bukkit.getOnlinePlayers())
{
if (_clientManager.Get(otherPlayer) == null)
continue;
//Public Message
event.setJoinMessage(null);
String rankName = _clientManager.Get(player).GetRank().Name;
String otherRankName = _clientManager.Get(otherPlayer).GetRank().Name;
//Teleport
player.teleport(GetSpawn());
//Allow Double Jump
player.setAllowFlight(true);
UtilInv.Clear(player);
player.getInventory().setItem(6, _ruleBook);
//Scoreboard
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
player.setScoreboard(board);
_scoreboards.put(player, board);
//Objective
Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
for (Rank rank : Rank.values())
if (!_clientManager.Get(player).GetRank().Has(Rank.ULTRA) && _donationManager.Get(player.getName()).OwnsUltraPackage())
{
if (rank != Rank.ALL)
board.registerNewTeam(rank.Name).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " ");
else
board.registerNewTeam(rank.Name).setPrefix("");
rankName = Rank.ULTRA.Name;
}
for (Player otherPlayer : Bukkit.getOnlinePlayers())
if (!_clientManager.Get(otherPlayer).GetRank().Has(Rank.ULTRA) && _donationManager.Get(otherPlayer.getName()).OwnsUltraPackage())
{
if (_clientManager.Get(otherPlayer) == null)
continue;
String rankName = _clientManager.Get(player).GetRank().Name;
String otherRankName = _clientManager.Get(otherPlayer).GetRank().Name;
if (!_clientManager.Get(player).GetRank().Has(Rank.ULTRA) && _donationManager.Get(player.getName()).OwnsUltraPackage())
{
rankName = Rank.ULTRA.Name;
}
if (!_clientManager.Get(otherPlayer).GetRank().Has(Rank.ULTRA) && _donationManager.Get(otherPlayer.getName()).OwnsUltraPackage())
{
otherRankName = Rank.ULTRA.Name;
}
//Add Other to Self
board.getTeam(otherRankName).addPlayer(otherPlayer);
//Add Self to Other
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
otherRankName = Rank.ULTRA.Name;
}
//Add Other to Self
board.getTeam(otherRankName).addPlayer(otherPlayer);
//Add Self to Other
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
}
catch (Exception ex)
{
Logger.Instance.log(ex);
System.out.println("[HubManager] Player Join exception");
throw ex;
}
}
@EventHandler
public void PlayerDeath(PlayerDeathEvent event)
{
//XXX make this work > event.setKeepInventory(true);
event.getDrops().clear();
}
@EventHandler
@ -658,13 +663,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler
public void FoodHealthUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
if (event.getType() != UpdateType.SEC)
return;
for (Player player : UtilServer.getPlayers())
{
player.setHealth(20);
player.setFoodLevel(20);
player.setExhaustion(0f);
player.setSaturation(3f);
}
}
@ -938,4 +944,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
{
}
}

View File

@ -96,10 +96,10 @@ public class WorldManager extends MiniPlugin
Location loc = Manager.GetSpawn();
if (r > 0.75) loc.add(32, 0.5, 0);
else if (r > 0.5) loc.add(0, 0.5, 32);
else if (r > 0.25) loc.add(-32, 0.5, 0);
else loc.add(0, 0.5, -32);
if (r > 0.75) loc = new Location(Manager.GetSpawn().getWorld(), -9, 72, 42);
else if (r > 0.5) loc = new Location(Manager.GetSpawn().getWorld(), -36, 72, -28);
else if (r > 0.25) loc = new Location(Manager.GetSpawn().getWorld(), 31, 72, -34);
else loc = new Location(Manager.GetSpawn().getWorld(), 43, 72, 5);
//Spawn
if (Manager.Mode.equals("Halloween"))

View File

@ -32,8 +32,8 @@ public class PartyTutorial extends Tutorial
));
_phases.add(new TutorialPhase(
manager.GetSpawn().add(84, y+69, 10),
manager.GetSpawn().add(81, y+68.5, 10),
manager.GetSpawn().add(84, y+69, 9),
manager.GetSpawn().add(81, y+68.5, 9),
"Creating a Party",
new String[]
{
@ -47,8 +47,8 @@ public class PartyTutorial extends Tutorial
));
_phases.add(new TutorialPhase(
manager.GetSpawn().add(84, y+69, 10),
manager.GetSpawn().add(81, y+68.5, 10),
manager.GetSpawn().add(84, y+69, 9),
manager.GetSpawn().add(81, y+68.5, 9),
"Inviting and Suggesting Players",
new String[]
{
@ -61,8 +61,8 @@ public class PartyTutorial extends Tutorial
));
_phases.add(new TutorialPhase(
manager.GetSpawn().add(84, y+69, 10),
manager.GetSpawn().add(81, y+68.5, 10),
manager.GetSpawn().add(84, y+69, 9),
manager.GetSpawn().add(81, y+68.5, 9),
"Leaving Parties",
new String[]
{
@ -73,8 +73,8 @@ public class PartyTutorial extends Tutorial
));
_phases.add(new TutorialPhase(
manager.GetSpawn().add(84, y+69, 10),
manager.GetSpawn().add(81, y+68.5, 10),
manager.GetSpawn().add(84, y+69, 9),
manager.GetSpawn().add(81, y+68.5, 9),
"Kicking Players from Party",
new String[]
{
@ -87,8 +87,8 @@ public class PartyTutorial extends Tutorial
));
_phases.add(new TutorialPhase(
manager.GetSpawn().add(84, y+69, 10),
manager.GetSpawn().add(81, y+68.5, 10),
manager.GetSpawn().add(84, y+69, 9),
manager.GetSpawn().add(81, y+68.5, 9),
"Joining Games Together",
new String[]
{
@ -103,8 +103,8 @@ public class PartyTutorial extends Tutorial
));
_phases.add(new TutorialPhase(
manager.GetSpawn().add(84, y+69, 10),
manager.GetSpawn().add(81, y+68.5, 10),
manager.GetSpawn().add(84, y+69, 9),
manager.GetSpawn().add(81, y+68.5, 9),
"Party Chat",
new String[]
{
@ -118,8 +118,8 @@ public class PartyTutorial extends Tutorial
));
_phases.add(new TutorialPhase(
manager.GetSpawn(),
manager.GetSpawn().add(0, y+0.5, 10),
manager.GetSpawn().add(0, -2, 0),
manager.GetSpawn().add(0, -2.1, 5),
"End",
new String[]
{

View File

@ -132,8 +132,8 @@ public class WelcomeTutorial extends Tutorial
//END
_phases.add(new TutorialPhase(
manager.GetSpawn().add(0, -3, 0),
manager.GetSpawn().add(0, -3.1, 5),
manager.GetSpawn().add(0, -2, 0),
manager.GetSpawn().add(0, -2.1, 5),
"End",
new String[]
{

View File

@ -18,8 +18,17 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.managers.GameLobbyManager;
import nautilus.game.arcade.scoreboard.GameScoreboard;
import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.DamageDealtStatTracker;
import nautilus.game.arcade.stats.DamageTakenStatTracker;
import nautilus.game.arcade.stats.DeathsStatTracker;
import nautilus.game.arcade.stats.KillsStatTracker;
import nautilus.game.arcade.stats.LoseStatTracker;
import nautilus.game.arcade.stats.StatTracker;
import nautilus.game.arcade.stats.WinStatTracker;
import nautilus.game.arcade.world.WorldData;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -197,6 +206,7 @@ public abstract class Game implements Listener
public int EloStart = 1000;
public ArrayList<String> GemBoosters = new ArrayList<String>();
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{
@ -233,6 +243,16 @@ public abstract class Game implements Listener
}
WorldData = new WorldData(this);
registerStatTrackers(
new KillsStatTracker(this),
new DeathsStatTracker(this),
new AssistsStatTracker(this),
new WinStatTracker(this),
new LoseStatTracker(this),
new DamageDealtStatTracker(this),
new DamageTakenStatTracker(this)
);
System.out.println("Loading " + GetName() + "...");
}
@ -1081,4 +1101,28 @@ public abstract class Game implements Listener
{
return _stats;
}
public void registerStatTrackers(StatTracker<? extends Game>... statTrackers)
{
for (StatTracker<? extends Game> tracker : statTrackers)
{
if (_statTrackers.add(tracker))
Bukkit.getPluginManager().registerEvents(tracker, Manager.GetPlugin());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() == GameState.End)
{
for (StatTracker tracker : getStatTrackers())
HandlerList.unregisterAll(tracker);
}
}
public Collection<StatTracker<? extends Game>> getStatTrackers()
{
return _statTrackers;
}
}

View File

@ -60,6 +60,10 @@ import nautilus.game.arcade.game.games.bridge.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.BridgesSniperStatTracker;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
public class Bridge extends TeamGame implements OreObsfucation
{
@ -174,6 +178,13 @@ public class Bridge extends TeamGame implements OreObsfucation
_tournament = Manager.IsTournamentServer();
registerStatTrackers(
new BridgesSniperStatTracker(this),
new TntMinerStatTracker(this),
new FastKillsStatTracker(this, 4, 10, "Rampage"),
new DeathBomberStatTracker(this)
);
}
@EventHandler

View File

@ -11,12 +11,11 @@ import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@ -29,12 +28,14 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
@ -57,24 +58,80 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.castlesiege.kits.*;
import nautilus.game.arcade.game.games.castlesiege.kits.KitHumanKnight;
import nautilus.game.arcade.game.games.castlesiege.kits.KitHumanMarksman;
import nautilus.game.arcade.game.games.castlesiege.kits.KitHumanPeasant;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadArcher;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadGhoul;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadZombie;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.BloodThirstyStatTracker;
import nautilus.game.arcade.stats.KingSlayerStatTracker;
public class CastleSiege extends TeamGame
{
public static class KingDamageEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final double _damage;
public KingDamageEvent(Player who, double damage)
{
super(who);
_damage = damage;
}
public double getDamage()
{
return _damage;
}
}
public static class KingSlaughterEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
public KingSlaughterEvent(Player who)
{
super(who);
}
}
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
private long _tntSpawn = 0;
private ArrayList<Location> _tntSpawns = new ArrayList<Location>();
private ArrayList<Location> _tntWeakness = new ArrayList<Location>();
private HashMap<Player, FallingBlock> _tntCarry = new HashMap<Player, FallingBlock>();
private HashSet<Player> _tntCarryEnd = new HashSet<Player>();
private ArrayList<Location> _kingLocs;
private Creature _king;
private Location _kingLoc;
@ -89,40 +146,40 @@ public class CastleSiege extends TeamGame
{
super(manager, GameType.CastleSiege,
new Kit[]
{
new KitHumanMarksman(manager),
new KitHumanKnight(manager),
//new KitHumanBrawler(manager),
//new KitHumanAssassin(manager),
new NullKit(manager),
new KitHumanPeasant(manager),
new NullKit(manager),
new KitUndeadGhoul(manager),
new KitUndeadArcher(manager),
new KitUndeadZombie(manager),
new Kit[]
{
new KitHumanMarksman(manager),
new KitHumanKnight(manager),
//new KitHumanBrawler(manager),
//new KitHumanAssassin(manager),
new NullKit(manager),
new KitHumanPeasant(manager),
new NullKit(manager),
new KitUndeadGhoul(manager),
new KitUndeadArcher(manager),
new KitUndeadZombie(manager),
},
new String[]
{
F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.",
"",
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
new String[]
{
F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.",
"",
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
});
});
_help = new String[]
{
"Marksmen are extremely important to defence!",
"It's recommended 50%+ of defence are Marksmen.",
"Use Barricades to block the Undeads path.",
"Use TNT to destroy weak points in walls.",
"Weak points are marked by cracked stone brick.",
"Undead can break fences with their axes.",
"Undead Archers must pick up arrows from the ground.",
"Marksmen are extremely important to defence!",
"It's recommended 50%+ of defence are Marksmen.",
"Use Barricades to block the Undeads path.",
"Use TNT to destroy weak points in walls.",
"Weak points are marked by cracked stone brick.",
"Undead can break fences with their axes.",
"Undead Archers must pick up arrows from the ground.",
};
@ -132,6 +189,12 @@ public class CastleSiege extends TeamGame
this.BlockPlaceAllow.add(85);
_kingName = C.cYellow + C.Bold + "King Sparklez";
registerStatTrackers(
new KingSlayerStatTracker(this),
new BloodThirstyStatTracker(this),
new AssistsStatTracker(this)
);
}
@Override
@ -140,7 +203,7 @@ public class CastleSiege extends TeamGame
_tntSpawns = WorldData.GetDataLocs("RED");
_tntWeakness = WorldData.GetDataLocs("BLACK");
_kingLocs = WorldData.GetDataLocs("YELLOW");
_kingLocs = WorldData.GetDataLocs("YELLOW");
_peasantSpawns = WorldData.GetDataLocs("GREEN");
_horseSpawns = WorldData.GetDataLocs("BROWN");
@ -179,16 +242,16 @@ public class CastleSiege extends TeamGame
if (event.GetState() != GameState.Prepare)
return;
for (int i=0 ; i<WorldData.GetDataLocs("PINK").size() && i<3 ; i++)
for (int i = 0; i < WorldData.GetDataLocs("PINK").size() && i < 3; i++)
{
if (GetKits().length <= 5+i)
if (GetKits().length <= 5 + i)
continue;
this.CreatureAllowOverride = true;
Entity ent = GetKits()[5+i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i));
Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i));
this.CreatureAllowOverride = false;
Manager.GetLobby().AddKitLocation(ent, GetKits()[5+i], WorldData.GetDataLocs("PINK").get(i));
Manager.GetLobby().AddKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("PINK").get(i));
}
}
@ -313,20 +376,22 @@ public class CastleSiege extends TeamGame
event.SetCancelled("King Damage");
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (damager == null) return;
GameTeam team = GetTeam(damager);
if (team != null && team.GetColor() == ChatColor.RED)
{
if (!Recharge.Instance.use(damager, "Damage King", 400, false, false))
return;
_king.playEffect(EntityEffect.HURT);
_kingDamager = damager;
_kingHealth--;
Bukkit.getPluginManager().callEvent(new KingDamageEvent(damager, 1));
if (_kingHealth < 0)
_kingHealth = 0;
@ -362,7 +427,7 @@ public class CastleSiege extends TeamGame
}
@EventHandler
public void PlayerDeath(PlayerGameRespawnEvent event)
public void PlayerDeath(PlayerGameRespawnEvent event)
{
if (GetTeam(ChatColor.AQUA).HasPlayer(event.GetPlayer()))
SetKit(event.GetPlayer(), GetKits()[3], true);
@ -392,7 +457,7 @@ public class CastleSiege extends TeamGame
continue;
Kit kit = GetKit(player);
if (kit == null) continue;
if (kit == null) continue;
if (kit.GetName().contains("Castle"))
{
@ -419,7 +484,7 @@ public class CastleSiege extends TeamGame
{
Scoreboard.WriteBlank();
Scoreboard.Write(group);
Scoreboard.Write(ChatColor.getLastColors(group) + _scoreGroup.get(group) + " Players");
Scoreboard.Write(ChatColor.getLastColors(group) + _scoreGroup.get(group) + " Players");
}
//King
@ -427,9 +492,9 @@ public class CastleSiege extends TeamGame
{
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "King");
Scoreboard.Write(_kingHealth + " Health");
Scoreboard.Write(_kingHealth + " Health");
}
long timeLeft = 24000 - WorldTimeSet;
timeLeft = timeLeft / 20 * 1000;
@ -438,18 +503,18 @@ public class CastleSiege extends TeamGame
{
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Sun Rise");
Scoreboard.Write(UtilTime.MakeStr(timeLeft, 0));
Scoreboard.Write(UtilTime.MakeStr(timeLeft, 0));
}
else
{
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Sun Rise");
Scoreboard.Write("Undead Burning!");
Scoreboard.Write("Undead Burning!");
for (Player player : GetTeam(ChatColor.RED).GetPlayers(true))
Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false);
}
Scoreboard.Draw();
}
@ -489,6 +554,8 @@ public class CastleSiege extends TeamGame
{
SetCustomWinLine(C.cRed + _kingDamager.getName() + C.cWhite + " slaughtered " + _kingName + ChatColor.RESET + "!");
AddGems(_kingDamager, 20, "King Slayer", false);
Bukkit.getPluginManager().callEvent(new KingSlaughterEvent(_kingDamager));
}
else
SetCustomWinLine(_kingName + ChatColor.RESET + " has died!");
@ -565,7 +632,7 @@ public class CastleSiege extends TeamGame
event.getClickedBlock().setTypeId(0);
FallingBlock tnt = player.getWorld().spawnFallingBlock(player.getEyeLocation(), 46, (byte)0);
FallingBlock tnt = player.getWorld().spawnFallingBlock(player.getEyeLocation(), 46, (byte) 0);
player.eject();
player.setPassenger(tnt);
@ -583,7 +650,7 @@ public class CastleSiege extends TeamGame
return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR)
return;
return;
Player player = event.getPlayer();
@ -603,7 +670,7 @@ public class CastleSiege extends TeamGame
_tntCarry.remove(player).remove();
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class);
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class);
tnt.setFuseTicks(0);
UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + "."));
}
@ -618,12 +685,12 @@ public class CastleSiege extends TeamGame
//Remove the TNT
_tntCarry.get(player).remove();
//Flag for Removal
_tntCarryEnd.add(player);
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class);
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class);
tnt.setFuseTicks(0);
UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + "."));
}
@ -632,11 +699,11 @@ public class CastleSiege extends TeamGame
public void TNTDamageDivert(ProjectileHitEvent event)
{
Iterator<Player> playerIterator = _tntCarry.keySet().iterator();
while (playerIterator.hasNext())
{
Player player = playerIterator.next();
if (player.getPassenger() == null)
continue;
@ -647,21 +714,21 @@ public class CastleSiege extends TeamGame
int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d));
//Damage Event
Manager.GetDamage().NewDamageEvent(player, (LivingEntity)event.getEntity().getShooter(), event.getEntity(),
Manager.GetDamage().NewDamageEvent(player, (LivingEntity)event.getEntity().getShooter(), event.getEntity(),
DamageCause.CUSTOM, damage, true, false, false,
null, GetName());
event.getEntity().remove();
}
if (_tntCarryEnd.contains(player))
{
playerIterator.remove();
}
}
}
_tntCarryEnd.clear();
}
}
@EventHandler
@ -673,7 +740,7 @@ public class CastleSiege extends TeamGame
Iterator<Player> tntIterator = _tntCarry.keySet().iterator();
while (tntIterator.hasNext())
{
{
Player player = tntIterator.next();
FallingBlock block = _tntCarry.get(player);
@ -691,16 +758,16 @@ public class CastleSiege extends TeamGame
FireworkEffect effect = FireworkEffect.builder().withColor(Color.RED).with(Type.BURST).build();
try
try
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
}
catch (Exception e)
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
@EventHandler
public void TNTWeakness(ExplosionPrimeEvent event)
@ -722,7 +789,7 @@ public class CastleSiege extends TeamGame
final Location extra = weakness;
for (int i=0 ; i<10 ; i++)
for (int i = 0; i < 10; i++)
{
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
@ -732,7 +799,7 @@ public class CastleSiege extends TeamGame
tnt.setFuseTicks(0);
tnt.setIsIncendiary(true);
}
}, i*3);
}, i * 3);
}
weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f);
@ -788,7 +855,7 @@ public class CastleSiege extends TeamGame
}
@EventHandler
public void DayTimer(UpdateEvent event)
public void DayTimer(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
@ -796,11 +863,11 @@ public class CastleSiege extends TeamGame
if (event.getType() != UpdateType.TICK)
return;
WorldTimeSet = (WorldTimeSet+1);
WorldTimeSet = (WorldTimeSet + 1);
}
@EventHandler
public void SnowDamage(UpdateEvent event)
public void SnowDamage(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
@ -812,11 +879,11 @@ public class CastleSiege extends TeamGame
if (player.getLocation().getBlock().getTypeId() == 78)
{
//Damage Event
Manager.GetDamage().NewDamageEvent(player, null, null,
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.DROWNING, 2, false, true, false,
"Snow", "Snow Damage");
player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80);
}
}
}
}

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.castlesiege.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public abstract class KitHuman extends Kit
{
public KitHuman(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
}
public KitHuman(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
}
}

View File

@ -19,7 +19,7 @@ import nautilus.game.arcade.kit.perks.PerkLeap;
import nautilus.game.arcade.kit.perks.PerkPowershot;
import nautilus.game.arcade.kit.perks.PerkRegeneration;
public class KitHumanAssassin extends Kit
public class KitHumanAssassin extends KitHuman
{
public KitHumanAssassin(ArcadeManager manager)
{

View File

@ -18,7 +18,7 @@ import nautilus.game.arcade.kit.perks.PerkCleave;
import nautilus.game.arcade.kit.perks.PerkKnockbackGive;
import nautilus.game.arcade.kit.perks.PerkSeismicSlamCS;
public class KitHumanBrawler extends Kit
public class KitHumanBrawler extends KitHuman
{
public KitHumanBrawler(ArcadeManager manager)
{

View File

@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitHumanKnight extends Kit
public class KitHumanKnight extends KitHuman
{
public KitHumanKnight(ArcadeManager manager)
{

View File

@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
public class KitHumanMarksman extends Kit
public class KitHumanMarksman extends KitHuman
{
public KitHumanMarksman(ArcadeManager manager)
{

View File

@ -19,7 +19,7 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkKnockbackGive;
import nautilus.game.arcade.kit.perks.PerkStrength;
public class KitHumanPeasant extends Kit
public class KitHumanPeasant extends KitHuman
{
public KitHumanPeasant(ArcadeManager manager)
{

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.castlesiege.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public abstract class KitUndead extends Kit
{
public KitUndead(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
}
public KitUndead(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
}
}

View File

@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkIronSkin;
public class KitUndeadArcher extends Kit
public class KitUndeadArcher extends KitUndead
{
public KitUndeadArcher(ArcadeManager manager)
{

View File

@ -15,7 +15,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitUndeadGhoul extends Kit
public class KitUndeadGhoul extends KitUndead
{
public KitUndeadGhoul(ArcadeManager manager)
{

View File

@ -15,7 +15,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitUndeadZombie extends Kit
public class KitUndeadZombie extends KitUndead
{
public KitUndeadZombie(ArcadeManager manager)
{

View File

@ -13,6 +13,8 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -51,6 +53,11 @@ public class ChampionsDominate extends Domination
EloRanking = false;
EloStart = 1000;
registerStatTrackers(
new ElectrocutionStatTracker(this),
new SeismicSlamStatTracker(this)
);
}
@Override

View File

@ -17,6 +17,10 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.TeamDeathmatch;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class ChampionsTDM extends TeamDeathmatch
{
@ -47,6 +51,13 @@ public class ChampionsTDM extends TeamDeathmatch
};
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this),
new ElectrocutionStatTracker(this),
new SeismicSlamStatTracker(this)
);
}
@Override

View File

@ -31,6 +31,7 @@ import nautilus.game.arcade.game.games.deathtag.kits.*;
import nautilus.game.arcade.game.games.sneakyassassins.powerups.PowerUpManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.ComeAtMeBroStatTracker;
public class DeathTag extends SoloGame
{
@ -70,6 +71,8 @@ public class DeathTag extends SoloGame
this.CompassEnabled = true;
this.PrepareFreeze = false;
registerStatTrackers(new ComeAtMeBroStatTracker(this));
}
@Override

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.deathtag.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
public abstract class AbstractKitChaser extends SmashKit
{
public AbstractKitChaser(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
}
public AbstractKitChaser(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
}
}

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.deathtag.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public abstract class AbstractKitRunner extends Kit
{
public AbstractKitRunner(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
}
public AbstractKitRunner(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
}
}

View File

@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkIronSkin;
import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier;
public class KitAlphaChaser extends SmashKit
public class KitAlphaChaser extends AbstractKitChaser
{
public KitAlphaChaser(ArcadeManager manager)
{

View File

@ -15,7 +15,7 @@ import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkIronSkin;
public class KitChaser extends SmashKit
public class KitChaser extends AbstractKitChaser
{
public KitChaser(ArcadeManager manager)
{

View File

@ -13,7 +13,7 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
public class KitRunnerArcher extends Kit
public class KitRunnerArcher extends AbstractKitRunner
{
public KitRunnerArcher(ArcadeManager manager)
{

View File

@ -12,7 +12,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkCripple;
public class KitRunnerBasher extends Kit
public class KitRunnerBasher extends AbstractKitRunner
{
public KitRunnerBasher(ArcadeManager manager)
{

View File

@ -12,7 +12,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkKnockback;
public class KitRunnerTraitor extends Kit
public class KitRunnerTraitor extends AbstractKitRunner
{
public KitRunnerTraitor(ArcadeManager manager)
{

View File

@ -38,6 +38,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.dragonescape.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.ParalympicsStatTracker;
import nautilus.game.arcade.stats.WinMapStatTracker;
public class DragonEscape extends SoloGame
{
@ -75,6 +77,11 @@ public class DragonEscape extends SoloGame
this.DamagePvP = false;
this.HungerSet = 20;
registerStatTrackers(
new ParalympicsStatTracker(this),
new WinMapStatTracker(this)
);
}
@Override

View File

@ -33,6 +33,7 @@ import nautilus.game.arcade.game.games.dragons.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkSparkler;
import nautilus.game.arcade.stats.SparklezStatTracker;
public class Dragons extends SoloGame
{
@ -62,6 +63,10 @@ public class Dragons extends SoloGame
this.DamagePvP = false;
this.HungerSet = 20;
this.WorldWaterDamage = 4;
registerStatTrackers(
new SparklezStatTracker(this)
);
}
@Override

View File

@ -45,6 +45,9 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.GameScore;
import nautilus.game.arcade.game.games.draw.kits.KitPlayer;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KeenEyeStatTracker;
import nautilus.game.arcade.stats.MrSquiggleStatTracker;
import nautilus.game.arcade.stats.PureLuckStatTracker;
public class Draw extends SoloGame
{
@ -99,6 +102,12 @@ public class Draw extends SoloGame
{
"Bird", "Volcano", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Crack", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin",
};
registerStatTrackers(
new MrSquiggleStatTracker(this),
new KeenEyeStatTracker(this),
new PureLuckStatTracker(this)
);
}
@Override

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.hideseek;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
@ -29,6 +30,7 @@ import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -37,6 +39,7 @@ import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -76,12 +79,67 @@ import nautilus.game.arcade.game.games.hideseek.forms.Form;
import nautilus.game.arcade.game.games.hideseek.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
@SuppressWarnings("deprecation")
public class HideSeek extends TeamGame
{
public static class MeowEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
public MeowEvent(Player who)
{
super(who);
}
}
public static class ChangeFormEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Form _form;
public ChangeFormEvent(Player who, Form form)
{
super(who);
_form = form;
}
public Form getForm()
{
return _form;
}
}
private GameTeam _hiders;
private GameTeam _seekers;
@ -150,6 +208,13 @@ public class HideSeek extends TeamGame
Manager.GetExplosion().SetRegenerate(true);
Manager.GetExplosion().SetTNTSpread(false);
Manager.getCosmeticManager().setHideParticles(true);
registerStatTrackers(
new HunterKillerStatTracker(this),
new MeowStatTracker(this),
new HunterKillerStatTracker(this),
new BadHiderStatTracker(this)
);
}
public Material GetItemEquivilent(Material mat)
@ -283,7 +348,13 @@ public class HideSeek extends TeamGame
public void InitialDisguise(PlayerPrepareTeleportEvent event)
{
if (_hiders.HasPlayer(event.GetPlayer().getName(), true))
_forms.put(event.GetPlayer(), new BlockForm(this, event.GetPlayer(), _allowedBlocks.get(UtilMath.r(_allowedBlocks.size()))));
{
Form form = new BlockForm(this, event.GetPlayer(), _allowedBlocks.get(UtilMath.r(_allowedBlocks.size())));
_forms.put(event.GetPlayer(), form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(event.GetPlayer(), form));
}
}
@ -314,8 +385,12 @@ public class HideSeek extends TeamGame
//Remove Old
_forms.get(player).Remove();
Form form = new BlockForm(this, player, event.getClickedBlock().getType());
//Set New
_forms.put(player, new BlockForm(this, player, event.getClickedBlock().getType()));
_forms.put(player, form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
}
@EventHandler
@ -344,8 +419,12 @@ public class HideSeek extends TeamGame
//Remove Old
_forms.get(player).Remove();
Form form = new CreatureForm(this, player, event.getRightClicked().getType());
//Set New
_forms.put(player, new CreatureForm(this, player, event.getRightClicked().getType()));
_forms.put(player, form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
}
@EventHandler
@ -372,8 +451,12 @@ public class HideSeek extends TeamGame
//Remove Old
_forms.get(player).Remove();
Form form = new CreatureForm(this, player, event.GetDamageeEntity().getType());
//Set New
_forms.put(player, new CreatureForm(this, player, event.GetDamageeEntity().getType()));
_forms.put(player, form);
Bukkit.getPluginManager().callEvent(new ChangeFormEvent(player, form));
}
@EventHandler
@ -742,6 +825,8 @@ public class HideSeek extends TeamGame
this.AddGems(player, 0.25, "Meows", true);
UtilParticle.PlayParticle(ParticleType.NOTE, player.getLocation().add(0, 0.75, 0), 0.4f, 0.4f, 0.4f, 0, 6);
Bukkit.getPluginManager().callEvent(new MeowEvent(event.getPlayer()));
}
@EventHandler
@ -1077,4 +1162,14 @@ public class HideSeek extends TeamGame
if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true);
}
public GameTeam getHiders()
{
return _hiders;
}
public GameTeam getSeekers()
{
return _seekers;
}
}

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.hideseek.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public abstract class KitHider extends Kit
{
public KitHider(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
}
public KitHider(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
}
}

View File

@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitHiderQuick extends Kit
public class KitHiderQuick extends KitHider
{
public KitHiderQuick(ArcadeManager manager)
{

View File

@ -18,7 +18,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitHiderShocker extends Kit
public class KitHiderShocker extends KitHider
{
public KitHiderShocker(ArcadeManager manager)
{

View File

@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitHiderSwapper extends Kit
public class KitHiderSwapper extends KitHider
{
public KitHiderSwapper(ArcadeManager manager)
{

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.hideseek.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public abstract class KitSeeker extends Kit
{
public KitSeeker(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
}
public KitSeeker(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
}
}

View File

@ -18,7 +18,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkLeap;
public class KitSeekerLeaper extends Kit
public class KitSeekerLeaper extends KitSeeker
{
public KitSeekerLeaper(ArcadeManager manager)
{

View File

@ -18,7 +18,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkRadar;
public class KitSeekerRadar extends Kit
public class KitSeekerRadar extends KitSeeker
{
public KitSeekerRadar(ArcadeManager manager)
{

View File

@ -18,7 +18,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitSeekerTNT extends Kit
public class KitSeekerTNT extends KitSeeker
{
public KitSeekerTNT(ArcadeManager manager)
{

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
@ -22,10 +23,12 @@ import org.bukkit.entity.Snowball;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
@ -53,9 +56,44 @@ import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.paintball.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.LastStandStatTracker;
import nautilus.game.arcade.stats.MedicStatTracker;
import nautilus.game.arcade.stats.WinFastStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class Paintball extends TeamGame
{
public static class ReviveEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Player _revivedPlayer;
public ReviveEvent(Player who, Player revivedPlayer)
{
super(who);
_revivedPlayer = revivedPlayer;
}
public Player getRevivedPlayer()
{
return _revivedPlayer;
}
}
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
private HashSet<Projectile> _water = new HashSet<Projectile>();
@ -78,6 +116,14 @@ public class Paintball extends TeamGame
});
this.HungerSet = 20;
registerStatTrackers(
new FastKillsStatTracker(this, 4, 5, "KillingSpree"),
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new MedicStatTracker(this),
new WinFastStatTracker(this, 20, "Speedrunner"),
new LastStandStatTracker(this)
);
}
@EventHandler
@ -351,6 +397,8 @@ public class Paintball extends TeamGame
copyIterator.remove();
AddGems(thrower, 3, "Revived Ally", true);
Bukkit.getPluginManager().callEvent(new ReviveEvent(thrower, copy.GetPlayer()));
}
//Clean

View File

@ -32,6 +32,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.quiver.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.SharpShooterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
public class Quiver extends SoloGame
{
@ -73,6 +75,11 @@ public class Quiver extends SoloGame
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "Perfectionist"),
new SharpShooterStatTracker(this)
);
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -2,6 +2,18 @@ package nautilus.game.arcade.game.games.sheep;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -14,122 +26,114 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.util.Vector;
public class SheepData
public class SheepData
{
public SheepGame Host;
public Sheep Sheep;
public long LastMoved = 0;
public Player Holder = null;
public GameTeam HolderTeam = null;
public GameTeam Owner = null;
public ArrayList<Block> OwnerPen = null;
public Location OwnerPenMiddle = null;
public Location StuckLocation = null;
public long StuckTime = System.currentTimeMillis();
public Location Target = null;
public SheepData(SheepGame host, Sheep sheep)
{
Host = host;
Sheep = sheep;
LastMoved = System.currentTimeMillis();
StuckLocation = Sheep.getLocation();
StuckTime = System.currentTimeMillis();
UtilEnt.Vegetate(Sheep);
UtilEnt.ghost(Sheep, true, false);
}
public void SetHolder(Player player)
{
Holder = player;
HolderTeam = Host.GetTeam(player);
if (Holder != null)
Bukkit.getPluginManager().callEvent(new SheepGame.SheepStolenEvent(Holder));
}
public void SetOwner(GameTeam team, ArrayList<Block> locs)
{
//Holding sheep in an enemies base.
if (Sheep.getVehicle() != null)
if (HolderTeam != null && !HolderTeam.equals(team))
return;
Sheep.leaveVehicle();
Target = null;
//Already owned, dont do all the stuff
if (Owner != null && Owner.equals(team))
return;
Owner = team;
OwnerPen = locs;
//Middle
Vector vec = new Vector(0,0,0);
Vector vec = new Vector(0, 0, 0);
for (Block block : locs)
vec.add(block.getLocation().toVector());
vec.multiply(1d/(double)locs.size());
vec.multiply(1d / (double) locs.size());
OwnerPenMiddle = vec.toLocation(OwnerPen.get(0).getWorld());
OwnerPenMiddle.add(0.5, 0, 0.5);
Sheep.setColor(DyeColor.getByWoolData(team.GetColorData()));
StuckLocation = Sheep.getLocation();
StuckTime = System.currentTimeMillis();
//Effect
Sheep.getWorld().playSound(Sheep.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f);
UtilFirework.playFirework(Sheep.getLocation().add(0, 0.5, 0), FireworkEffect.builder().flicker(false).withColor(team.GetColorBase()).with(Type.BALL).trail(false).build());
//Reward
if (Holder != null && HolderTeam != null)
{
Host.AddGems(Holder, 3, "Sheep Captured", true);
UtilPlayer.message(Holder, F.main("Game", "You captured a Sheep!"));
UtilDisplay.displayTextBar(Host.Manager.GetPlugin(), Holder, 0f, C.cGreen + C.Bold + "You captured a Sheep!");
}
Holder = null;
HolderTeam = null;
}
public boolean Update()
{
if (!Sheep.isValid())
return true;
Host.GetTeamPen(this);
if (Sheep.getVehicle() != null)
return false;
//No Team - Not picked up for a long time
if (Owner == null || OwnerPen == null)
{
if (UtilMath.offset(Sheep.getLocation(), Host.GetSheepSpawn()) > 14)
{
UtilEnt.CreatureMoveFast(Sheep, Host.GetSheepSpawn(), 1.2f);
if (UtilMath.offset(Sheep.getLocation(), StuckLocation) > 1)
{
StuckLocation = Sheep.getLocation();
@ -149,20 +153,20 @@ public class SheepData
if (IsInsideOwnPen())
{
LastMoved = System.currentTimeMillis();
//Roam Around in Pen
if (Target == null)
Target = UtilAlg.Random(OwnerPen).getLocation().add(0.5, 0, 0.5);
if (UtilMath.offset(Sheep.getLocation(), Target) < 1)
Target = UtilAlg.Random(OwnerPen).getLocation().add(0.5, 0, 0.5);
UtilEnt.CreatureMoveFast(Sheep, Target, 0.8f);
}
else
{
UtilEnt.CreatureMoveFast(Sheep, OwnerPenMiddle, 1.2f);
if (UtilMath.offset(Sheep.getLocation(), StuckLocation) > 1)
{
StuckLocation = Sheep.getLocation();
@ -177,11 +181,11 @@ public class SheepData
}
}
}
return false;
}
public Block SheepBlock()
public Block SheepBlock()
{
Entity ent = Sheep;
@ -189,15 +193,15 @@ public class SheepData
{
ent = ent.getVehicle();
}
return ent.getLocation().getBlock();
}
public boolean IsInsideOwnPen()
{
if (OwnerPen == null)
return false;
return OwnerPen.contains(Sheep.getLocation().getBlock());
}
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
@ -20,9 +21,11 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import mineplex.core.common.util.C;
@ -49,9 +52,63 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.sheep.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.SheepDropStatTracker;
import nautilus.game.arcade.stats.SheepThiefStatTracker;
import nautilus.game.arcade.stats.WinWithSheepStatTracker;
public class SheepGame extends TeamGame
{
public static class SheepStolenEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
public SheepStolenEvent(Player who)
{
super(who);
}
}
public static class DropEnemySheepEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Player _enemy;
public DropEnemySheepEvent(Player who, Player enemy)
{
super(who);
_enemy = enemy;
}
public Player getEnemy()
{
return _enemy;
}
}
private HashMap<GameTeam, Integer> _teamScore = new HashMap<GameTeam, Integer>();
private HashMap<GameTeam, ArrayList<Block>> _sheepPens = new HashMap<GameTeam, ArrayList<Block>>();
@ -91,6 +148,12 @@ public class SheepGame extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerStatTrackers(
new SheepThiefStatTracker(this),
new SheepDropStatTracker(this),
new WinWithSheepStatTracker(this)
);
}
@Override
@ -428,6 +491,8 @@ public class SheepGame extends TeamGame
if (player == null) return;
DropSheep(player);
Bukkit.getPluginManager().callEvent(new DropEnemySheepEvent(event.GetDamagerPlayer(true), player));
}
@EventHandler
@ -614,4 +679,17 @@ public class SheepGame extends TeamGame
{
event.SetCancelled("True");
}*/
public int getSheepCount(GameTeam team)
{
int count = 0;
for (SheepData data : _sheep.values())
{
if (data.HolderTeam == team)
count++;
}
return count;
}
}

View File

@ -32,6 +32,11 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.FreeKitWinStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
public class SuperSmash extends SoloGame
{
@ -87,6 +92,14 @@ public class SuperSmash extends SoloGame
// Add stat table here
// Example
//Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "MLGPro"),
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new FastKillsStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
@ -12,21 +13,21 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
@ -46,90 +47,178 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.snake.kits.*;
import nautilus.game.arcade.game.games.snake.kits.KitInvulnerable;
import nautilus.game.arcade.game.games.snake.kits.KitSpeed;
import nautilus.game.arcade.kit.Kit;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
import nautilus.game.arcade.stats.CannibalStatTracker;
import nautilus.game.arcade.stats.ChooChooStatTracker;
import nautilus.game.arcade.stats.SlimySheepStatTracker;
public class Snake extends SoloGame
{
public static class TailCollisionEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Player _killer;
public TailCollisionEvent(Player who, Player killer)
{
super(who);
_killer = killer;
}
public Player getKiller()
{
return _killer;
}
}
public static class TailGrowEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final int _length;
public TailGrowEvent(Player who, int length)
{
super(who);
_length = length;
}
public int getLength()
{
return _length;
}
}
public static class SlimeUpgradeEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
public SlimeUpgradeEvent(Player who)
{
super(who);
}
}
private double _maxSpeed = 180;
private HashMap<Player, ArrayList<Creature>> _tail = new HashMap<Player, ArrayList<Creature>>();
private HashSet<Entity> _food = new HashSet<Entity>();
private HashMap<Player, DyeColor> _color = new HashMap<Player, DyeColor>();
private HashMap<Player, Long> _invul = new HashMap<Player, Long>();
private HashMap<Player, Long> _speed = new HashMap<Player, Long>();
private HashMap<Player, Location> _move = new HashMap<Player, Location>();
private HashMap<Player, Long> _moveTime = new HashMap<Player, Long>();
public Snake(ArcadeManager manager)
{
super(manager, GameType.Snake,
new Kit[]
{
new KitSpeed(manager),
//new KitOther(manager),
new KitInvulnerable(manager),
new Kit[]
{
new KitSpeed(manager),
//new KitOther(manager),
new KitInvulnerable(manager),
},
new String[]
{
"Avoid hitting snake tails",
"You get faster as you grow longer",
"Eat slimes to grow faster",
"Last one alive wins!"
});
new String[]
{
"Avoid hitting snake tails",
"You get faster as you grow longer",
"Eat slimes to grow faster",
"Last one alive wins!"
});
this.DamageTeamSelf = true;
this.HungerSet = 2;
this.GemMultiplier = 0.5;
registerStatTrackers(
new CannibalStatTracker(this),
new ChooChooStatTracker(this),
new SlimySheepStatTracker(this)
);
}
@EventHandler
public void CreateSheep(GamePrepareCountdownCommence event)
{
for (int i=0 ; i<GetPlayers(true).size() ; i++)
for (int i = 0; i < GetPlayers(true).size(); i++)
{
Player player = GetPlayers(true).get(i);
_color.put(player, DyeColor.getByDyeData((byte) (i%16)));
_color.put(player, DyeColor.getByDyeData((byte) (i % 16)));
this.CreatureAllowOverride = true;
Sheep sheep = player.getWorld().spawn(player.getLocation(), Sheep.class);
this.CreatureAllowOverride = false;
sheep.setColor(DyeColor.getByDyeData((byte) (i%16)));
sheep.setColor(DyeColor.getByDyeData((byte) (i % 16)));
sheep.setPassenger(player);
UtilEnt.Vegetate(sheep);
_tail.put(player, new ArrayList<Creature>());
_tail.get(player).add(sheep);
_tail.get(player).add(sheep);
}
for (Player player : GetPlayers(true))
{
player.playEffect(this.GetSpectatorLocation(), Effect.RECORD_PLAY, 2259);
}
}
@EventHandler
public void ThirdPerson(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
this.Announce(C.cYellow + C.Scramble + "@@" + C.cAqua + C.Bold + " Snake is best played in 3rd Person! (Push F5) " + C.cYellow + C.Scramble + "@@");
}
@EventHandler
public void AutoGrow(UpdateEvent event)
{
@ -140,11 +229,11 @@ public class Snake extends SoloGame
return;
for (Player player : GetPlayers(true))
{
{
Grow(player, 1, false);
}
}
@EventHandler
public void ReSit(UpdateEvent event)
{
@ -155,16 +244,16 @@ public class Snake extends SoloGame
return;
for (Player player : GetPlayers(true))
{
{
if (player.getVehicle() != null)
continue;
if (!_tail.containsKey(player))
continue;
if (_tail.get(player).isEmpty())
continue;
_tail.get(player).get(0).setPassenger(player);
}
}
@ -179,31 +268,31 @@ public class Snake extends SoloGame
return;
for (Player player : GetPlayers(true))
{
{
if (!_tail.containsKey(player))
continue;
double mult = 0.4;
if (_tail.containsKey(player))
mult += Math.min(0.7, (double)_tail.get(player).size() / _maxSpeed);
mult += Math.min(0.7, (double) _tail.get(player).size() / _maxSpeed);
if (_speed.containsKey(player))
mult = mult * 1.5;
Vector vel = player.getLocation().getDirection().setY(0).normalize().multiply(4);
Creature before = null;
for (int i=0 ; i<_tail.get(player).size() ; i++)
for (int i = 0; i < _tail.get(player).size(); i++)
{
Creature tail = _tail.get(player).get(i);
Location loc = player.getLocation().add(vel);
//First
if (i==0)
if (i == 0)
loc = tail.getLocation().add(vel);
//Others
if (before != null)
loc = before.getLocation();
@ -219,9 +308,9 @@ public class Snake extends SoloGame
tp.setYaw(tail.getLocation().getYaw());
tail.teleport(tp);
}
//Move
EntityCreature ec = ((CraftCreature)tail).getHandle();
EntityCreature ec = ((CraftCreature) tail).getHandle();
Navigation nav = ec.getNavigation();
nav.a(loc.getX(), loc.getY(), loc.getZ(), (1 + 2f * mult) * 1);
@ -230,13 +319,13 @@ public class Snake extends SoloGame
}
}
}
@EventHandler
public void Idle(UpdateEvent event)
{
if (!IsLive())
return;
for (Player player : GetPlayers(true))
{
if (!_tail.containsKey(player))
@ -244,14 +333,14 @@ public class Snake extends SoloGame
KillPlayer(player, null, "No Tail");
continue;
}
if (!_move.containsKey(player) || UtilMath.offset(_tail.get(player).get(0).getLocation(), _move.get(player)) > 2)
{
_move.put(player, _tail.get(player).get(0).getLocation());
_moveTime.put(player, System.currentTimeMillis());
continue;
}
if (UtilTime.elapsed(_moveTime.get(player), 2000))
KillPlayer(player, null, "Idle");
}
@ -268,7 +357,7 @@ public class Snake extends SoloGame
//Hit Tail
for (Player player : GetPlayers(true))
{
{
if (_invul.containsKey(player))
continue;
@ -279,14 +368,14 @@ public class Snake extends SoloGame
if (other.equals(player))
start = 3;
for (int i=start ; i < _tail.get(other).size() ; i++)
for (int i = start; i < _tail.get(other).size(); i++)
{
Creature tail = _tail.get(other).get(i);
if (UtilMath.offset(_tail.get(player).get(0), tail) < 1.2)
{
{
KillPlayer(player, other, null);
done = true;
break;
}
@ -297,24 +386,26 @@ public class Snake extends SoloGame
}
}
}
public void KillPlayer(Player player, Player killer, String type)
{
if (killer != null)
{
//Damage Event
Manager.GetDamage().NewDamageEvent(player, killer, null,
Manager.GetDamage().NewDamageEvent(player, killer, null,
DamageCause.CUSTOM, 500, false, true, false,
killer.getName(), "Snake Tail");
Bukkit.getPluginManager().callEvent(new TailCollisionEvent(player, killer));
}
else
{
//Damage Event
Manager.GetDamage().NewDamageEvent(player, null, null,
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.CUSTOM, 500, false, true, false,
type, type);
}
if (_tail.containsKey(player))
{
for (Creature cur : _tail.get(player))
@ -322,7 +413,7 @@ public class Snake extends SoloGame
cur.playEffect(EntityEffect.HURT);
cur.remove();
}
_tail.get(player).clear();
}
}
@ -340,13 +431,13 @@ public class Snake extends SoloGame
loc.setX(-48 + UtilMath.r(97));
loc.setZ(-48 + UtilMath.r(97));
if (!UtilBlock.airFoliage(loc.getBlock()))
return;
if (UtilMath.offset(loc, this.GetSpectatorLocation()) > 48)
return;
//Spawn
this.CreatureAllowOverride = true;
Slime pig = loc.getWorld().spawn(loc, Slime.class);
@ -384,10 +475,13 @@ public class Snake extends SoloGame
if (UtilMath.offset(food, player) < 2)
{
int amount = 2;
Grow(player, amount, true);
foodIterator.remove();
food.remove();
Bukkit.getPluginManager().callEvent(new SlimeUpgradeEvent(player));
break;
}
}
@ -407,15 +501,15 @@ public class Snake extends SoloGame
loc.add(UtilAlg.getTrajectory2d(_tail.get(player).get(_tail.get(player).size() - 2), _tail.get(player).get(_tail.get(player).size() - 1)));
else
loc.subtract(player.getLocation().getDirection().setY(0));
//Spawn
this.CreatureAllowOverride = true;
Sheep tail = loc.getWorld().spawn(loc, Sheep.class);
this.CreatureAllowOverride = false;
tail.setRemoveWhenFarAway(false);
tail.setColor(_color.get(player));
//Sets yaw/pitch
tail.teleport(loc);
@ -427,25 +521,27 @@ public class Snake extends SoloGame
//Audio
if (sound)
player.getWorld().playSound(player.getLocation(), Sound.EAT, 2f, 1f);
amount--;
Bukkit.getPluginManager().callEvent(new TailGrowEvent(player, _tail.get(player).size()));
}
player.setExp((float) Math.min(0.9999f, (double)_tail.get(player).size() / _maxSpeed));
player.setExp((float) Math.min(0.9999f, (double) _tail.get(player).size() / _maxSpeed));
}
@EventHandler
public void DamageCancel(CustomDamageEvent event)
{
if (event.GetCause() == DamageCause.LAVA)
{
{
if (event.GetDamageePlayer() != null)
{
KillPlayer(event.GetDamageePlayer(), null, "Lava");
return;
}
}
}
if (event.GetCause() != DamageCause.CUSTOM)
event.SetCancelled("Snake Damage");
}
@ -475,11 +571,11 @@ public class Snake extends SoloGame
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.WOOL))
return;
if (!Recharge.Instance.use(player, "Snake Item", 1000, false, false))
return;
UtilInv.remove(player, Material.WOOL, (byte)0, 1);
UtilInv.remove(player, Material.WOOL, (byte) 0, 1);
_invul.put(player, System.currentTimeMillis());
}
@ -504,43 +600,43 @@ public class Snake extends SoloGame
//Self Color
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguiseSheep)
((DisguiseSheep)disguise).setColor(_color.get(player));
((DisguiseSheep) disguise).setColor(_color.get(player));
//Tail Color
if (_tail.containsKey(player))
for (Creature ent : _tail.get(player))
if (ent instanceof Sheep)
((Sheep)ent).setColor(_color.get(player));
((Sheep) ent).setColor(_color.get(player));
invIterator.remove();
continue;
}
DyeColor col = GetColor();
//Self Color
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguiseSheep)
((DisguiseSheep)disguise).setColor(col);
((DisguiseSheep) disguise).setColor(col);
//Tail Color
if (_tail.containsKey(player))
for (Creature ent : _tail.get(player))
if (ent instanceof Sheep)
((Sheep)ent).setColor(col);
((Sheep) ent).setColor(col);
}
}
public DyeColor GetColor()
{
double r = Math.random();
if (r > 0.75) return DyeColor.RED;
else if (r > 0.5) return DyeColor.YELLOW;
else if (r > 0.25) return DyeColor.GREEN;
else return DyeColor.BLUE;
if (r > 0.75) return DyeColor.RED;
else if (r > 0.5) return DyeColor.YELLOW;
else if (r > 0.25) return DyeColor.GREEN;
else return DyeColor.BLUE;
}
@EventHandler
public void SpeedUse(PlayerInteractEvent event)
{
@ -554,11 +650,11 @@ public class Snake extends SoloGame
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.FEATHER))
return;
if (!Recharge.Instance.use(player, "Snake Item", 1000, false, false))
return;
UtilInv.remove(player, Material.FEATHER, (byte)0, 1);
UtilInv.remove(player, Material.FEATHER, (byte) 0, 1);
_speed.put(player, System.currentTimeMillis());
}

View File

@ -4,6 +4,8 @@ import java.lang.reflect.Field;
import java.util.HashMap;
import nautilus.game.arcade.game.games.spleef.kits.*;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -14,7 +16,9 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -33,6 +37,8 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
import nautilus.game.arcade.stats.SpleefBlockDestroyStatTracker;
import net.minecraft.server.v1_7_R4.EntityArrow;
public class Spleef extends SoloGame
@ -59,6 +65,8 @@ public class Spleef extends SoloGame
this.WorldWaterDamage = 4;
this.PrepareFreeze = false;
registerStatTrackers(new SpleefBlockDestroyStatTracker(this));
}
@EventHandler
@ -179,8 +187,6 @@ public class Spleef extends SoloGame
public void BlockFade(Block block, Player player, boolean slowDamage)
{
AddStat(player, "BlocksBroken", 1, false, false);
//Prevent Super Hunger from Bow
if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false))
if (block.getTypeId() != 7)
@ -188,7 +194,7 @@ public class Spleef extends SoloGame
if (!slowDamage)
{
Break(block);
Break(block, player);
return;
}
@ -204,7 +210,7 @@ public class Spleef extends SoloGame
block.setData((byte)14);
else
Break(block);
Break(block, player);
}
//Stone
@ -220,7 +226,7 @@ public class Spleef extends SoloGame
block.setData((byte)2);
else
Break(block);
Break(block, player);
}
//Grass
@ -239,20 +245,22 @@ public class Spleef extends SoloGame
block.setData((byte)2);
else
Break(block);
Break(block, player);
}
//Other
else if (block.getTypeId() != 7)
{
Break(block);
Break(block, player);
}
}
public void Break(Block block)
public void Break(Block block, Player player)
{
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setTypeId(0);
Bukkit.getPluginManager().callEvent(new SpleefDestroyBlockEvent(block, player));
}
@EventHandler

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.spleef;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockEvent;
public class SpleefDestroyBlockEvent extends BlockEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Player _player;
public SpleefDestroyBlockEvent(Block theBlock, Player player)
{
super(theBlock);
_player = player;
}
public Player getPlayer()
{
return _player;
}
}

View File

@ -74,6 +74,11 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.survivalgames.kit.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker;
import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
public class SurvivalGames extends SoloGame
{
@ -230,6 +235,13 @@ public class SurvivalGames extends SoloGame
System.out.println("CREEP TYPE: " + _spreadName);
System.out.println("===================");
//Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened");
registerStatTrackers(
new WinWithoutWearingArmorStatTracker(this),
new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"),
new FirstSupplyDropOpenStatTracker(this),
new SimultaneousSkeletonStatTracker(this, 5)
);
}
@Override

View File

@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -16,12 +17,15 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scoreboard.Score;
import net.minecraft.server.v1_7_R4.EntityArrow;
import net.minecraft.server.v1_7_R4.Item;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -42,13 +46,46 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.turfforts.kits.*;
import nautilus.game.arcade.game.games.turfforts.kits.KitInfiltrator;
import nautilus.game.arcade.game.games.turfforts.kits.KitMarksman;
import nautilus.game.arcade.game.games.turfforts.kits.KitShredder;
import nautilus.game.arcade.kit.Kit;
import net.minecraft.server.v1_7_R4.EntityArrow;
import net.minecraft.server.v1_7_R4.Item;
import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker;
import nautilus.game.arcade.stats.BlockShreadStatTracker;
import nautilus.game.arcade.stats.TheComebackStatTracker;
public class TurfForts extends TeamGame
{
public static class ShredBlockEvent extends BlockEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Arrow _arrow;
public ShredBlockEvent(Block theBlock, Arrow arrow)
{
super(theBlock);
_arrow = arrow;
}
public Arrow getArrow()
{
return _arrow;
}
}
private ArrayList<Location> _turf;
private Location _red;
@ -72,30 +109,36 @@ public class TurfForts extends TeamGame
{
super(manager, GameType.TurfWars,
new Kit[]
{
new Kit[]
{
new KitMarksman(manager),
new KitInfiltrator(manager),
new KitShredder(manager),
new KitMarksman(manager),
new KitInfiltrator(manager),
new KitShredder(manager),
},
new String[]
{
"You have 30 seconds to build your Fort!",
"",
"Each kill advances your turf forwards.",
"Take over all the turf to win!"
new String[]
{
"You have 30 seconds to build your Fort!",
"",
"Each kill advances your turf forwards.",
"Take over all the turf to win!"
});
});
this.HungerSet = 20;
this.DeathOut = false;
this.BlockPlaceAllow.add(35);
this.BlockPlaceAllow.add(35);
this.BlockBreakAllow.add(35);
this.ItemDrop = false;
this.ItemPickup = false;
this.DamageSelf = false;
registerStatTrackers(
new BlockShreadStatTracker(this),
new BehindEnemyLinesStatTracker(this),
new TheComebackStatTracker(this)
);
}
@Override
@ -109,19 +152,19 @@ public class TurfForts extends TeamGame
_blue = WorldData.GetDataLocs("BLUE").get(0);
_blueBase = WorldData.GetDataLocs("LIGHT_BLUE").get(0);
if (_red.getBlockX() > _blue.getBlockX()) xRed = 1;
else if (_red.getBlockX() < _blue.getBlockX()) xRed = -1;
if (_red.getBlockX() > _blue.getBlockX()) xRed = 1;
else if (_red.getBlockX() < _blue.getBlockX()) xRed = -1;
if (_red.getBlockZ() > _blue.getBlockZ()) zRed = 1;
else if (_red.getBlockZ() < _blue.getBlockZ()) zRed = -1;
if (_red.getBlockZ() > _blue.getBlockZ()) zRed = 1;
else if (_red.getBlockZ() < _blue.getBlockZ()) zRed = -1;
//Color Turf
for (Location loc : _turf)
{
if (UtilMath.offset(loc, _red) < UtilMath.offset(loc, _blue))
MapUtil.QuickChangeBlockAt(loc, 159, (byte)14);
MapUtil.QuickChangeBlockAt(loc, 159, (byte) 14);
else
MapUtil.QuickChangeBlockAt(loc, 159, (byte)3);
MapUtil.QuickChangeBlockAt(loc, 159, (byte) 3);
}
}
@ -134,7 +177,7 @@ public class TurfForts extends TeamGame
if (event.GetLog().GetKiller() == null)
return;
Player killed = (Player)event.GetEvent().getEntity();
Player killed = (Player) event.GetEvent().getEntity();
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
@ -159,9 +202,9 @@ public class TurfForts extends TeamGame
}
}
private void TurfMove(boolean red)
private void TurfMove(boolean red)
{
for (int line=0 ; line<GetLinesPerKill() ; line++)
for (int line = 0; line < GetLinesPerKill(); line++)
{
if (red)
{
@ -169,11 +212,11 @@ public class TurfForts extends TeamGame
for (Location loc : _turf)
if (loc.getBlockX() == _blue.getBlockX())
{
MapUtil.QuickChangeBlockAt(loc, 159, (byte)14);
MapUtil.QuickChangeBlockAt(loc, 159, (byte) 14);
for (int i=1 ; i<6 ; i++)
for (int i = 1; i < 6; i++)
if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte) 0);
}
@ -181,38 +224,38 @@ public class TurfForts extends TeamGame
for (Location loc : _turf)
if (loc.getBlockZ() == _blue.getBlockZ())
{
MapUtil.QuickChangeBlockAt(loc, 159, (byte)14);
MapUtil.QuickChangeBlockAt(loc, 159, (byte) 14);
for (int i=1 ; i<6 ; i++)
for (int i = 1; i < 6; i++)
if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte) 0);
}
_red.subtract(xRed, 0, zRed);
_blue.subtract(xRed, 0, zRed);
}
else
else
{
if (xRed != 0)
for (Location loc : _turf)
if (loc.getBlockX() == _red.getBlockX())
{
MapUtil.QuickChangeBlockAt(loc, 159, (byte)3);
MapUtil.QuickChangeBlockAt(loc, 159, (byte) 3);
for (int i=1 ; i<6 ; i++)
for (int i = 1; i < 6; i++)
if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte) 0);
}
if (zRed != 0)
for (Location loc : _turf)
if (loc.getBlockZ() == _red.getBlockZ())
{
MapUtil.QuickChangeBlockAt(loc, 159, (byte)3);
MapUtil.QuickChangeBlockAt(loc, 159, (byte) 3);
for (int i=1 ; i<6 ; i++)
for (int i = 1; i < 6; i++)
if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte) 0);
}
_red.add(xRed, 0, zRed);
@ -230,7 +273,7 @@ public class TurfForts extends TeamGame
{
UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot attack during Build Time!"));
event.getProjectile().remove();
}
}
}
@EventHandler
@ -240,13 +283,13 @@ public class TurfForts extends TeamGame
return;
GameTeam team = GetTeam(event.getPlayer());
if (team == null)
if (team == null)
{
event.setCancelled(true);
return;
}
//On Own
Block block = event.getBlock().getRelative(BlockFace.DOWN);
while (block.getTypeId() == 0)
@ -258,18 +301,18 @@ public class TurfForts extends TeamGame
event.setCancelled(true);
return;
}
//Height
boolean aboveTurf = false;
for (int i=1 ; i<=5 ; i++)
for (int i = 1; i <= 5; i++)
{
if (event.getBlock().getRelative(BlockFace.DOWN, i).getTypeId() != 159)
continue;
aboveTurf = true;
break;
}
if (!aboveTurf)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high above Turf."));
@ -290,12 +333,12 @@ public class TurfForts extends TeamGame
if (!(event.getEntity().getShooter() instanceof Player))
return;
Player shooter = (Player)event.getEntity().getShooter();
Player shooter = (Player) event.getEntity().getShooter();
final GameTeam team = GetTeam(shooter);
if (team == null)
return;
final Arrow arrow = (Arrow)event.getEntity();
final Arrow arrow = (Arrow) event.getEntity();
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
@ -303,7 +346,7 @@ public class TurfForts extends TeamGame
{
try
{
EntityArrow entityArrow = ((CraftArrow)arrow).getHandle();
EntityArrow entityArrow = ((CraftArrow) arrow).getHandle();
Field fieldX = EntityArrow.class.getDeclaredField("d");
Field fieldY = EntityArrow.class.getDeclaredField("e");
@ -330,6 +373,8 @@ public class TurfForts extends TeamGame
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.LAPIS_BLOCK.getId());
}
Bukkit.getPluginManager().callEvent(new ShredBlockEvent(block, arrow));
block.breakNaturally();
}
@ -338,7 +383,7 @@ public class TurfForts extends TeamGame
catch (Exception e)
{
e.printStackTrace();
}
}
}
}, 0);
}
@ -351,7 +396,7 @@ public class TurfForts extends TeamGame
event.SetCancelled("No Fall");
return;
}
if (!_fight && (event.GetCause() == DamageCause.PROJECTILE || event.GetCause() == DamageCause.ENTITY_ATTACK))
{
event.SetCancelled("Build Time");
@ -359,7 +404,7 @@ public class TurfForts extends TeamGame
}
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (damager == null) return;
if (event.GetCause() == DamageCause.PROJECTILE)
{
@ -369,7 +414,7 @@ public class TurfForts extends TeamGame
{
event.SetCancelled("Shredder");
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null,
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null,
DamageCause.CUSTOM, 9, true, true, false,
damager.getName(), "Barrage");
@ -396,7 +441,7 @@ public class TurfForts extends TeamGame
}
@EventHandler
public void ScoreboardTitle(UpdateEvent event)
public void ScoreboardTitle(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
@ -460,17 +505,17 @@ public class TurfForts extends TeamGame
return;
Scoreboard.Reset();
for (GameTeam team : this.GetTeamList())
{
{
int lines = 0;
if (team.GetColor() == ChatColor.RED) lines = GetRedLines();
else lines = GetBlueLines();
if (team.GetColor() == ChatColor.RED) lines = GetRedLines();
else lines = GetBlueLines();
Scoreboard.WriteBlank();
Scoreboard.Write(lines + " " + team.GetColor() + team.GetName());
}
if (!_fight)
{
long time = _buildTime - (System.currentTimeMillis() - _phaseTime);
@ -490,7 +535,7 @@ public class TurfForts extends TeamGame
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, time), 0));
}
Scoreboard.Draw();
Scoreboard.Draw();
}
public int GetRedLines()
@ -519,6 +564,14 @@ public class TurfForts extends TeamGame
return Math.abs(_blueBase.getBlockZ() - _blue.getBlockZ());
}
public int getLines(GameTeam team)
{
if (team.GetColor() == ChatColor.RED)
return GetRedLines();
else
return GetBlueLines();
}
public int GetLinesPerKill()
{
return _lines;
@ -541,13 +594,13 @@ public class TurfForts extends TeamGame
return;
for (GameTeam team : this.GetTeamList())
{
{
for (Player player : team.GetPlayers(true))
{
{
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
while (block.getTypeId() != 159 && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
if (block.getTypeId() == 0)
continue;
@ -556,10 +609,10 @@ public class TurfForts extends TeamGame
//Slow
if (_enemyTurf.containsKey(player))
{
int time = (int) ((System.currentTimeMillis() - _enemyTurf.get(player))/2500);
int time = (int) ((System.currentTimeMillis() - _enemyTurf.get(player)) / 2500);
if (time > 0)
Manager.GetCondition().Factory().Slow("Infiltrator Slow", player, player, 0.9, time-1, false, false, false, false);
Manager.GetCondition().Factory().Slow("Infiltrator Slow", player, player, 0.9, time - 1, false, false, false, false);
}
//On Enemy Turf
@ -590,7 +643,7 @@ public class TurfForts extends TeamGame
else if ((team.GetColor() == ChatColor.RED && data == 14) || (team.GetColor() == ChatColor.AQUA && data == 3))
{
_enemyTurf.remove(player);
}
}
}
}
}
@ -645,6 +698,11 @@ public class TurfForts extends TeamGame
}
//End
SetState(GameState.End);
SetState(GameState.End);
}
public Long getEnemyTurfEntranceTime(Player player)
{
return _enemyTurf.get(player);
}
}

View File

@ -3,18 +3,21 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
@ -25,34 +28,64 @@ 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 mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkSparkler extends Perk
{
public static class ThrowSparklerEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Item _sparkler;
public ThrowSparklerEvent(Player who, Item sparkler)
{
super(who);
_sparkler = sparkler;
}
public Item getSparkler()
{
return _sparkler;
}
}
private HashSet<Item> _items = new HashSet<Item>();
private int _spawnRate;
private int _max;
public PerkSparkler(int spawnRate, int max)
public PerkSparkler(int spawnRate, int max)
{
super("", new String[]
super("", new String[]
{
C.cGray + "Receive 1 Sparkler every " + spawnRate + " seconds. Maximum of " + max + ".",
C.cYellow + "Click" + C.cGray + " with Sparkler to " + C.cGreen + "Throw Sparkler"
C.cGray + "Receive 1 Sparkler every " + spawnRate + " seconds. Maximum of " + max + ".",
C.cYellow + "Click" + C.cGray + " with Sparkler to " + C.cGreen + "Throw Sparkler"
});
_spawnRate = spawnRate;
_max = max;
}
public void Apply(Player player)
public void Apply(Player player)
{
Recharge.Instance.use(player, GetName(), _spawnRate*1000, false, false);
Recharge.Instance.use(player, GetName(), _spawnRate * 1000, false, false);
}
@EventHandler
public void SparklerSpawn(UpdateEvent event)
{
@ -63,18 +96,18 @@ public class PerkSparkler extends Perk
{
if (!Kit.HasKit(cur))
continue;
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.EMERALD, (byte)0, _max))
if (UtilInv.contains(cur, Material.EMERALD, (byte) 0, _max))
continue;
//Add
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, F.item("Throwing Sparkler")));
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, F.item("Throwing Sparkler")));
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
}
@ -83,7 +116,7 @@ public class PerkSparkler extends Perk
@EventHandler
public void SparklerDrop(PlayerDropItemEvent event)
{
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.EMERALD, (byte)0))
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.EMERALD, (byte) 0))
return;
//Cancel
@ -95,11 +128,11 @@ public class PerkSparkler extends Perk
@EventHandler
public void SparklerDeathRemove(PlayerDeathEvent event)
{
{
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.EMERALD, (byte)0))
if (UtilInv.IsItem(item, Material.EMERALD, (byte) 0))
remove.add(item);
for (org.bukkit.inventory.ItemStack item : remove)
@ -109,71 +142,73 @@ public class PerkSparkler extends Perk
@EventHandler
public void SparklerInvClick(InventoryClickEvent event)
{
UtilInv.DisallowMovementOf(event, "Throwing Sparkler", Material.EMERALD, (byte)0, true);
UtilInv.DisallowMovementOf(event, "Throwing Sparkler", Material.EMERALD, (byte) 0, true);
}
@EventHandler
public void SparklerThrow(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
return;
Player player = event.getPlayer();
if (!UtilInv.IsItem(player.getItemInHand(), Material.EMERALD, (byte)0))
if (!UtilInv.IsItem(player.getItemInHand(), Material.EMERALD, (byte) 0))
return;
if (!Kit.HasKit(player))
return;
event.setCancelled(true);
UtilInv.remove(player, Material.EMERALD, (byte)0, 1);
UtilInv.remove(player, Material.EMERALD, (byte) 0, 1);
UtilInv.Update(player);
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),
ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, F.item("Throwing Sparkler")));
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),
ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, F.item("Throwing Sparkler")));
item.setPickupDelay(2000);
_items.add(item);
UtilAction.velocity(item, player.getLocation().getDirection(), 0.8, false, 0, 0.1, 10, false);
Bukkit.getPluginManager().callEvent(new ThrowSparklerEvent(player, item));
}
@EventHandler
public void Sparkle(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
Iterator<Item> itemIterator = _items.iterator();
while (itemIterator.hasNext())
{
Item item = itemIterator.next();
if (!item.isValid() || item.getTicksLived() > 100)
{
item.remove();
itemIterator.remove();
continue;
}
FireworkEffect effect = FireworkEffect.builder().withColor(Color.GREEN).with(Type.BURST).build();
try
try
{
Manager.GetFirework().playFirework(item.getLocation(), effect);
}
catch (Exception e)
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
public HashSet<Item> GetItems()
{
return _items;

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.stats;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
public class BadHiderStatTracker extends StatTracker<HideSeek>
{
private final Set<UUID> _disqualified = new HashSet<>();
public BadHiderStatTracker(HideSeek game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChangeForm(HideSeek.ChangeFormEvent event)
{
if (event.getForm() instanceof CreatureForm)
_disqualified.add(event.getPlayer().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event)
{
_disqualified.add(event.getEntity().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
for (Player player : getGame().getHiders().GetPlayers(true))
{
if (!_disqualified.contains(player.getUniqueId()))
getGame().AddStat(player, "BadHider", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,31 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
{
public BehindEnemyLinesStatTracker(TurfForts game)
{
super(game);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.SEC)
{
for (Player player : getGame().GetPlayers(true))
{
Long time = getGame().getEnemyTurfEntranceTime(player);
if (time != null && System.currentTimeMillis() - time >= 15000)
getGame().AddStat(player, "BehindEnemyLines", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,29 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.turfforts.kits.KitShredder;
public class BlockShreadStatTracker extends StatTracker<Game>
{
public BlockShreadStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onShredBlock(TurfForts.ShredBlockEvent event)
{
if (event.getArrow().getShooter() instanceof Player)
{
Player shooter = (Player) event.getArrow().getShooter();
if (getGame().GetKit(shooter) instanceof KitShredder)
getGame().AddStat(shooter, "TheShreddinator", 1, 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 mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker;
public class BloodThirstyStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _kills = new HashMap<>();
public BloodThirstyStatTracker(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 (getGame().GetKit(player) instanceof KitUndead)
{
Integer kills = _kills.get(killer.getUniqueId());
kills = (kills == null ? 0 : kills) + 1;
_kills.put(killer.getUniqueId(), kills);
if (kills >= 50)
getGame().AddStat(killer, "BloodThirsty", 1, true, false);
}
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.snake.Snake;
public class CannibalStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _kills = new HashMap<>();
public CannibalStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailCollision(Snake.TailCollisionEvent event)
{
Integer killCount = _kills.get(event.getKiller().getUniqueId());
killCount = (killCount == null ? 0 : killCount) + 1;
_kills.put(event.getKiller().getUniqueId(), killCount);
if (killCount >= 8)
getGame().AddStat(event.getKiller(), "Cannibal", 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.Game;
import nautilus.game.arcade.game.games.snake.Snake;
public class ChooChooStatTracker extends StatTracker<Game>
{
public ChooChooStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailGrow(Snake.TailGrowEvent event)
{
if (event.getLength() >= 60)
getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false);
}
}

View File

@ -0,0 +1,60 @@
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;
import nautilus.game.arcade.game.games.deathtag.kits.AbstractKitChaser;
public class ComeAtMeBroStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _count = new HashMap<>();
public ComeAtMeBroStatTracker(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 (getGame().GetKit(player) instanceof AbstractKitChaser)
{
Integer count = _count.get(killer.getUniqueId());
count = (count == null ? 0 : count) + 1;
_count.put(killer.getUniqueId(), count);
if (count >= 2)
getGame().AddStat(killer, "ComeAtMeBro", 1, true, false);
}
}
}

View File

@ -18,13 +18,15 @@ public class FastKillsStatTracker extends StatTracker<Game>
private final Map<UUID, Long> _lastKillTime = new HashMap<>();
private final int _requiredKillCount;
private final String _stat;
private final int _timeBetweenKills;
public FastKillsStatTracker(Game game, int requiredKillCount, int timeBetweenKills)
public FastKillsStatTracker(Game game, int requiredKillCount, int timeBetweenKills, String stat)
{
super(game);
_requiredKillCount = requiredKillCount;
_stat = stat;
_timeBetweenKills = timeBetweenKills * 1000;
}
@ -74,7 +76,7 @@ public class FastKillsStatTracker extends StatTracker<Game>
_lastKillTime.remove(player.getUniqueId());
if (killCount >= getRequiredKillCount())
getGame().AddStat(killer, "FastKills", 1, true, false);
getGame().AddStat(killer, getStat(), 1, true, false);
}
public int getRequiredKillCount()
@ -86,4 +88,9 @@ public class FastKillsStatTracker extends StatTracker<Game>
{
return _timeBetweenKills;
}
public String getStat()
{
return _stat;
}
}

View File

@ -0,0 +1,60 @@
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;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker;
public class HunterKillerStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _huntersKilled = new HashMap<>();
public HunterKillerStatTracker(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 (getGame().GetKit(player) instanceof KitSeeker)
{
Integer huntersKilled = _huntersKilled.get(killer.getUniqueId());
huntersKilled = (huntersKilled == null ? 0 : huntersKilled) + 1;
_huntersKilled.put(killer.getUniqueId(), huntersKilled);
if (huntersKilled >= 10)
getGame().AddStat(killer, "HunterKiller", 1, true, 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 mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.hideseek.kits.KitHider;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker;
public class HunterOfTheYearStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _hidersKilled = new HashMap<>();
public HunterOfTheYearStatTracker(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 (getGame().GetKit(player) instanceof KitHider)
{
Integer hidersKilled = _hidersKilled.get(killer.getUniqueId());
hidersKilled = (hidersKilled == null ? 0 : hidersKilled) + 1;
_hidersKilled.put(killer.getUniqueId(), hidersKilled);
if (hidersKilled >= 7)
getGame().AddStat(killer, "HiderOfTheYear", 1, true, false);
}
}
}

View File

@ -11,15 +11,17 @@ import java.util.*;
public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
{
private final int _killCount;
private final String _stat;
private final int _timeLimit;
private final Map<UUID, Integer> _kills = new HashMap<>();
public KillsWithinTimeLimitStatTracker(Game game, int killCount, int timeLimit)
public KillsWithinTimeLimitStatTracker(Game game, int killCount, int timeLimit, String stat)
{
super(game);
_killCount = killCount;
_stat = stat;
_timeLimit = timeLimit * 1000;
}
@ -53,6 +55,11 @@ public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
_kills.put(player.getUniqueId(), killCount);
if (killCount == getKillCount() && System.currentTimeMillis() - getGame().GetStateTime() < getTimeLimit())
getGame().AddStat(player, "Bloodlust", 1, true, false);
getGame().AddStat(player, getStat(), 1, true, false);
}
public String getStat()
{
return _stat;
}
}

View File

@ -0,0 +1,51 @@
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 nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
public class KingDamageStatTracker extends StatTracker<CastleSiege>
{
private final Map<UUID, Double> _kingDamage = new HashMap<>();
private double _totalKingDamage = 0;
public KingDamageStatTracker(CastleSiege game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onKingDamage(CastleSiege.KingDamageEvent event)
{
_totalKingDamage += event.getDamage();
Double damage = _kingDamage.get(event.getPlayer().getUniqueId());
damage = (damage == null ? 0 : damage) + event.getDamage();
_kingDamage.put(event.getPlayer().getUniqueId(), damage);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
for (Player player : getGame().GetPlayers(false))
{
Double damage = _kingDamage.get(player.getUniqueId());
if (damage != null && damage >= 0.5 * _totalKingDamage)
getGame().AddStat(player, "Assassin", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,20 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
public class KingSlayerStatTracker extends StatTracker<Game>
{
public KingSlayerStatTracker(Game game)
{
super(game);
}
@EventHandler
public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event)
{
getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false);
}
}

View File

@ -0,0 +1,60 @@
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.TeamGame;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead;
public class LastStandStatTracker extends StatTracker<TeamGame>
{
private final Map<UUID, Integer> _kills = new HashMap<>();
public LastStandStatTracker(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 player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
if (getGame().GetTeam(killer).GetPlayers(true).size() == 1)
{
Integer kills = _kills.get(killer.getUniqueId());
kills = (kills == null ? 0 : kills) + 1;
_kills.put(killer.getUniqueId(), kills);
if (kills >= 3)
getGame().AddStat(killer, "LastStand", 1, true, false);
}
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.paintball.Paintball;
public class MedicStatTracker extends StatTracker<Game>
{
public MedicStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(Paintball.ReviveEvent event)
{
getGame().AddStat(event.getPlayer(), "Medic", 1, false, false);
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
public class MeowStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _meowCount = new HashMap<>();
public MeowStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onMeow(HideSeek.MeowEvent event)
{
Integer meows = _meowCount.get(event.getPlayer().getUniqueId());
meows = (meows == null ? 0 : meows) + 1;
_meowCount.put(event.getPlayer().getUniqueId(), meows);
if (meows >= 50)
getGame().AddStat(event.getPlayer(), "Meow", 1, true, false);
}
}

View File

@ -0,0 +1,46 @@
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 nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
public class ParalympicsStatTracker extends StatTracker<Game>
{
private final Set<UUID> _hasLeaped = new HashSet<>();
public ParalympicsStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onePerkLeap(PerkLeapEvent event)
{
_hasLeaped.add(event.GetPlayer().getUniqueId());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> winners = getGame().getWinners();
for (Player winner : winners)
{
if (!_hasLeaped.contains(winner.getUniqueId()))
getGame().AddStat(winner, "Paralympics", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,70 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
public class SharpShooterStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _arrowsShot = new HashMap<>();
private final Map<UUID, Integer> _arrowsHit = new HashMap<>();
public SharpShooterStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onProjectileLaunch(ProjectileLaunchEvent event)
{
if (event.getEntity().getShooter() instanceof Player)
{
Player player = (Player) event.getEntity();
Integer count = _arrowsShot.get(player.getUniqueId());
count = (count == null ? 0 : count) + 1;
_arrowsShot.put(player.getUniqueId(), count);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onArrowHit(CustomDamageEvent event)
{
if (event.GetProjectile() instanceof Arrow && event.GetDamageePlayer() != null)
{
if (event.GetProjectile().getShooter() instanceof Player && event.GetProjectile().getShooter() != event.GetDamageePlayer())
{
Player player = (Player) event.GetProjectile().getShooter();
Integer count = _arrowsHit.get(player.getUniqueId());
count = (count == null ? 0 : count) + 1;
_arrowsHit.put(player.getUniqueId(), count);
if (count == 8)
{
Integer arrowsShot = _arrowsShot.get(player.getUniqueId());
if (arrowsShot != null && arrowsShot == 8)
getGame().AddStat(player, "Sharpshooter", 1, true, false);
}
}
}
}
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
{
_arrowsShot.remove(event.getEntity().getUniqueId());
_arrowsHit.remove(event.getEntity().getUniqueId());
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.sheep.SheepGame;
public class SheepDropStatTracker extends StatTracker<Game>
{
public SheepDropStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSheepStolen(SheepGame.DropEnemySheepEvent event)
{
getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false);
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.sheep.SheepGame;
public class SheepThiefStatTracker extends StatTracker<Game>
{
public SheepThiefStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSheepStolen(SheepGame.SheepStolenEvent event)
{
getGame().AddStat(event.getPlayer(), "Thief", 1, false, false);
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.snake.Snake;
public class SlimySheepStatTracker extends StatTracker<Game>
{
private final Map<UUID, Integer> _count = new HashMap<>();
public SlimySheepStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailCollision(Snake.SlimeUpgradeEvent event)
{
Integer count = _count.get(event.getPlayer().getUniqueId());
count = (count == null ? 0 : count) + 1;
_count.put(event.getPlayer().getUniqueId(), count);
if (count >= 20)
getGame().AddStat(event.getPlayer(), "SlimySheep", 1, true, false);
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.perks.PerkSparkler;
public class SparklezStatTracker extends StatTracker<Game>
{
public SparklezStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onThrowSparkler(PerkSparkler.ThrowSparklerEvent event)
{
getGame().AddStat(event.getPlayer(), "Sparklez", 1, false, false);
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.spleef.SpleefDestroyBlockEvent;
public class SpleefBlockDestroyStatTracker extends StatTracker<Game>
{
public SpleefBlockDestroyStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onThrowSparkler(SpleefDestroyBlockEvent event)
{
getGame().AddStat(event.getPlayer(), "SpleefBlocks", 1, false, false);
}
}

View File

@ -0,0 +1,54 @@
package nautilus.game.arcade.stats;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
public class TheComebackStatTracker extends StatTracker<TurfForts>
{
private final Set<GameTeam> _hasWentFiveOrBelow = new HashSet<>();
public TheComebackStatTracker(TurfForts game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
if (getGame().GetState() == Game.GameState.Live)
{
for (GameTeam team : getGame().GetTeamList())
{
if (getGame().getLines(team) <= 5)
_hasWentFiveOrBelow.add(team);
}
}
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
if (_hasWentFiveOrBelow.contains(getGame().WinnerTeam))
{
for (Player player : getGame().getWinners())
getGame().AddStat(player, "TheComeback", 1, true, false);
}
}
}
}

View File

@ -0,0 +1,49 @@
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.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
public class WinAsTeamStatTracker extends StatTracker<TeamGame>
{
private final GameTeam _team;
private final String _stat;
public WinAsTeamStatTracker(TeamGame game, GameTeam team, String stat)
{
super(game);
_team = team;
_stat = stat;
}
public GameTeam getTeam()
{
return _team;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
if (getGame().WinnerTeam == getTeam())
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, _stat, 1, false, false);
}
}
}
}
}

View File

@ -0,0 +1,50 @@
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;
public class WinFastStatTracker extends StatTracker<Game>
{
private final int _seconds;
private final String _stat;
private long _gameStartTime;
public WinFastStatTracker(Game game, int seconds, String stat)
{
super(game);
_seconds = seconds;
_stat = stat;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.Live)
_gameStartTime = System.currentTimeMillis();
else if (event.GetState() == Game.GameState.End)
{
if (System.currentTimeMillis() - _gameStartTime < _seconds * 1000)
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, getStat(), 1, true, false);
}
}
}
}
public String getStat()
{
return _stat;
}
}

View File

@ -0,0 +1,33 @@
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;
public class WinMapStatTracker extends StatTracker<Game>
{
public WinMapStatTracker(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, "Win." + getGame().WorldData.MapName, 1, true, 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.game.games.sheep.SheepGame;
public class WinWithSheepStatTracker extends StatTracker<SheepGame>
{
public WinWithSheepStatTracker(SheepGame game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
if (getGame().getSheepCount(getGame().WinnerTeam) > 12)
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
getGame().AddStat(winner, "Selfish", 1, true, false);
}
}
}
}
}

View File

@ -17,10 +17,12 @@ import nautilus.game.arcade.game.Game;
public class WinWithoutDyingStatTracker extends StatTracker<Game>
{
private final Set<UUID> _hasDied = new HashSet<>();
private final String _stat;
public WinWithoutDyingStatTracker(Game game)
public WinWithoutDyingStatTracker(Game game, String stat)
{
super(game);
_stat = stat;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -51,9 +53,14 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
for (Player winner : winners)
{
if (!_hasDied.contains(winner.getUniqueId()))
getGame().AddStat(winner, "MLGPro", 1, true, false);
getGame().AddStat(winner, getStat(), 1, true, false);
}
}
}
}
public String getStat()
{
return _stat;
}
}

View File

@ -7,9 +7,12 @@ import org.bukkit.event.*;
public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
{
public WinWithoutLosingTeammateStatTracker(TeamGame game)
private final String _stat;
public WinWithoutLosingTeammateStatTracker(TeamGame game, String stat)
{
super(game);
_stat = stat;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -22,8 +25,13 @@ public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
if (winner.GetPlayers(true).size() == winner.GetPlayers(false).size())
{
for (Player player : winner.GetPlayers(true))
getGame().AddStat(player, "FlawlessVictory", 1, true, false);
getGame().AddStat(player, getStat(), 1, true, false);
}
}
}
public String getStat()
{
return _stat;
}
}