More achievements

This commit is contained in:
CoderTim 2014-08-20 19:20:11 -04:00
parent 60869d114e
commit f266f4e016
38 changed files with 1075 additions and 161 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

@ -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;
@ -24,17 +23,18 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.LivingEntity;
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 +57,77 @@ 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;
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 +142,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.",
};
@ -140,7 +193,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 +232,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 +366,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 +417,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 +447,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 +474,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 +482,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 +493,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 +544,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 +622,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 +640,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 +660,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 +675,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 +689,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 +704,21 @@ public class CastleSiege extends TeamGame
int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d));
//Damage Event
Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(),
Manager.GetDamage().NewDamageEvent(player, 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 +730,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 +748,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 +779,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 +789,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 +845,7 @@ public class CastleSiege extends TeamGame
}
@EventHandler
public void DayTimer(UpdateEvent event)
public void DayTimer(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
@ -796,11 +853,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 +869,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

@ -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;
@ -82,6 +85,57 @@ 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;
@ -283,7 +337,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 +374,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 +408,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 +440,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 +814,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 +1151,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;
@ -56,6 +59,36 @@ import nautilus.game.arcade.kit.Kit;
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>();
@ -351,6 +384,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

@ -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;
@ -52,6 +55,57 @@ import nautilus.game.arcade.kit.Kit;
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>>();
@ -428,6 +482,8 @@ public class SheepGame extends TeamGame
if (player == null) return;
DropSheep(player);
Bukkit.getPluginManager().callEvent(new DropEnemySheepEvent(event.GetDamagerPlayer(true), player));
}
@EventHandler
@ -614,4 +670,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

@ -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,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,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

@ -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,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,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,43 @@
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 long _gameStartTime;
public WinFastStatTracker(Game game, int seconds)
{
super(game);
_seconds = seconds;
}
@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, "Speedrunner", 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);
}
}
}
}
}