Add missing tracker classes

This commit is contained in:
Thanos Paravantis 2016-04-25 23:01:41 +03:00
parent d945bfa17a
commit 38769d9616
6 changed files with 209 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package nautilus.game.arcade.game.games.mineware.tracker;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBouncingBlock;
public class BouncingShadowTracker extends ChallengeStatTracker
{
public BouncingShadowTracker(Game game)
{
super(game);
}
@Override
protected void track(Challenge challenge)
{
if (challenge instanceof ChallengeBouncingBlock)
{
ChallengeBouncingBlock bouncingBlock = (ChallengeBouncingBlock) challenge;
for (Player player : getGame().GetPlayers(true))
{
if (!bouncingBlock.hasSteppedOnWool(player) && bouncingBlock.getData().isDone(player))
{
System.out.println("Bouncing Shadow: " + player.getName());
addStat(player, "BouncingShadow", 1, true, false);
}
}
}
}
}

View File

@ -0,0 +1,29 @@
package nautilus.game.arcade.game.games.mineware.tracker;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
import nautilus.game.arcade.stats.StatTracker;
public abstract class ChallengeStatTracker extends StatTracker<Game>
{
public ChallengeStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChallengeEnd(ChallengeEndEvent event)
{
if (getGame().GetState() != GameState.Live)
return;
track(event.getEndedChallenge());
}
protected abstract void track(Challenge challenge);
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.mineware.tracker;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeEggSmash;
public class DragonKingTracker extends ChallengeStatTracker
{
public DragonKingTracker(Game game)
{
super(game);
}
@Override
protected void track(Challenge challenge)
{
if (challenge instanceof ChallengeEggSmash)
{
ChallengeEggSmash eggSmash = (ChallengeEggSmash) challenge;
for (Player player : getGame().GetPlayers(true))
{
if (eggSmash.hasData(player))
{
int score = (int) eggSmash.getData(player);
if (score > 0)
{
System.out.println("Dragon King: " + player.getName());
addStat(player, "DragonKing", score, false, false);
}
}
}
}
}
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.mineware.tracker;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeMiniOneInTheQuiver;
public class EliteArcherTracker extends ChallengeStatTracker
{
public EliteArcherTracker(Game game)
{
super(game);
}
@Override
protected void track(Challenge challenge)
{
if (challenge instanceof ChallengeMiniOneInTheQuiver)
{
ChallengeMiniOneInTheQuiver miniOITQ = (ChallengeMiniOneInTheQuiver) challenge;
for (Player player : getGame().GetPlayers(true))
{
if (miniOITQ.hasData(player))
{
int score = (int) miniOITQ.getData(player);
if (score > 0)
{
System.out.println("Elite Archer: " + player.getName());
addStat(player, "EliteArcher", score, false, false);
}
}
}
}
}
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.mineware.tracker;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFallingBlocks;
public class PixelNinjaTracker extends ChallengeStatTracker
{
public PixelNinjaTracker(Game game)
{
super(game);
}
@Override
protected void track(Challenge challenge)
{
if (challenge instanceof ChallengeFallingBlocks)
{
ChallengeFallingBlocks fallingBlocks = (ChallengeFallingBlocks) challenge;
for (Player player : getGame().GetPlayers(true))
{
if (fallingBlocks.hasData(player))
{
int score = (int) fallingBlocks.getData(player);
if (score > 0)
{
System.out.println("Pixel Ninja: " + player.getName());
addStat(player, "PixelNinja", score, false, false);
}
}
}
}
}
}

View File

@ -0,0 +1,33 @@
package nautilus.game.arcade.game.games.mineware.tracker;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKingOfTheLadder;
public class QuickClimberTracker extends ChallengeStatTracker
{
public QuickClimberTracker(Game game)
{
super(game);
}
@Override
protected void track(Challenge challenge)
{
if (challenge instanceof ChallengeKingOfTheLadder)
{
ChallengeKingOfTheLadder kotl = (ChallengeKingOfTheLadder) challenge;
for (Player player : getGame().GetPlayers(true))
{
if (!kotl.hasBeenHit(player) && kotl.getData().isDone(player))
{
System.out.println("Quick Climber: " + player.getName());
addStat(player, "QuickClimber", 1, true, false);
}
}
}
}
}