Merge branch 'Myst_LOBBERS' of ssh://184.154.0.242:7999/min/mineplex into Myst_LOBBERS

This commit is contained in:
Mini-Chiss 2015-07-26 18:31:11 +02:00
commit e0b1567e54
7 changed files with 84 additions and 100 deletions

View File

@ -644,38 +644,30 @@ public enum Achievement
new int[]{2000},
AchievementCategory.BOMB_LOBBERS),
// BOMB_LOBBERS_REKT_X3("Rekt x3", 800,
// new String[]{"Bomb Lobbers.3Kill"},
// new String[]{"Kill 3 players with one explosion"},
// new int[]{1},
// AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_ULTIMATE_KILLER("Ultimate Killer", 800,
new String[]{"Bomb Lobbers.Killer"},
new String[]{"Kill 6 players in a single game"},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_EXPLOSION_PROOF("Jelly Skin", 1000,
BOMB_LOBBERS_EXPLOSION_PROOF("Jelly Skin", 1200,
new String[]{"Bomb Lobbers.JellySkin"},
new String[]{"Win a game without taking any damage."},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_BEST_TEAM("The Best Team", 800,
new String[]{"Bomb Lobbers.BestTeam"},
new String[]{"Win a game without losing a teammate"},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_BLAST_PROOF("Blast Proof", 800,
new String[]{"Bomb Lobbers.BlastProof"},
new String[]{"Win 20 games using Armorer"},
new int[]{20},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_SNIPER("Sniper", 10000,
new String[]{"Bomb Lobbers.Direct Hit"},
new String[]{"Get 50 direct hits"},
new int[]{50},
AchievementCategory.BOMB_LOBBERS)
// BOMB_LOBBERS_
;
private String _name;

View File

@ -33,12 +33,12 @@ import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
import nautilus.game.arcade.game.games.lobbers.kits.KitPitcher;
import nautilus.game.arcade.game.games.lobbers.kits.KitJumper;
import nautilus.game.arcade.game.games.lobbers.kits.KitPitcher;
import nautilus.game.arcade.game.games.lobbers.kits.KitWaller;
import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBlastProof;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerDirectHit;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown;
import nautilus.game.arcade.kit.Kit;
@ -79,7 +79,6 @@ public class BombLobbers extends TeamGame implements IThrown
new KitJumper(manager),
new KitArmorer(manager),
new KitPitcher(manager),
// new KitMortar(manager), << Spare time kit for Bobbeh
new KitWaller(manager)
}, new String[]
{
@ -109,7 +108,21 @@ public class BombLobbers extends TeamGame implements IThrown
HungerSet = 20;
registerStatTrackers(new Tracker6Kill(this), new TrackerBestTeam(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this));
WorldTimeSet = 6000;
registerStatTrackers(new Tracker6Kill(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this), new TrackerDirectHit(this));
}
@EventHandler
public void setTime(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
if (WorldData.MapName.equalsIgnoreCase("Intergalactic"))
{
WorldTimeSet = 18000;
}
}
public void addKill(Player player)
@ -295,6 +308,8 @@ public class BombLobbers extends TeamGame implements IThrown
if (!IsLive())
return;
NautHashMap<TNTPrimed, BombToken> toAdd = new NautHashMap<TNTPrimed, BombToken>();
Iterator<Entry<TNTPrimed, BombToken>> iterator = _tnt.entrySet().iterator();
while (iterator.hasNext())
{
@ -330,10 +345,16 @@ public class BombLobbers extends TeamGame implements IThrown
tnt.getKey().remove();
iterator.remove();
_tnt.put(newTNT, token);
toAdd.put(newTNT, token);
}
}
}
//Prevent concurrent modification thigns
for (Entry<TNTPrimed, BombToken> entry : toAdd.entrySet())
{
_tnt.put(entry.getKey(), entry.getValue());
}
}
@EventHandler
@ -443,13 +464,13 @@ public class BombLobbers extends TeamGame implements IThrown
if (team.GetColor() == ChatColor.AQUA)
{
for (int i = 0 ; i < 5 ; i++)
for (int i = 0 ; i < 2 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0,
ViewDist.NORMAL, UtilServer.getPlayers());
}
else
{
for (int i = 0 ; i < 5 ; i++)
for (int i = 0 ; i < 2 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
}

View File

@ -12,7 +12,6 @@ import org.bukkit.event.EventHandler;
public class Tracker6Kill extends StatTracker<Game>
{
public Tracker6Kill(Game game)
{
super(game);

View File

@ -1,51 +0,0 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import mineplex.core.common.util.NautHashMap;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class TrackerBestTeam extends StatTracker<Game>
{
private NautHashMap<GameTeam, Integer> _teams = new NautHashMap<GameTeam, Integer>();
public TrackerBestTeam(Game game)
{
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (GameTeam team : getGame().GetTeamList())
{
_teams.put(team, team.GetPlayers(true).size());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (GameTeam team : getGame().GetTeamList())
{
if (_teams.get(team) == team.GetPlayers(true).size())
{
for (Player player : team.GetPlayers(true))
{
addStat(player, "BestTeam", 1, true, false);
}
}
}
}
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class TrackerDirectHit extends StatTracker<Game>
{
public TrackerDirectHit(Game game)
{
super(game);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onKillDirectHit(CustomDamageEvent event)
{
if (!getGame().IsLive())
return;
if (event.GetDamagerPlayer(true) == null)
return;
Player damager = event.GetDamagerPlayer(true);
if (!getGame().IsAlive(damager))
return;
if (event.GetReason() == null)
return;
if (event.GetReason().toLowerCase().contains("direct hit"))
addStat(damager, "Direct Hit", 1, false, false);
}
}

View File

@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.lobbers.trackers;
import java.util.HashSet;
import java.util.Set;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
@ -16,36 +15,25 @@ import org.bukkit.event.EventPriority;
public class TrackerNoDamage extends StatTracker<Game>
{
private Set<String> _noDamage = new HashSet<String>();
private Set<String> _damaged = new HashSet<String>();
public TrackerNoDamage(Game game)
{
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (Player player : getGame().GetPlayers(true))
{
_noDamage.add(player.getName());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (String name : _noDamage)
{
Player player = UtilPlayer.searchExact(name);
if (event.GetGame().getWinners() == null)
return;
if (player == null || !player.isOnline())
for (Player player : event.GetGame().getWinners())
{
if (_damaged.contains(player.getName()))
continue;
addStat(player, "JellySkin", 1, true, false);
@ -61,9 +49,7 @@ public class TrackerNoDamage extends StatTracker<Game>
if (event.GetDamageePlayer() == null || !event.GetDamageePlayer().isOnline())
return;
if (_noDamage.contains(event.GetDamageePlayer().getName()))
{
_noDamage.remove(event.GetDamageePlayer().getName());
}
if (!_damaged.contains(event.GetDamageePlayer().getName()))
_damaged.add(event.GetDamageePlayer().getName());
}
}

View File

@ -22,5 +22,4 @@ public class TrackerTNTThrown extends StatTracker<Game>
addStat(event.getPlayer(), "Thrown", 1, false, false);
}
}