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

This commit is contained in:
Chiss 2014-08-24 16:46:00 +10:00
commit 23f6d0ae1a
9 changed files with 205 additions and 34 deletions

View File

@ -22,36 +22,6 @@ import org.bukkit.event.player.*;
public class Longshot extends Skill
{
public static class LongshotHitEvent extends ProjectileHitEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final double _length;
public LongshotHitEvent(Projectile projectile, double length)
{
super(projectile);
_length = length;
}
public double getLength()
{
return _length;
}
}
private HashMap<Entity, Location> _arrows = new HashMap<Entity, Location>();
public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
@ -109,8 +79,6 @@ public class Longshot extends Skill
double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3);
event.AddMod(damager.getName(), GetName(), damage, damage > 0);
Bukkit.getPluginManager().callEvent(new LongshotHitEvent(projectile, length));
}
@EventHandler

View File

@ -65,6 +65,7 @@ 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.FoodForTheMassesStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
public class Bridge extends TeamGame implements OreObsfucation
@ -182,6 +183,7 @@ public class Bridge extends TeamGame implements OreObsfucation
_tournament = Manager.IsTournamentServer();
registerStatTrackers(
new FoodForTheMassesStatTracker(this),
new BridgesSniperStatTracker(this),
new TntMinerStatTracker(this),
new FastKillsStatTracker(this, 4, 10, "Rampage"),

View File

@ -68,7 +68,9 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.BloodThirstyStatTracker;
import nautilus.game.arcade.stats.KingDamageStatTracker;
import nautilus.game.arcade.stats.KingSlayerStatTracker;
import nautilus.game.arcade.stats.WinAsTeamStatTracker;
public class CastleSiege extends TeamGame
{
@ -190,10 +192,21 @@ public class CastleSiege extends TeamGame
_kingName = C.cYellow + C.Bold + "King Sparklez";
GameTeam notRedTeam = null;
for (GameTeam team : GetTeamList())
{
if (team.GetColor() != ChatColor.RED)
{
notRedTeam = team;
break;
}
}
registerStatTrackers(
new WinAsTeamStatTracker(this, notRedTeam, "ForTheKing"),
new KingSlayerStatTracker(this),
new BloodThirstyStatTracker(this),
new AssistsStatTracker(this)
new KingDamageStatTracker(this)
);
}

View File

@ -13,8 +13,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.Domination;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.BackstabKillStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -55,7 +57,9 @@ public class ChampionsDominate extends Domination
EloStart = 1000;
registerStatTrackers(
new BackstabKillStatTracker(this),
new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
}

View File

@ -17,9 +17,11 @@ 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.BackstabKillStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class ChampionsTDM extends TeamDeathmatch
@ -48,14 +50,16 @@ public class ChampionsTDM extends TeamDeathmatch
"Gold/Iron Weapons deal 6 damage",
"Diamond Weapons deal 7 damage",
};
};
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this),
new BackstabKillStatTracker(this),
new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
}

View File

@ -81,6 +81,7 @@ 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.HunterOfTheYearStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_7_R4.EntityCreature;
@ -213,6 +214,7 @@ public class HideSeek extends TeamGame
new HunterKillerStatTracker(this),
new MeowStatTracker(this),
new HunterKillerStatTracker(this),
new HunterOfTheYearStatTracker(this),
new BadHiderStatTracker(this)
);
}

View File

@ -0,0 +1,75 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
public class BackstabKillStatTracker extends StatTracker<Game>
{
private final Map<UUID, Set<UUID>> _hasDamaged = new HashMap<>();
public BackstabKillStatTracker(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 (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Backstab"))
{
Set<UUID> hasDamaged = _hasDamaged.get(player.getUniqueId());
if (hasDamaged == null || !hasDamaged.contains(killer.getUniqueId()))
getGame().AddStat(killer, "Assassination", 1, false, false);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event)
{
if (event.GetDamageePlayer() != null && event.GetDamagerPlayer(true) != null)
{
Set<UUID> hasDamaged = _hasDamaged.get(event.GetDamagerPlayer(true).getUniqueId());
if (hasDamaged == null)
{
hasDamaged = new HashSet<>();
_hasDamaged.put(event.GetDamagerPlayer(true).getUniqueId(), hasDamaged);
}
hasDamaged.add(event.GetDamageePlayer().getUniqueId());
}
}
}

View File

@ -0,0 +1,44 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class FoodForTheMassesStatTracker extends StatTracker<Game>
{
public FoodForTheMassesStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeathEvent(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 (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Apple Thrower"))
getGame().AddStat(killer, "FoodForTheMasses", 1, false, false);
}
}

View File

@ -0,0 +1,59 @@
package nautilus.game.arcade.stats;
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.EntityDamageByEntityEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class TheLongestShotStatTracker extends StatTracker<Game>
{
public TheLongestShotStatTracker(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 (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("longshot"))
{
if (player.getLastDamageCause() instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause();
if (edbee.getDamager() instanceof Arrow)
{
Arrow arrow = (Arrow) edbee.getDamager();
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64)
getGame().AddStat(killer, "TheLongestShot", 1, false, false);
}
}
}
}
}