Fix Bawk Bawk Battles game start

This commit is contained in:
Thanos Paravantis 2016-07-14 11:23:39 +03:00
parent 906762e9db
commit 40345bc93c
3 changed files with 101 additions and 108 deletions

View File

@ -85,7 +85,6 @@ import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeColorCha
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDeadlyTnt; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDeadlyTnt;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDiamondHunt; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeDiamondHunt;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeEggSmash; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeEggSmash;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeEmpty;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFallingBlocks; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFallingBlocks;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFastFood; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeFastFood;
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKangarooJump; import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKangarooJump;
@ -184,7 +183,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
private static final float SPECTATOR_KNOCKBACK_SOUND_VOLUME = 2.0F; private static final float SPECTATOR_KNOCKBACK_SOUND_VOLUME = 2.0F;
private static final float SPECTATOR_KNOCKBACK_SOUND_PITCH = 0.5F; private static final float SPECTATOR_KNOCKBACK_SOUND_PITCH = 0.5F;
private static final int MIN_PLAYERS_BLOCK_ATTEMPT = 1;
private static final int GENERIC_SCOREBOARD_PLAYER_COUNT = 15; private static final int GENERIC_SCOREBOARD_PLAYER_COUNT = 15;
private static final int LOST_ONE_LIFE = MAX_LIVES - 1; private static final int LOST_ONE_LIFE = MAX_LIVES - 1;
@ -380,8 +378,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
} }
private Challenge selectChallenge() private Challenge selectChallenge()
{
if (GetPlayers(false).size() > MIN_PLAYERS_BLOCK_ATTEMPT)
{ {
int limit = _list.size(); int limit = _list.size();
int attemps = 0; int attemps = 0;
@ -404,11 +400,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
return instance; return instance;
} }
else
{
return new ChallengeEmpty(this);
}
}
private boolean isSuitable(Challenge instance) private boolean isSuitable(Challenge instance)
{ {
@ -1215,21 +1206,21 @@ public class BawkBawkBattles extends TeamGame implements IThrown
_winners.remove(player); _winners.remove(player);
} }
@EventHandler // @EventHandler
public void blockStartAttempt(UpdateEvent event) // public void blockStartAttempt(UpdateEvent event)
{ // {
if (event.getType() != UpdateType.TICK) // if (event.getType() != UpdateType.TICK)
return; // return;
//
// If there is only 1 player and the game starts, do not teleport him to the map. // // If there is only 1 player and the game starts, do not teleport him to the map.
//
if (GetState() == GameState.Recruit && GetCountdown() >= 0 && GetPlayers(false).size() <= MIN_PLAYERS_BLOCK_ATTEMPT) // if (GetState() == GameState.Recruit && GetCountdown() >= 0 && GetPlayers(false).size() <= MIN_PLAYERS_BLOCK_ATTEMPT)
{ // {
UtilServer.broadcast(F.main("Game", C.cRed + "This game requires at least 2 players to start.")); // UtilServer.broadcast(F.main("Game", C.cRed + "This game requires at least 2 players to start."));
SetCountdown(-1); // SetCountdown(-1);
Manager.GetLobby().DisplayWaiting(); // Manager.GetLobby().DisplayWaiting();
} // }
} // }
/* /*
* Miscellaneous * Miscellaneous

View File

@ -8,7 +8,7 @@ import org.bukkit.Location;
public class ChallengeSettings public class ChallengeSettings
{ {
private Challenge _challenge; private Challenge _challenge;
private int _minPlayers = 2; private int _minPlayers = 1;
private int _maxPlayers = 250; private int _maxPlayers = 250;
private int _maxCompletedCount; private int _maxCompletedCount;
private long _startTime; private long _startTime;

View File

@ -12,6 +12,8 @@ import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
/** /**
* This challenge is used to prevent the game from crashing if it's forced to start with only one player. * This challenge is used to prevent the game from crashing if it's forced to start with only one player.
*
* @deprecated
*/ */
public class ChallengeEmpty extends Challenge public class ChallengeEmpty extends Challenge
{ {