Refactoring.

This commit is contained in:
Thanos paravantis 2016-01-30 21:07:00 +02:00
parent 215fe68575
commit 69dc888657
17 changed files with 481 additions and 476 deletions

View File

@ -1 +1 @@
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"]]
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"]]

View File

@ -64,13 +64,13 @@ org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=150
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
@ -281,7 +281,7 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=120
org.eclipse.jdt.core.formatter.lineSplit=150
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0

View File

@ -26,7 +26,7 @@ public class AntiHackFix implements Listener
_challenge = challenge;
Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin());
System.out.println("Anti-Hack jump fix registered for " + _challenge.getChallengeName() + " challenge.");
System.out.println("Anti-Hack jump fix registered for " + _challenge.getName() + " challenge.");
}
@EventHandler

View File

@ -39,66 +39,201 @@ public abstract class Challenge implements Listener
public MineWare Host;
protected int Places;
protected long StartTime;
protected long Duration;
protected HashSet<Player> Completed = new HashSet<Player>();
protected HashSet<Player> Lost = new HashSet<Player>();
protected HashSet<Player> CurrentPlaying;
private String _name;
private String[] _description;
private boolean _teamBased;
private boolean _crumble;
private ChallengeType _challengeType;
private String _challengeName;
private String[] _challengeDesc;
private ChallengeType _type;
private Location _center;
private HashSet<Player> _invisPlayers = new HashSet<Player>();
private HashSet<Block> _modifiedBlocks = new HashSet<Block>();
public Challenge(MineWare host, ChallengeType challengeType, String challengeName, String... challengeDes)
private int _places;
private long _startTime;
private long _duration;
private HashSet<Player> _completed = new HashSet<Player>();
private HashSet<Player> _lost = new HashSet<Player>();
private HashSet<Player> _currentPlaying;
/**
* Default Constructor.
*
* @param host The game that this challenge is hosted on.
* @param type The type of the challenge.
* @param name The display name of the challenge.
* @param description The description of the challenge.
*/
public Challenge(MineWare host, ChallengeType type, String name, String... description)
{
Host = host;
_challengeDesc = challengeDes;
_type = type;
_name = name;
_description = description;
_center = new Location(host.WorldData.World, 0, 0, 0);
_challengeType = challengeType;
_challengeName = challengeName;
_teamBased = false;
_crumble = false;
setBorder(-100, 100, 0, 256, -100, 100);
}
public Challenge(MineWare host, ChallengeType challengeType, String challengeName, boolean teamBased,
boolean crumble, String... challengeDes)
/**
* Alternative Constructor.
*
* @param host The game that this challenge is hosted on.
* @param type The type of the challenge.
* @param name The display name of the challenge.
* @param teamBased Whether or not this challenge is based on teams.
* @param crumble Whether or not the map can crumble.
* @param description The description of the challenge.
*/
public Challenge(MineWare host, ChallengeType type, String name, boolean teamBased,
boolean crumble, String... description)
{
Host = host;
_challengeDesc = challengeDes;
_center = new Location(host.WorldData.World, 0, 0, 0);
_challengeType = challengeType;
_challengeName = challengeName;
_type = type;
_name = name;
_teamBased = teamBased;
_crumble = crumble;
_description = description;
_center = new Location(host.WorldData.World, 0, 0, 0);
setBorder(-100, 100, 0, 256, -100, 100);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
/**
* The list of spawn locations where players will be teleported.
*
* @return ArrayList<Location>
*/
public abstract ArrayList<Location> getSpawns();
/**
* The list of actions to perform in order for the map to be created.
*/
public abstract void generateRoom();
/**
* The list of actions to perform once the challenge is started.
*/
public abstract void setupPlayers();
/**
* The list of actions to perform after the challenge has ended.
*/
public abstract void cleanupRoom();
/**
* This method is called when the challenge timer runs out. <br>
* Used for overriding purposes only.
*/
public void onTimerFinish()
{
if (!Host.IsLive())
}
public void start()
{
_currentPlaying = new HashSet<Player>(getChallengers());
setupPlayers();
_completed.clear();
_lost.clear();
_startTime = System.currentTimeMillis();
_duration = getMaxTime();
_places = (int) Math.ceil(getChallengers().size() / 2D);
}
public boolean finish()
{
boolean maxTimeReached = UtilTime.elapsed(_startTime, _duration);
ArrayList<Player> players = getChallengers();
if (players.size() <= _completed.size()) // 50% done
return true;
if (_type == ChallengeType.LastStanding)
{
if (players.size() <= _places)
{
for (Player player : players)
SetCompleted(player);
return true;
}
}
else if (_type == ChallengeType.FirstComplete)
{
if (_completed.size() >= _places)
return true;
}
if (maxTimeReached)
onTimerFinish();
return maxTimeReached;
}
public void end()
{
if (!_invisPlayers.isEmpty())
for (Player player : _invisPlayers)
Host.Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Challenge Ended");
cleanupRoom();
}
public void setCompleted(Player player, boolean invis)
{
if (_completed.contains(player))
return;
removePlayerFromAllLists(event.getPlayer());
if (invis)
{
_invisPlayers.add(player);
Host.Manager.GetCondition().Factory().Cloak("Completed", player, player, 7777, true, false);
}
_completed.add(player);
UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!");
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2.0F, 1.0F);
}
public long getMaxTime()
public void SetCompleted(Player player)
{
return 60000;
setCompleted(player, false);
}
public HashSet<Block> getModifiedBlocks()
public void setLost(Player player, boolean invis)
{
return _modifiedBlocks;
if (isDone(player))
return;
if (!Host.isCrumbling())
_lost.add(player);
if (invis)
{
_invisPlayers.add(player);
Host.Manager.GetCondition().Factory().Cloak("Completed", player, player, 7777, true, false);
}
Host.looseLife(player, false);
UtilInv.Clear(player);
}
public void setLost(Player player)
{
setLost(player, false);
}
protected void addBlock(Block block)
{
if (!block.isEmpty())
_modifiedBlocks.add(block);
}
public void setBorder(int minX, int maxX, int minY, int maxY, int minZ, int maxZ)
@ -113,54 +248,13 @@ public abstract class Challenge implements Listener
data.MaxZ = maxZ;
}
protected void addBlock(Block block)
{
if (!block.isEmpty())
_modifiedBlocks.add(block);
}
public String[] getGameMessages()
{
List<String> testing = new ArrayList<String>();
for (String strings : _challengeDesc)
{
testing.add(strings);
}
testing.add("");
return testing.toArray(new String[testing.size()]);
}
public void start()
{
CurrentPlaying = new HashSet<Player>(getChallengers());
setupPlayers();
Completed.clear();
Lost.clear();
StartTime = System.currentTimeMillis();
Duration = getMaxTime();
Places = (int) Math.ceil(getChallengers().size() / 2D);
}
public void end()
{
if (!_invisPlayers.isEmpty())
for (Player player : _invisPlayers)
Host.Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Challenge Ended");
cleanupRoom();
}
protected void displayCount(Player player, Location loc, String string)
{
final Hologram hologram = new Hologram(Host.Manager.getHologramManager(), loc, string);
hologram.setHologramTarget(HologramTarget.WHITELIST);
hologram.addPlayer(player);
hologram.start();
final long expires = System.currentTimeMillis() + 500;
new BukkitRunnable()
@ -180,77 +274,27 @@ public abstract class Challenge implements Listener
}.runTaskTimer(Host.Manager.getPlugin(), 0, 0);
}
public abstract ArrayList<Location> getSpawns();
public abstract void cleanupRoom();
public abstract void setupPlayers();
public abstract void generateRoom();
public boolean isInsideMap(Player player)
{
return Host.isInsideMap(player.getLocation());
}
public boolean finish()
{
boolean maxTimeReached = UtilTime.elapsed(StartTime, Duration);
ArrayList<Player> players = getChallengers();
if (players.size() <= Completed.size()) // 50% done
return true;
if (_challengeType == ChallengeType.LastStanding)
{
if (players.size() <= Places)
{
for (Player player : players)
{
SetCompleted(player);
}
return true;
}
}
else if (_challengeType == ChallengeType.FirstComplete)
{
if (Completed.size() >= Places)
{
return true;
}
}
if (maxTimeReached)
{
onChallengeTimeEnd();
}
return maxTimeReached;
}
@Deprecated
@SuppressWarnings("deprecation")
@EventHandler
/**
* Do not use this method!
*
* @param event
*/
public void mapCrumble(UpdateEvent event)
public void onMapCrumble(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
if (!Host.IsLive())
{
return;
}
if (!_crumble)
{
return;
}
if (!Host.isCrumbling())
{
return;
}
Block qualifiedBlock = null;
double furthestDistance = 0;
@ -259,104 +303,68 @@ public abstract class Challenge implements Listener
Host.setCrumbling(false);
return;
}
for (Block currentBlock : _modifiedBlocks)
{
double theBlocksdistance = UtilMath.offset2d(Host.GetSpectatorLocation(),
double theBlocksDistance = UtilMath.offset2d(Host.GetSpectatorLocation(),
currentBlock.getLocation().add(0.5, 0.5, 0.5));
if (qualifiedBlock == null || furthestDistance < theBlocksdistance)
if (qualifiedBlock == null || furthestDistance < theBlocksDistance)
{
qualifiedBlock = currentBlock;
furthestDistance = theBlocksdistance;
furthestDistance = theBlocksDistance;
}
}
// if blocks are layered:
while (qualifiedBlock.getRelative(BlockFace.DOWN).getType() != Material.AIR)
{
qualifiedBlock = qualifiedBlock.getRelative(BlockFace.DOWN);
}
_modifiedBlocks.remove(qualifiedBlock);
if (UtilMath.r(4) == 0)
{
qualifiedBlock.getWorld().spawnFallingBlock(qualifiedBlock.getLocation().add(0.5, 0.5, 0.5),
qualifiedBlock.getType(), qualifiedBlock.getData());
}
MapUtil.QuickChangeBlockAt(qualifiedBlock.getLocation(), Material.AIR);
}
/**
* This method is only called <br>
* if the challenge ends due to <br>
* exceeding the max time for the challenge <br>
*/
public void onChallengeTimeEnd() // Override-able
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
if (!Host.IsLive())
return;
removeFromLists(event.getPlayer());
}
public void removeFromLists(Player player)
{
if (_lost.contains(player))
_lost.remove(player);
if (_completed.contains(player))
_completed.remove(player);
if (_invisPlayers.contains(player))
_invisPlayers.remove(player);
if (_currentPlaying.contains(player))
_currentPlaying.remove(player);
}
public int getTimeLeft()
{
return (int) ((Duration - (System.currentTimeMillis() - StartTime)) / 1000);
}
public void setCompleted(Player player, boolean invis)
{
if (Completed.contains(player))
{
return;
}
if (invis)
{
_invisPlayers.add(player);
Host.Manager.GetCondition().Factory().Cloak("Completed", player, player, 7777, true, false);
}
Completed.add(player);
UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!");
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
}
public void SetCompleted(Player player)
{
setCompleted(player, false);
}
public HashSet<Player> getLost()
{
return Lost;
}
public HashSet<Player> getWinners()
{
return Completed;
}
public void setLost(Player player, boolean invis)
{
if (isDone(player))
{
return;
}
if (!Host.isCrumbling())
{
Lost.add(player);
}
if (invis)
{
_invisPlayers.add(player);
Host.Manager.GetCondition().Factory().Cloak("Completed", player, player, 7777, true, false);
}
Host.looseLife(player, false);
UtilInv.Clear(player);
}
public void setLost(Player player)
{
setLost(player, false);
return (int) ((_duration - (System.currentTimeMillis() - _startTime)) / 1000);
}
/**
* Get all players that are alive, regardless of having won or not.
* Get all players alive, whether they have won or not.
*
* @return ArrayList<Player>
*/
public ArrayList<Player> getChallengers()
{
@ -366,99 +374,56 @@ public abstract class Challenge implements Listener
public ArrayList<Player> getCurrentyAlive(boolean ignoreAlreadyWon)
{
ArrayList<Player> currentlyAlive = new ArrayList<Player>();
for (Player player : CurrentPlaying)
for (Player player : _currentPlaying)
{
if (isLost(player))
{
continue;
}
if (ignoreAlreadyWon)
{
if (isCompleted(player))
{
continue;
}
}
currentlyAlive.add(player);
}
return currentlyAlive;
}
public boolean isCompleted(Player player)
{
return Completed.contains(player);
return _completed.contains(player);
}
public boolean isDone(Player player)
{
if (Completed.contains(player) || Lost.contains(player))
{
return true;
}
else
{
return false;
}
return _completed.contains(player) || _lost.contains(player);
}
public boolean isLost(Player player)
{
if (Lost.contains(player))
{
return true;
}
return false;
}
public void removePlayerFromAllLists(Player player)
{
if (Lost.contains(player))
{
Lost.remove(player);
}
if (Completed.contains(player))
{
Completed.remove(player);
}
if (_invisPlayers.contains(player))
{
_invisPlayers.remove(player);
}
if (CurrentPlaying.contains(player))
{
CurrentPlaying.remove(player);
}
}
public String getChallengeName()
{
return _challengeName;
return _lost.contains(player);
}
public float getTimeLeftPercent()
{
float a = (float) (Duration - (System.currentTimeMillis() - StartTime));
float b = (float) (Duration);
float a = (float) (_duration - (System.currentTimeMillis() - _startTime));
float b = (float) (_duration);
return a / b;
}
public final int getRemainingPlaces()
{
if (_challengeType == ChallengeType.FirstComplete)
{
return Places - Completed.size();
}
else if (_challengeType == ChallengeType.LastStanding)
{
return getChallengers().size() - Places;
}
if (_type == ChallengeType.FirstComplete)
return _places - _completed.size();
else if (_type == ChallengeType.LastStanding)
return getChallengers().size() - _places;
return 0;
}
public void onCollide(LivingEntity target, Block block, ProjectileUser data)
{
// For OverRide
}
public int getMinPlayers()
@ -476,37 +441,108 @@ public abstract class Challenge implements Listener
return getArenaSize(8);
}
/**
* This method, if there's too many people <br>
* the max number will be 40!
*
* @param minBlocks
* min number it will return
* @return
*/
public int getArenaSize(int minBlocks)
{
int size = (int) (minBlocks + Math.ceil(Host.GetPlayers(true).size() / 2));
return size > 40 ? 40 : size;
}
public boolean getTeamBased()
public String getName()
{
return _name;
}
public String[] getDescription()
{
return _description;
}
public String[] getGameMessages()
{
List<String> description = new ArrayList<String>();
for (String strings : _description)
{
description.add(strings);
}
description.add("");
return description.toArray(new String[description.size()]);
}
public boolean isTeamBased()
{
return _teamBased;
}
public boolean getCrumble()
public boolean canCrumble()
{
return _crumble;
}
public ChallengeType getType()
{
return _type;
}
public Location getCenter()
{
return _center.clone();
}
public boolean hasWinner()
public HashSet<Block> getModifiedBlocks()
{
return !Completed.isEmpty();
return _modifiedBlocks;
}
public int getAvailablePlaces()
{
return _places;
}
public long getStartTime()
{
return _startTime;
}
public long getDuration()
{
return _duration;
}
public void setDuration(long duration)
{
_duration = duration;
}
public HashSet<Player> getCompleted()
{
return _completed;
}
public boolean hasAnyoneCompleted()
{
return !_completed.isEmpty();
}
public HashSet<Player> getLost()
{
return _lost;
}
public HashSet<Player> getCurrentPlaying()
{
return _currentPlaying;
}
public boolean shouldCrumble()
{
return _crumble;
}
public long getMaxTime()
{
return 60000;
}
}

View File

@ -66,7 +66,7 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBouncingBloc
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBuildRace;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeChestLoot;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeCloudFall;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDogvsCat;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDogsVersusCats;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDragonEgg;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFallingBlocks;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFastFood;
@ -189,7 +189,7 @@ public class MineWare extends TeamGame implements IThrown
_challenges.add(ChallengeBuildRace.class);
_challenges.add(ChallengeChestLoot.class);
_challenges.add(ChallengeCloudFall.class);
_challenges.add(ChallengeDogvsCat.class);
_challenges.add(ChallengeDogsVersusCats.class);
_challenges.add(ChallengeDragonEgg.class);
_challenges.add(ChallengeFallingBlocks.class);
_challenges.add(ChallengeFastFood.class);
@ -259,7 +259,7 @@ public class MineWare extends TeamGame implements IThrown
if (getChallengers().size() >= challenge.getMaxPlayers())
continue;
if (challenge.getTeamBased() == true)
if (challenge.isTeamBased())
if (!(getChallengers().size() % 2 == 0))
continue;
@ -453,9 +453,9 @@ public class MineWare extends TeamGame implements IThrown
{
if (_challenge.finish())
{
if (_challenge.getCrumble() && !_challenge.getModifiedBlocks().isEmpty())
if (_challenge.canCrumble() && !_challenge.getModifiedBlocks().isEmpty())
{
if (!_crumbling && _challenge.getLost().size() >= _challenge.CurrentPlaying.size() / 2)
if (!_crumbling && _challenge.getLost().size() >= _challenge.getCurrentPlaying().size() / 2)
{
_crumbling = true;
@ -468,7 +468,7 @@ public class MineWare extends TeamGame implements IThrown
}
else
{
if ((_challenge.CurrentPlaying.size() - _challenge.Lost.size()) <= 1 && _crumbling)
if ((_challenge.getCurrentPlaying().size() - _challenge.getLost().size()) <= 1 && _crumbling)
{
endCurrentChallenge();
_crumbling = false;
@ -493,7 +493,7 @@ public class MineWare extends TeamGame implements IThrown
else
{
UtilTextTop.displayTextBar(player, _challenge.getTimeLeftPercent(),
C.cYellow + C.Bold + _challenge.getChallengeName());
C.cYellow + C.Bold + _challenge.getName());
player.setLevel(_challenge.getRemainingPlaces());
player.setExp(_challenge.getTimeLeftPercent());
}
@ -511,7 +511,7 @@ public class MineWare extends TeamGame implements IThrown
Manager.GetDisguise().undisguise(player);
UtilInv.Clear(player);
if (_challenge.hasWinner() && !_challenge.isCompleted(player))
if (_challenge.hasAnyoneCompleted() && !_challenge.isCompleted(player))
looseLife(player, true);
if (_challenge.isCompleted(player))
@ -581,10 +581,10 @@ public class MineWare extends TeamGame implements IThrown
Scoreboard.Write("" + _challenge.getCurrentyAlive(false).size());
Scoreboard.Write(C.cRed + C.Bold + "Completed");
Scoreboard.Write("" + _challenge.Completed.size());
Scoreboard.Write("" + _challenge.getCompleted().size());
Scoreboard.Write(C.cGray + C.Bold + "Dead");
Scoreboard.Write("" + _challenge.Lost.size());
Scoreboard.Write("" + _challenge.getLost().size());
}
Scoreboard.WriteBlank();
@ -662,7 +662,7 @@ public class MineWare extends TeamGame implements IThrown
{
UtilPlayer.message(player, F.count(ArcadeFormat.Line));
UtilPlayer.message(player, " " + C.cYellow + challenge.getChallengeName());
UtilPlayer.message(player, " " + C.cYellow + challenge.getName());
UtilPlayer.message(player, "");
for (String currentMessage : messages)
@ -681,7 +681,7 @@ public class MineWare extends TeamGame implements IThrown
for (Player player : UtilServer.getPlayers())
{
String message = C.cYellow + messages.get(looped);
UtilTextMiddle.display(challenge.getChallengeName(), message, 0, 60, 20);
UtilTextMiddle.display(challenge.getName(), message, 0, 60, 20);
}
if (looped == messages.size() - 1)
@ -843,9 +843,9 @@ public class MineWare extends TeamGame implements IThrown
if (_challenge != null)
{
if (_challenge.CurrentPlaying != null)
if (_challenge.getCurrentPlaying() != null)
{
_challenge.CurrentPlaying.remove(player);
_challenge.getCurrentPlaying().remove(player);
}
}
}

View File

@ -65,7 +65,7 @@ public class ChallengeAnvilDance extends Challenge
ArrayList<Location> spawns = new ArrayList<Location>();
Location center = new Location(Host.WorldData.World, 0, 0, 0);
for(Location location : UtilShapes.getCircle(center, true, getArenaSize() - 3))
for (Location location : UtilShapes.getCircle(center, true, getArenaSize() - 3))
{
double x = location.getX() + 0.5;
double y = 1.1;
@ -83,12 +83,12 @@ public class ChallengeAnvilDance extends Challenge
{
Location center = new Location(Host.WorldData.World, 0, 0, 0);
for(Location location : UtilShapes.getCircle(center, false, getArenaSize()))
for (Location location : UtilShapes.getCircle(center, false, getArenaSize()))
{
Block block = location.getBlock();
block.setType(Material.SMOOTH_BRICK);
if(UtilMath.random.nextBoolean())
if (UtilMath.random.nextBoolean())
{
block.setData((byte) (UtilMath.r(3)));
}
@ -110,10 +110,10 @@ public class ChallengeAnvilDance extends Challenge
{
if (_fireworkTask != null)
_fireworkTask.cancel();
_paused = false;
for(Block block : _landedAnvils)
for (Block block : _landedAnvils)
{
block.setType(Material.AIR);
}
@ -121,9 +121,9 @@ public class ChallengeAnvilDance extends Challenge
_landedAnvils.clear();
_fallingAnvils.clear();
for(Entity entity : Host.WorldData.World.getEntities())
for (Entity entity : Host.WorldData.World.getEntities())
{
if(entity instanceof FallingBlock || entity instanceof Item)
if (entity instanceof FallingBlock || entity instanceof Item)
{
entity.remove();
}
@ -139,14 +139,14 @@ public class ChallengeAnvilDance extends Challenge
@EventHandler
public void onEntityChangeBlockEvent(final EntityChangeBlockEvent event)
{
if(!Host.IsLive() || !Host.isChallengeStarted())
if (!Host.IsLive() || !Host.isChallengeStarted())
return;
if(event.getEntity() instanceof FallingBlock)
if (event.getEntity() instanceof FallingBlock)
{
Block block = event.getBlock();
if(!_landedAnvils.contains(block))
if (!_landedAnvils.contains(block))
{
_fallingAnvils.remove(event.getEntity());
_landedAnvils.add(block);
@ -161,7 +161,7 @@ public class ChallengeAnvilDance extends Challenge
@Override
public void run()
{
if(!Host.IsLive() || !Host.isChallengeStarted())
if (!Host.IsLive() || !Host.isChallengeStarted())
{
cancel();
return;
@ -169,11 +169,11 @@ public class ChallengeAnvilDance extends Challenge
Iterator<FallingBlock> blocks = _fallingAnvils.iterator();
while(blocks.hasNext())
while (blocks.hasNext())
{
FallingBlock block = blocks.next();
if(!block.isValid())
if (!block.isValid())
{
blocks.remove();
}
@ -189,13 +189,13 @@ public class ChallengeAnvilDance extends Challenge
@Override
public void run()
{
if(!Host.IsLive() || !Host.isChallengeStarted())
if (!Host.IsLive() || !Host.isChallengeStarted())
{
cancel();
return;
}
if(!_paused)
if (!_paused)
{
// Call method twice to make it harder.
createAnvil();
@ -212,30 +212,30 @@ public class ChallengeAnvilDance extends Challenge
@Override
public void run()
{
if(!Host.IsLive() || !Host.isChallengeStarted())
if (!Host.IsLive() || !Host.isChallengeStarted())
{
cancel();
return;
}
_paused = true;
_killCurrentTime = System.currentTimeMillis()+3000;
_killCurrentTime = System.currentTimeMillis() + 3000;
playFireworksTask();
for(Player player : UtilServer.getPlayers())
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.0F, 1.3F);
}
Iterator<Block> anvils = _landedAnvils.iterator();
while(anvils.hasNext())
while (anvils.hasNext())
{
Block anvil = anvils.next();
if(UtilMath.random.nextBoolean())
if (UtilMath.random.nextBoolean())
{
createDancingAnvil(anvil);
}
@ -244,7 +244,7 @@ public class ChallengeAnvilDance extends Challenge
anvils.remove();
}
for(FallingBlock block : _fallingAnvils)
for (FallingBlock block : _fallingAnvils)
{
createDancingAnvil(block);
}
@ -310,7 +310,7 @@ public class ChallengeAnvilDance extends Challenge
@Override
public void run()
{
if(!Host.IsLive() || !Host.isChallengeStarted())
if (!Host.IsLive() || !Host.isChallengeStarted())
{
cancel();
return;
@ -318,7 +318,7 @@ public class ChallengeAnvilDance extends Challenge
times++;
if(times <= 10)
if (times <= 10)
{
UtilFirework.playFirework(new Location(Host.WorldData.World, 0, height, 0), Type.BALL_LARGE,
Color.fromBGR(UtilMath.r(255), UtilMath.r(255), UtilMath.r(255)), false, true);
@ -341,23 +341,23 @@ public class ChallengeAnvilDance extends Challenge
@Override
public void run()
{
if(!Host.IsLive() || !block.isValid() || block.isOnGround() || !Host.isChallengeStarted())
if (!Host.IsLive() || !block.isValid() || block.isOnGround() || !Host.isChallengeStarted())
{
cancel();
return;
}
if(_killCurrentTime > System.currentTimeMillis())
if (_killCurrentTime > System.currentTimeMillis())
return;
for(Entity entity : block.getNearbyEntities(0.05, 0.05, 0.05))
for (Entity entity : block.getNearbyEntities(0.05, 0.05, 0.05))
{
if(entity instanceof Player)
if (entity instanceof Player)
{
Player player = (Player) entity;
if(isDone(player))
if (isDone(player))
return;
if(!Host.IsAlive(player))
if (!Host.IsAlive(player))
return;
player.damage(player.getHealth());

View File

@ -59,7 +59,7 @@ public class ChallengeDiamondFall extends Challenge
}
});
for (int places = 0; places < Math.min(players.size(), Places); places++)
for (int places = 0; places < Math.min(players.size(), getAvailablePlaces()); places++)
{
SetCompleted(players.get(places));
}

View File

@ -31,7 +31,7 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
public class ChallengeDogvsCat extends Challenge
public class ChallengeDogsVersusCats extends Challenge
{
private int _catScore = 0;
private int _dogScore = 0;
@ -40,9 +40,10 @@ public class ChallengeDogvsCat extends Challenge
private HashMap<String, String> _team = new HashMap<String, String>(); // <Player, team>
public ChallengeDogvsCat(MineWare host)
public ChallengeDogsVersusCats(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "If you are a dog, bark.", "If you are a cat, meow.", "Look up and punch to bark or meow.", "First team to the end number wins!");
super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "If you are a dog, bark.", "If you are a cat, meow.",
"Look up and punch to bark or meow.", "First team to the end number wins!");
}
@Override
@ -50,11 +51,11 @@ public class ChallengeDogvsCat extends Challenge
{
ArrayList<Location> spawns = new ArrayList<Location>();
for(int x = -(getArenaSize() - 1); x <= getArenaSize()-1; x++)
for (int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++)
{
for(int z = -(getArenaSize() - 1); z <= getArenaSize()-1; z++)
for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++)
{
if(x % 2 == 0 && z % 2 == 0)
if (x % 2 == 0 && z % 2 == 0)
{
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
}
@ -66,9 +67,9 @@ public class ChallengeDogvsCat extends Challenge
@Override
public void cleanupRoom()
{
for(Player player : UtilServer.getPlayers())
for (Player player : UtilServer.getPlayers())
{
if(Host.IsPlaying(player))
if (Host.IsPlaying(player))
{
player.setGameMode(GameMode.SURVIVAL);
}
@ -86,13 +87,13 @@ public class ChallengeDogvsCat extends Challenge
{
int looped = 0;
for(Player player : Host.GetPlayers(true))
for (Player player : Host.GetPlayers(true))
{
if(Host.IsPlaying(player))
if (Host.IsPlaying(player))
{
player.setGameMode(GameMode.ADVENTURE);
}
if(looped % 2 == 0)
if (looped % 2 == 0)
{
_team.put(player.getName(), "dog");
@ -101,7 +102,7 @@ public class ChallengeDogvsCat extends Challenge
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, ChatColor.GREEN + "Left-click to bark!"));
UtilPlayer.message(player, "You are a DOG! Bark!");
UtilPlayer.message(player, C.cYellow + C.Bold + "You are a Dog, bark!");
}
else
{
@ -112,7 +113,7 @@ public class ChallengeDogvsCat extends Challenge
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.STRING, (byte) 0, 1, ChatColor.GREEN + "Left-click to meow!"));
UtilPlayer.message(player, "You are a CAT! Meow!");
UtilPlayer.message(player, C.cYellow + C.Bold + "You are a Cat, meow!");
}
looped++;
}
@ -128,27 +129,27 @@ public class ChallengeDogvsCat extends Challenge
@Override
public void generateRoom()
{
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
{
for(int z = -getArenaSize(); z <= getArenaSize(); z++)
for (int z = -getArenaSize(); z <= getArenaSize(); z++)
{
for(int y = 0; y <= 1; y++)
for (int y = 0; y <= 1; y++)
{
Block b = getCenter().getBlock().getRelative(x, y, z);
if(y == 0)
if (y == 0)
{
b.setType(Material.GRASS);
}
else
{
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
if (Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
{
b.setType(Material.FENCE);
}
else if(UtilMath.r(4) == 0 && y == 1)
else if (UtilMath.r(4) == 0 && y == 1)
{
if(UtilMath.r(8) == 0)
if (UtilMath.r(8) == 0)
{
b.setType(UtilMath.random.nextBoolean() ? Material.YELLOW_FLOWER : Material.RED_ROSE);
}
@ -160,7 +161,7 @@ public class ChallengeDogvsCat extends Challenge
}
}
if(b.getType() != Material.AIR)
if (b.getType() != Material.AIR)
{
addBlock(b);
}
@ -172,27 +173,27 @@ public class ChallengeDogvsCat extends Challenge
@EventHandler
public void checkForWinner(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK)
if (event.getType() != UpdateType.TICK)
{
return;
}
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
int catScore = calculateScore("cat");
int dogScore = calculateScore("dog");
UtilTextMiddle.display("", C.cBlue + C.Bold + " Dogs: " + C.cGreen + _dogScore + "/" + dogScore + C.cGray + " - " + C.cRed + C.Bold
+ "Cats: " + C.cGreen + _catScore + "/" + catScore);
if(_catScore >= catScore)
if (_catScore >= catScore)
{
for(String player : _team.keySet())
for (String player : _team.keySet())
{
if(_team.get(player) == "cat")
if (_team.get(player) == "cat")
{
SetCompleted(Bukkit.getPlayer(player));
}
@ -202,11 +203,11 @@ public class ChallengeDogvsCat extends Challenge
}
}
}
else if(_dogScore >= dogScore)
else if (_dogScore >= dogScore)
{
for(String player : _team.keySet())
for (String player : _team.keySet())
{
if(_team.get(player) == "dog")
if (_team.get(player) == "dog")
{
SetCompleted(Bukkit.getPlayer(player));
}
@ -221,23 +222,23 @@ public class ChallengeDogvsCat extends Challenge
@EventHandler
public void onItemLeftClick(PlayerInteractEvent event)
{
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(!Host.IsAlive(event.getPlayer()))
if (!Host.IsAlive(event.getPlayer()))
{
return;
}
if(isCompleted(event.getPlayer()))
if (isCompleted(event.getPlayer()))
{
return;
}
if((event.getAction() == Action.LEFT_CLICK_AIR) || (event.getAction() == Action.LEFT_CLICK_BLOCK))
if ((event.getAction() == Action.LEFT_CLICK_AIR) || (event.getAction() == Action.LEFT_CLICK_BLOCK))
{
if(event.getPlayer().getItemInHand().getType() == Material.BONE || event.getPlayer().getItemInHand().getType() == Material.STRING)
if (event.getPlayer().getItemInHand().getType() == Material.BONE || event.getPlayer().getItemInHand().getType() == Material.STRING)
{
if(_team.get(event.getPlayer().getName()) == "cat")
if (_team.get(event.getPlayer().getName()) == "cat")
{
//_catScore++;
incrementCatScore();
@ -255,19 +256,19 @@ public class ChallengeDogvsCat extends Challenge
}
}
private void incrementCatScore()
{
int maxScore = calculateScore("cat");
if (_catScore < maxScore)
_catScore++;
}
private void incrementDogScore()
{
int maxScore = calculateScore("dog");
if (_dogScore < maxScore)
_dogScore++;
}
@ -276,9 +277,9 @@ public class ChallengeDogvsCat extends Challenge
{
int amountOnTeam = 0;
for(String playerName : _team.keySet())
for (String playerName : _team.keySet())
{
if(teamName == _team.get(playerName))
if (teamName == _team.get(playerName))
{
amountOnTeam++;
}

View File

@ -64,12 +64,12 @@ public class ChallengeTntLauncher extends Challenge
return;
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(),
4 + ((System.currentTimeMillis() - StartTime) / 10000D));
4 + ((System.currentTimeMillis() - getStartTime()) / 10000D));
for (Player player : players.keySet())
{
double mult = players.get(player) / 2;
mult += (System.currentTimeMillis() - StartTime) / 20000D;
mult += (System.currentTimeMillis() - getStartTime()) / 20000D;
// Knockback
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0,
@ -102,7 +102,7 @@ public class ChallengeTntLauncher extends Challenge
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false);
tnt.setFuseTicks((int) (60 * (1 - ((System.currentTimeMillis() - StartTime) / 70000))));
tnt.setFuseTicks((int) (60 * (1 - ((System.currentTimeMillis() - getStartTime()) / 70000))));
_tnt.add(tnt);
}

View File

@ -24,13 +24,13 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
@ -45,7 +45,7 @@ public class ChallengeVolleyPig extends Challenge
private long _blueSide;
private Entity _pig;
private HashMap<String, String> _playerTeams = new HashMap<String, String>();
private Location _redCenter = new Location(Host.WorldData.World, 0, 3, -5);
private Location _blueCenter = new Location(Host.WorldData.World, 0, 3, 5);
@ -86,15 +86,15 @@ public class ChallengeVolleyPig extends Challenge
for (Player player : getChallengers())
{
player.getInventory().setItem(0, new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).build());
if(player.getWorld().getBlockAt(player.getLocation().clone().add(0, -1, 0)).getType() == Material.STAINED_CLAY)
if (player.getWorld().getBlockAt(player.getLocation().clone().add(0, -1, 0)).getType() == Material.STAINED_CLAY)
{
Block clay = player.getWorld().getBlockAt(player.getLocation().clone().add(0, -1, 0));
if(clay.getData() == (byte)11)
if (clay.getData() == (byte) 11)
{
_playerTeams.put(player.getName(), "blue");
}
else if (clay.getData() == (byte)14)
else if (clay.getData() == (byte) 14)
{
_playerTeams.put(player.getName(), "red");
}
@ -108,7 +108,7 @@ public class ChallengeVolleyPig extends Challenge
Host.DamagePvE = true;
}
@Override
public int getMaxPlayers()
{
@ -135,15 +135,16 @@ public class ChallengeVolleyPig extends Challenge
Block bTo = to.getBlock();
if (bTo.getType() == Material.AIR || bTo.getData() != bFrom.getData())
{ // (z < 0 ? 11 : z > 0 ? 14 : 0)
{
String pName = event.getPlayer().getName();
Vector bump = UtilAlg.getAverageBump(event.getPlayer().getLocation(), new ArrayList<Location>(Arrays.asList(_playerTeams.get(pName) == "blue" ? _blueCenter : _redCenter)));
Vector bump = UtilAlg.getAverageBump(event.getPlayer().getLocation(),
new ArrayList<Location>(Arrays.asList(_playerTeams.get(pName) == "blue" ? _blueCenter : _redCenter)));
UtilAction.velocity(event.getPlayer(), bump, 0.8, false, 0, 0.4, 10, true);
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20*3, 1));
// setLost(event.getPlayer());
UtilPlayer.message(event.getPlayer(), F.main("Side Checker", "You crossed over to the enemy!"));
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 3, 1));
UtilTextMiddle.display(null, C.cRed + "You cannot cross to the enemy side.", 5, 40, 5, event.getPlayer());
// UtilPlayer.message(event.getPlayer(), F.main("Side Checker", "You crossed over to the enemy!"));
}
}
@ -193,9 +194,9 @@ public class ChallengeVolleyPig extends Challenge
displayProgress();
if (!_pig.isValid() || UtilTime.elapsed(StartTime, 30000) || _redSide > 10000 || _blueSide > 10000)
if (!_pig.isValid() || UtilTime.elapsed(getStartTime(), 30000) || _redSide > 10000 || _blueSide > 10000)
{
Duration = 0; // Instant game over
setDuration(0); // Instant game over
for (Player player : getChallengers())
{

View File

@ -17,28 +17,22 @@ public class MinewareKangarooAtHeart extends StatTracker<Game>
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChallengeEnd(ChallengeEndEvent event)
{
if(getGame().GetState() != GameState.Live)
{
if (getGame().GetState() != GameState.Live)
return;
}
Challenge challenge = event.getEndedChallenge();
if(!(challenge instanceof ChallengeKangarooJump))
{
if (!(challenge instanceof ChallengeKangarooJump))
return;
}
ChallengeKangarooJump kJump = (ChallengeKangarooJump) challenge;
for(Player player: kJump.getPlayerHeight().keySet())
{
if(!kJump.isLost(player))
{
for (Player player : kJump.getPlayerHeight().keySet())
if (!kJump.isLost(player))
addStat(player, "Kangaroo", 1, false, false);
}
}
}
}

View File

@ -15,49 +15,42 @@ import org.bukkit.event.EventPriority;
public class MinewareLauraCraftTracker extends StatTracker<Game>
{
private long _challengeStartTime;
private int _timeForCompletion = 8; // in seconds
private int _timeForCompletion = 8; // Measured in seconds.
public MinewareLauraCraftTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onMazeChallengeStart(ChallengeStartEvent event)
{
if(getGame().GetState() != GameState.Live)
{
if (getGame().GetState() != GameState.Live)
return;
}
Challenge challenge = event.getStartedChallenge();
if(!(challenge instanceof ChallengeNavigateMaze))
{
if (!(challenge instanceof ChallengeNavigateMaze))
return;
}
_challengeStartTime = System.currentTimeMillis();
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onMazeChallengeEnd(ChallengeEndEvent event)
{
if(getGame().GetState() != GameState.Live)
{
if (getGame().GetState() != GameState.Live)
return;
}
Challenge challenge = event.getEndedChallenge();
if(!(challenge instanceof ChallengeNavigateMaze))
{
if (!(challenge instanceof ChallengeNavigateMaze))
return;
}
ChallengeNavigateMaze challengeMaze = (ChallengeNavigateMaze) challenge;
for(Player player: challengeMaze.getPlayerTimes().keySet())
{
if(challengeMaze.getPlayerTimes().get(player) <= (_challengeStartTime+(_timeForCompletion*1000)))
{
for (Player player : challengeMaze.getPlayerTimes().keySet())
if (challengeMaze.getPlayerTimes().get(player) <= (_challengeStartTime + (_timeForCompletion * 1000)))
addStat(player, "LauraCraft", 1, false, false);
}
}
}
}

View File

@ -21,24 +21,23 @@ public class MinewareMilkManTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChallengeEnd(ChallengeEndEvent event)
{
if(getGame().GetState() != GameState.Live)
{
if (getGame().GetState() != GameState.Live)
return;
}
Challenge challenge = event.getEndedChallenge();
if(!(challenge instanceof ChallengeMilkACow))
{
if (!(challenge instanceof ChallengeMilkACow))
return;
}
ChallengeMilkACow milk = (ChallengeMilkACow) challenge;
for(Player player : milk.getScore().keySet())
for (Player player : milk.getScore().keySet())
{
int score = milk.getScore().get(player);
if(!player.isOnline())
{
if (!player.isOnline())
continue;
}
addStat(player, "MilkMan", score, false, false);
}
}

View File

@ -17,29 +17,22 @@ public class MinewarePinataMasterTracker extends StatTracker<Game>
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChallengeEnd(ChallengeEndEvent event)
{
if(getGame().GetState() != GameState.Live)
{
if (getGame().GetState() != GameState.Live)
return;
}
Challenge challenge = event.getEndedChallenge();
if(!(challenge instanceof ChallengeShootChickens))
{
if (!(challenge instanceof ChallengeShootChickens))
return;
}
ChallengeShootChickens chickChallenge = (ChallengeShootChickens) challenge;
for(Player player: chickChallenge.getArrowsShot().keySet())
{
if(chickChallenge.getArrowsShot().get(player) == 6 && challenge.isCompleted(player))
{
for (Player player : chickChallenge.getArrowsShot().keySet())
if (chickChallenge.getArrowsShot().get(player) == 6 && challenge.isCompleted(player))
addStat(player, "PinataMaster", 1, true, false);
}
}
}
}

View File

@ -17,31 +17,27 @@ public class MinewareSurfUpTracker extends StatTracker<Game>
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChallengeEnd(ChallengeEndEvent event)
{
if(getGame().GetState() != GameState.Live)
{
if (getGame().GetState() != GameState.Live)
return;
}
Challenge challenge = event.getEndedChallenge();
if(!(challenge instanceof ChallengeWaveCrush))
{
if (!(challenge instanceof ChallengeWaveCrush))
return;
}
ChallengeWaveCrush wave = (ChallengeWaveCrush) challenge;
for(Player player: wave.getsurvivedwaves().keySet())
for (Player player : wave.getsurvivedwaves().keySet())
{
int survivedWavesAmount = wave.getsurvivedwaves().get(player);
if(survivedWavesAmount < 1)
{
if (survivedWavesAmount < 1)
continue;
}
addStat(player, "SurfUp", survivedWavesAmount, false, false);
}
}

View File

@ -17,29 +17,25 @@ public class MinewareTagMasterTracker extends StatTracker<Game>
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameEnd(ChallengeEndEvent event)
{
if(getGame().GetState() != GameState.Live)
{
if (getGame().GetState() != GameState.Live)
return;
}
Challenge challenge = event.getEndedChallenge();
if(!(challenge instanceof ChallengeReverseTag))
{
if (!(challenge instanceof ChallengeReverseTag))
return;
}
ChallengeReverseTag tag = (ChallengeReverseTag) challenge;
for(Player player: tag.getNonTaggedPlayers())
for (Player player : tag.getNonTaggedPlayers())
{
if(tag.isLost(player))
{
if (tag.isLost(player))
return;
}
addStat(player, "TagMaster", 1, true, false);
}
}

View File

@ -15,16 +15,12 @@ public class MinewareVeteranTracker extends StatTracker<Game>
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void tracePlayerWin(GameStateChangeEvent event)
{
if (event.GetState() == GameState.End)
{
for (Player player: getGame().getWinners())
{
for (Player player : getGame().getWinners())
addStat(player, "Veteran", 1, true, false);
}
}
}
}