Update statistics and implement data tracker
This commit is contained in:
parent
e2a6500bce
commit
856eb6059b
@ -716,13 +716,13 @@ public enum Achievement
|
||||
|
||||
//Bawk Bawk Battles
|
||||
BAWK_BAWK_BATTLES_VETERAN("Bawk Bawk Battles Veteran", 1500,
|
||||
new String[]{"BawkBawkBattles.Veteran"},
|
||||
new String[]{"Bawk Bawk Battles.Veteran"},
|
||||
new String[]{"Win 50 games of Bawk Bawk Battles"},
|
||||
new int[] {50},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_LAURA_CRAFT("Laura Craft", 800,
|
||||
new String[]{"BawkBawkBattles.LauraCraft"},
|
||||
new String[]{"Bawk Bawk Battles.LauraCraft"},
|
||||
new String[]{
|
||||
C.cGray + "Maze Runner Challenge",
|
||||
"Finish 3 times in a row, in under 8 seconds"
|
||||
@ -731,16 +731,16 @@ public enum Achievement
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_PINATA_MASTER("Pinata Master", 800,
|
||||
new String[]{"BawkBawkBattles.PinataMaster"},
|
||||
new String[]{"Bawk Bawk Battles.PinataMaster"},
|
||||
new String[]{
|
||||
C.cGray + "Chicken Shooting Challenge",
|
||||
"Hit 6 chickens without missing one"
|
||||
"Hit 6 chickens in a row"
|
||||
},
|
||||
new int[] {1},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_MILK_MAN("Professional Milk Man", 700,
|
||||
new String[]{"BawkBawkBattles.MilkMan"},
|
||||
new String[]{"Bawk Bawk Battles.MilkMan"},
|
||||
new String[]{
|
||||
C.cGray + "Milk a Cow Challenge",
|
||||
"Deliver 100 buckets of milk to the farmer"
|
||||
@ -749,7 +749,7 @@ public enum Achievement
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_TAG_MASTER("Tag Master", 700,
|
||||
new String[]{"BawkBawkBattles.TagMaster"},
|
||||
new String[]{"Bawk Bawk Battles.TagMaster"},
|
||||
new String[]{
|
||||
C.cGray + "Reverse Tag Challenge",
|
||||
"Win an entire round without being untagged"
|
||||
@ -758,7 +758,7 @@ public enum Achievement
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_SURF_UP("Surf Up", 850,
|
||||
new String[]{"BawkBawkBattles.SurfUp"},
|
||||
new String[]{"Bawk Bawk Battles.SurfUp"},
|
||||
new String[]{
|
||||
C.cGray + "Wave Crush Challenge",
|
||||
"Avoid 250 waves"
|
||||
@ -767,10 +767,10 @@ public enum Achievement
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_KANGAROO_AT_HEART("Kangaroo at Heart", 900,
|
||||
new String[]{"BawkBawkBattles.Kangaroo"},
|
||||
new String[]{"Bawk Bawk Battles.Kangaroo"},
|
||||
new String[]{
|
||||
C.cGray + "Kangaroo Jump Challenge",
|
||||
"Complete the challenge 15 times in a row without falling"
|
||||
"Complete this challenge by jumping higher than others"
|
||||
},
|
||||
new int[] {15},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
@ -82,6 +82,7 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeArrowRam
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBlockLobbers;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBouncingBlock;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBuildRace;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeChickenShooting;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeCloudFall;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeColorChange;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDeadlyTnt;
|
||||
@ -105,7 +106,6 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengePunchThe
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeRedLightGreenLight;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeReverseTag;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeRushPush;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeChickenShooting;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeSmashOff;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeTreasureDigger;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeVolleyPig;
|
||||
@ -171,7 +171,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
*
|
||||
* Medium Priority
|
||||
* - Make spawn distance equal from a target
|
||||
* - Fix out of bounds exception on stats menu
|
||||
*
|
||||
* Low Priority
|
||||
* - Spawn more chickens on Chicken Shooting
|
||||
@ -197,7 +196,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
"Last player with lives wins!"
|
||||
});
|
||||
|
||||
_settings.setMaxLives(5);
|
||||
_settings.setMaxLives(1);
|
||||
|
||||
// Damage = false;
|
||||
DamagePvP = false;
|
||||
@ -231,8 +230,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
new StatTrackerPinataMasterTracker(this),
|
||||
new StatTrackerSurfUpTracker(this),
|
||||
new StatTrackerTagMasterTracker(this),
|
||||
new StatTrackerVeteranTracker(this)
|
||||
);
|
||||
new StatTrackerVeteranTracker(this));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -519,7 +517,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
_challenge.getData().setSpawns(selected);
|
||||
_playersTeam.SetSpawns(selected);
|
||||
System.out.println("Setup: " + (selected.size()));
|
||||
SpectatorSpawn = UtilWorld.averageLocation(selected).add(0, 7, 0);
|
||||
|
||||
return selected;
|
||||
@ -552,6 +549,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
if (!block.isEmpty() && _challenge.getData().isModifiedBlock(block))
|
||||
{
|
||||
System.out.println("Removing solid block");
|
||||
block.setType(Material.AIR);
|
||||
block.setData((byte) 0);
|
||||
_challenge.getData().removeModifiedBlock(block);
|
||||
@ -620,7 +618,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
_delay = System.currentTimeMillis();
|
||||
|
||||
resetPlayersOnChallengeEnding();
|
||||
killRemainingPlayers();
|
||||
|
||||
Manager.getPluginManager().callEvent(new ChallengeEndEvent(_challenge));
|
||||
HandlerList.unregisterAll(_challenge);
|
||||
@ -635,7 +633,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
EndCheck();
|
||||
}
|
||||
|
||||
private void resetPlayersOnChallengeEnding()
|
||||
private void killRemainingPlayers()
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
@ -654,10 +652,15 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
}
|
||||
|
||||
if (_challenge.getData().isCompleted(player))
|
||||
{
|
||||
AddGems(player, 3, "Completed Challenge", true, true);
|
||||
}
|
||||
addChallengeGemReward(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void addChallengeGemReward(Player player)
|
||||
{
|
||||
if (_challenge.getData().isCompleted(player))
|
||||
{
|
||||
AddGems(player, 3, "Completed Challenge", true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -955,7 +958,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
_challenge.getData().addLostPlayer(player);
|
||||
handleDeath(player);
|
||||
|
||||
EndCheck();
|
||||
// EndCheck();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1366,6 +1369,15 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
_challenge.markSpawnLocations();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGamePrepareCountdownCommence(GamePrepareCountdownCommence event)
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
removeSolidBlock(player.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameLive(GameStateChangeEvent event)
|
||||
{
|
||||
@ -1392,7 +1404,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
UtilTextMiddle.display(null, null, player);
|
||||
}
|
||||
|
||||
_deathEffect.removeSpawnedEntities();
|
||||
// _deathEffect.removeSpawnedEntities();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -0,0 +1,10 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface DataTracker
|
||||
{
|
||||
public Number getData(Player player);
|
||||
|
||||
public boolean hasData(Player player);
|
||||
}
|
@ -8,18 +8,19 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -31,12 +32,13 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.DataTracker;
|
||||
|
||||
public class ChallengeChickenShooting extends Challenge
|
||||
public class ChallengeChickenShooting extends Challenge implements DataTracker
|
||||
{
|
||||
private ArrayList<Chicken> _chickens = new ArrayList<Chicken>();
|
||||
private HashMap<Player, Integer> _score = new HashMap<Player, Integer>();
|
||||
private HashMap<Player, Integer> _arrowsShot = new HashMap<Player, Integer>();
|
||||
private HashMap<Player, Integer> _arrowTracker = new HashMap<Player, Integer>();
|
||||
|
||||
public ChallengeChickenShooting(BawkBawkBattles host)
|
||||
{
|
||||
@ -127,7 +129,7 @@ public class ChallengeChickenShooting extends Challenge
|
||||
inv.setItem(31, arrow);
|
||||
|
||||
_score.put(player, 0);
|
||||
_arrowsShot.put(player, 0);
|
||||
_arrowTracker.put(player, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@ -143,28 +145,6 @@ public class ChallengeChickenShooting extends Challenge
|
||||
}
|
||||
|
||||
remove(EntityType.ARROW);
|
||||
|
||||
_chickens.clear();
|
||||
_score.clear();
|
||||
_arrowsShot.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof Arrow))
|
||||
return;
|
||||
|
||||
Arrow arrow = (Arrow) event.getEntity();
|
||||
Player player = (Player) arrow.getShooter();
|
||||
|
||||
if (!isPlayerValid(player))
|
||||
return;
|
||||
|
||||
_arrowsShot.put(player, _arrowsShot.get(player) + 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -238,6 +218,43 @@ public class ChallengeChickenShooting extends Challenge
|
||||
spawnChicken();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
Projectile projectile = event.getEntity();
|
||||
|
||||
if (!(projectile.getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) projectile.getShooter();
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!isChallengeValid() || !projectile.isValid() || projectile.isDead())
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (projectile.isOnGround())
|
||||
{
|
||||
if (_arrowTracker.containsKey(player))
|
||||
{
|
||||
_arrowTracker.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
projectile.remove();
|
||||
}
|
||||
}.runTaskLater(Host.Manager.getPlugin(), 1L);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
@ -250,17 +267,23 @@ public class ChallengeChickenShooting extends Challenge
|
||||
{
|
||||
_score.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getArrowsShot()
|
||||
{
|
||||
return _arrowsShot;
|
||||
if (_arrowTracker.containsKey(player))
|
||||
{
|
||||
_arrowTracker.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
private int showAndIncrementScore(Player player, LivingEntity entity)
|
||||
{
|
||||
int score = _score.get(player) + 1;
|
||||
|
||||
if (_arrowTracker.containsKey(player))
|
||||
{
|
||||
int arrowsShot = _arrowTracker.get(player) + 1;
|
||||
_arrowTracker.put(player, arrowsShot);
|
||||
}
|
||||
|
||||
Location location = player.getEyeLocation();
|
||||
location.add(UtilAlg.getTrajectory(location, entity.getEyeLocation()).multiply(Math.min(7, entity.getLocation().distance(location))));
|
||||
|
||||
@ -309,4 +332,16 @@ public class ChallengeChickenShooting extends Challenge
|
||||
|
||||
return getCenter().add(random, 15, random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Number getData(Player player)
|
||||
{
|
||||
return _arrowTracker.get(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(Player player)
|
||||
{
|
||||
return _arrowTracker.containsKey(player);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -20,11 +21,11 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.DataTracker;
|
||||
|
||||
public class ChallengeKangarooJump extends Challenge
|
||||
public class ChallengeKangarooJump extends Challenge implements DataTracker
|
||||
{
|
||||
private HashMap<String, Boolean> _players = new HashMap<String, Boolean>();
|
||||
private HashMap<Player, Integer> _playerJumpHeight = new HashMap<Player, Integer>();
|
||||
private HashMap<Player, Integer> _heightData = new HashMap<Player, Integer>();
|
||||
private long _gameTime = System.currentTimeMillis() + ((UtilMath.r(5) + 20) * 1000);
|
||||
|
||||
public ChallengeKangarooJump(BawkBawkBattles host)
|
||||
@ -103,8 +104,7 @@ public class ChallengeKangarooJump extends Challenge
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
_players.put(player.getName(), true);
|
||||
_playerJumpHeight.put(player, 0);
|
||||
_heightData.put(player, 0);
|
||||
}
|
||||
|
||||
Host.StrictAntiHack = false;
|
||||
@ -128,19 +128,10 @@ public class ChallengeKangarooJump extends Challenge
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!isPlayerValid(player))
|
||||
if (!isPlayerValid(player) || !player.isOnGround())
|
||||
return;
|
||||
|
||||
if (!_players.get(player.getName()))
|
||||
{
|
||||
if (player.isOnGround())
|
||||
_players.put(player.getName(), true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
UtilAction.velocity(player, 2, 0.4, 4, true);
|
||||
_players.put(player.getName(), false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -158,19 +149,19 @@ public class ChallengeKangarooJump extends Challenge
|
||||
if (!player.isOnGround())
|
||||
return;
|
||||
|
||||
if (!_playerJumpHeight.containsKey(player))
|
||||
if (!_heightData.containsKey(player))
|
||||
return;
|
||||
|
||||
if (Data.isLost(player))
|
||||
_playerJumpHeight.remove(player);
|
||||
_heightData.remove(player);
|
||||
|
||||
if (!isPlayerValid(player))
|
||||
return;
|
||||
|
||||
if (player.getLocation().getBlockY() < _playerJumpHeight.get(player))
|
||||
_playerJumpHeight.remove(player);
|
||||
else if (player.getLocation().getBlockY() > _playerJumpHeight.get(player))
|
||||
_playerJumpHeight.put(player, player.getLocation().getBlockY());
|
||||
if (player.getLocation().getBlockY() < _heightData.get(player))
|
||||
_heightData.remove(player);
|
||||
else if (player.getLocation().getBlockY() > _heightData.get(player))
|
||||
_heightData.put(player, player.getLocation().getBlockY());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -205,6 +196,20 @@ public class ChallengeKangarooJump extends Challenge
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_heightData.containsKey(player))
|
||||
{
|
||||
_heightData.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> sortHash(final HashMap<String, Integer> unsortedMap)
|
||||
{
|
||||
ArrayList<String> players = new ArrayList<String>(unsortedMap.keySet());
|
||||
@ -224,8 +229,15 @@ public class ChallengeKangarooJump extends Challenge
|
||||
return players;
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getPlayerHeights()
|
||||
@Override
|
||||
public Number getData(Player player)
|
||||
{
|
||||
return _playerJumpHeight;
|
||||
return _heightData.get(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(Player player)
|
||||
{
|
||||
return _heightData.containsKey(player);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -32,8 +33,9 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.DataTracker;
|
||||
|
||||
public class ChallengeMilkACow extends Challenge
|
||||
public class ChallengeMilkACow extends Challenge implements DataTracker
|
||||
{
|
||||
private Villager _villager;
|
||||
private HashMap<Entity, ArrayList<String>> _milked = new HashMap<Entity, ArrayList<String>>();
|
||||
@ -47,12 +49,12 @@ public class ChallengeMilkACow extends Challenge
|
||||
"Harry",
|
||||
"Andrew",
|
||||
"Daniel",
|
||||
"Bobbae",
|
||||
"Josh",
|
||||
"Jim"
|
||||
};
|
||||
|
||||
String[] _cowNames = new String[] {
|
||||
"Moorten",
|
||||
"Moosly",
|
||||
"Mooington",
|
||||
"Mooley",
|
||||
"Moose",
|
||||
@ -278,6 +280,20 @@ public class ChallengeMilkACow extends Challenge
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_score.containsKey(player))
|
||||
{
|
||||
_score.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnCowsAndFarmer()
|
||||
{
|
||||
Host.CreatureAllow = true;
|
||||
@ -329,8 +345,15 @@ public class ChallengeMilkACow extends Challenge
|
||||
return getCenter().add(UtilMath.r(((getArenaSize() * 2) - 1) - (getArenaSize() - 1)), 1, UtilMath.r((getArenaSize() * 2) - 1) - (getArenaSize() - 1));
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getScore()
|
||||
@Override
|
||||
public Number getData(Player player)
|
||||
{
|
||||
return _score;
|
||||
return _score.get(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(Player player)
|
||||
{
|
||||
return _score.containsKey(player);
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,14 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.DataTracker;
|
||||
|
||||
public class ChallengeNavigationMaze extends Challenge
|
||||
public class ChallengeNavigationMaze extends Challenge implements DataTracker
|
||||
{
|
||||
private HashMap<Player, Long> _completionTime = new HashMap<Player, Long>();
|
||||
|
||||
@ -150,6 +152,20 @@ public class ChallengeNavigationMaze extends Challenge
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_completionTime.containsKey(player))
|
||||
{
|
||||
_completionTime.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isMazeValid()
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
@ -258,8 +274,15 @@ public class ChallengeNavigationMaze extends Challenge
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public HashMap<Player, Long> getPlayerTimes()
|
||||
@Override
|
||||
public Number getData(Player player)
|
||||
{
|
||||
return _completionTime;
|
||||
return _completionTime.get(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(Player player)
|
||||
{
|
||||
return _completionTime.containsKey(player);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class ChallengeReverseTag extends Challenge
|
||||
private ChallengeTeam _tagged;
|
||||
private ChallengeTeam _nonTagged;
|
||||
|
||||
private int _cooldown = 2; // seconds
|
||||
private int _cooldown = 2; // Seconds
|
||||
private HashSet<Player> _cooldowns = new HashSet<Player>();
|
||||
|
||||
public ChallengeReverseTag(BawkBawkBattles host)
|
||||
|
@ -21,8 +21,9 @@ import mineplex.core.projectile.ProjectileUser;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.DataTracker;
|
||||
|
||||
public class ChallengeWaveCrush extends Challenge
|
||||
public class ChallengeWaveCrush extends Challenge implements DataTracker
|
||||
{
|
||||
// The amount of waves that started.
|
||||
private int _waveAmount = 0;
|
||||
@ -279,8 +280,15 @@ public class ChallengeWaveCrush extends Challenge
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getSurvivedWaves()
|
||||
@Override
|
||||
public Number getData(Player player)
|
||||
{
|
||||
return _survivedWaves;
|
||||
return _survivedWaves.get(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(Player player)
|
||||
{
|
||||
return _survivedWaves.containsKey(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package nautilus.game.arcade.game.games.mineware.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.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
@ -7,10 +11,6 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKangaroo
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class StatTrackerKangarooAtHeart extends StatTracker<Game>
|
||||
{
|
||||
public StatTrackerKangarooAtHeart(Game game)
|
||||
@ -31,13 +31,11 @@ public class StatTrackerKangarooAtHeart extends StatTracker<Game>
|
||||
|
||||
ChallengeKangarooJump kangarooJump = (ChallengeKangarooJump) challenge;
|
||||
|
||||
for (Player player : kangarooJump.getPlayerHeights().keySet())
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
if (!player.isOnline())
|
||||
continue;
|
||||
|
||||
if (!kangarooJump.getData().isLost(player))
|
||||
if (kangarooJump.hasData(player) && kangarooJump.getData().isCompleted(player))
|
||||
{
|
||||
System.out.println("Kangaroo at Heart: " + player.getName());
|
||||
addStat(player, "Kangaroo", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -33,14 +33,18 @@ public class StatTrackerLauraCraftTracker extends StatTracker<Game>
|
||||
|
||||
ChallengeNavigationMaze navigationMaze = (ChallengeNavigationMaze) challenge;
|
||||
|
||||
for (Player player : navigationMaze.getPlayerTimes().keySet())
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
if (!player.isOnline())
|
||||
continue;
|
||||
|
||||
if (navigationMaze.getPlayerTimes().get(player) <= (navigationMaze.getSettings().getStartTime() + (_timeForCompletion * 1000)))
|
||||
if (navigationMaze.hasData(player))
|
||||
{
|
||||
addStat(player, "LauraCraft", 1, false, false);
|
||||
long time = (long) navigationMaze.getData(player);
|
||||
long limit = navigationMaze.getSettings().getStartTime() + _timeForCompletion * 1000;
|
||||
|
||||
if (time <= limit)
|
||||
{
|
||||
System.out.println("Laura Craft: " + player.getName());
|
||||
addStat(player, "LauraCraft", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,16 +29,20 @@ public class StatTrackerMilkManTracker extends StatTracker<Game>
|
||||
if (!(challenge instanceof ChallengeMilkACow))
|
||||
return;
|
||||
|
||||
ChallengeMilkACow milkeACow = (ChallengeMilkACow) challenge;
|
||||
ChallengeMilkACow milkACow = (ChallengeMilkACow) challenge;
|
||||
|
||||
for (Player player : milkeACow.getScore().keySet())
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
if (!player.isOnline())
|
||||
continue;
|
||||
if (milkACow.hasData(player))
|
||||
{
|
||||
int score = (int) milkACow.getData(player);
|
||||
|
||||
int score = milkeACow.getScore().get(player);
|
||||
|
||||
addStat(player, "MilkMan", score, false, false);
|
||||
if (score > 0)
|
||||
{
|
||||
System.out.println("Milk Man: " + player.getName());
|
||||
addStat(player, "MilkMan", score, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package nautilus.game.arcade.game.games.mineware.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.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
@ -7,10 +11,6 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeChickenS
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class StatTrackerPinataMasterTracker extends StatTracker<Game>
|
||||
{
|
||||
public StatTrackerPinataMasterTracker(Game game)
|
||||
@ -31,16 +31,17 @@ public class StatTrackerPinataMasterTracker extends StatTracker<Game>
|
||||
|
||||
ChallengeChickenShooting chickenShooting = (ChallengeChickenShooting) challenge;
|
||||
|
||||
for (Player player : chickenShooting.getArrowsShot().keySet())
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
if (!player.isOnline())
|
||||
continue;
|
||||
|
||||
int shots = chickenShooting.getArrowsShot().get(player);
|
||||
|
||||
if (shots == 6 && challenge.getData().isCompleted(player))
|
||||
if (chickenShooting.hasData(player))
|
||||
{
|
||||
addStat(player, "PinataMaster", 1, true, false);
|
||||
int shots = (int) chickenShooting.getData(player);
|
||||
|
||||
if (chickenShooting.getData().isCompleted(player) && shots == 6)
|
||||
{
|
||||
System.out.println("Pinata Master: " + player.getName());
|
||||
addStat(player, "PinataMaster", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package nautilus.game.arcade.game.games.mineware.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.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
@ -7,10 +11,6 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeWaveCrus
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class StatTrackerSurfUpTracker extends StatTracker<Game>
|
||||
{
|
||||
public StatTrackerSurfUpTracker(Game game)
|
||||
@ -31,17 +31,17 @@ public class StatTrackerSurfUpTracker extends StatTracker<Game>
|
||||
|
||||
ChallengeWaveCrush waveCrush = (ChallengeWaveCrush) challenge;
|
||||
|
||||
for (Player player : waveCrush.getSurvivedWaves().keySet())
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
if (!player.isOnline())
|
||||
continue;
|
||||
if (waveCrush.hasData(player))
|
||||
{
|
||||
int amount = (int) waveCrush.getData(player);
|
||||
|
||||
int amount = waveCrush.getSurvivedWaves().get(player);
|
||||
|
||||
if (amount < 1)
|
||||
continue;
|
||||
|
||||
addStat(player, "SurfUp", amount, false, false);
|
||||
if (amount > 1)
|
||||
{
|
||||
addStat(player, "SurfUp", amount, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,15 +31,13 @@ public class StatTrackerTagMasterTracker extends StatTracker<Game>
|
||||
|
||||
ChallengeReverseTag reverseTag = (ChallengeReverseTag) challenge;
|
||||
|
||||
for (Player player : reverseTag.getNonTagged().getPlayers())
|
||||
for (Player player : reverseTag.getTagged().getPlayers())
|
||||
{
|
||||
if (!player.isOnline())
|
||||
continue;
|
||||
|
||||
if (reverseTag.getData().isLost(player))
|
||||
continue;
|
||||
|
||||
addStat(player, "TagMaster", 1, true, false);
|
||||
if (reverseTag.getData().isCompleted(player))
|
||||
{
|
||||
System.out.println("Tag Master: " + player.getName());
|
||||
addStat(player, "TagMaster", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
@ -21,10 +20,8 @@ public class StatTrackerVeteranTracker extends StatTracker<Game>
|
||||
{
|
||||
if (event.GetState() == GameState.End)
|
||||
{
|
||||
for (Player player : getGame().getWinners())
|
||||
{
|
||||
addStat(player, "Veteran", 1, true, false);
|
||||
}
|
||||
System.out.println("Veteran: " + getGame().getWinners().get(0).getName());
|
||||
addStat(getGame().getWinners().get(0), "Veteran", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user