Fix teleport delay and incorrect win placement.
Players that die during a challenge have the ability to fly around as spectators. Although, once the challenge was ended their fly mode was removed and they would fall for a very short amount of time, which was noticeable. With that fix, players now get reset once they are teleported to the spawn locations of the next challenge. That happened because during the player reset and spawn teleportation, the map would be generated, as a result, causing a very small notable delay. Moreover, win placement was fixed. In the previous version, the third player would appear as second and the second player would appear as the third one. The cause of this issue was that, after the second and the third player is added to the winner list, the last player that is remaining alive is added as first. To fix that, I've implemented a swap method that changes the location of the second with the third player.
This commit is contained in:
parent
cc68b7087a
commit
0b780c8e99
@ -76,7 +76,6 @@ import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeList;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.other.ChallengeSeperateRooms;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeAnvilDance;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeArrowRampage;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBlockLobbers;
|
||||
@ -156,13 +155,13 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
private String _skipCommand = "skip";
|
||||
private String _markCommand = "mark";
|
||||
|
||||
List<String> _countdown = Arrays.asList(
|
||||
private List<String> _countdown = Arrays.asList(
|
||||
C.cRed + C.Bold + "3",
|
||||
C.cYellow + C.Bold + "2",
|
||||
C.cGreen + C.Bold + "1",
|
||||
C.cWhite + C.Bold + "GO!");
|
||||
|
||||
/**
|
||||
/*
|
||||
* TODO: Bugs
|
||||
*
|
||||
* - Small delay on spectator reset?
|
||||
@ -190,6 +189,8 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
"Last player with lives wins!"
|
||||
});
|
||||
|
||||
_settings.setMaxLives(2);
|
||||
|
||||
// Damage = false;
|
||||
DamagePvP = false;
|
||||
DamagePvE = false;
|
||||
@ -345,7 +346,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
_challenge = selectChallenge();
|
||||
|
||||
resetPlayers();
|
||||
keepSearchingWhenNull();
|
||||
resetLastChallengeMap();
|
||||
|
||||
@ -358,14 +358,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
_challenge.markSpawnLocations();
|
||||
|
||||
teleportPlayersToSpawnpoints();
|
||||
resetPlayers();
|
||||
teleportSpectatorsToSpawn();
|
||||
|
||||
if (_challenge instanceof ChallengeSeperateRooms)
|
||||
{
|
||||
ChallengeSeperateRooms challengeWithRooms = (ChallengeSeperateRooms) _challenge;
|
||||
challengeWithRooms.assignRooms();
|
||||
}
|
||||
|
||||
_delay = System.currentTimeMillis();
|
||||
_settings.setWaiting(true);
|
||||
}
|
||||
@ -579,18 +574,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (_challenge instanceof ChallengeSeperateRooms)
|
||||
{
|
||||
UtilTextTop.display(C.cYellow + C.Bold + _challenge.getDescription()[0], player);
|
||||
player.setLevel(_challenge.getRemainingPlaces());
|
||||
player.setExp(_challenge.getTimeLeftPercent());
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilTextTop.displayTextBar(player, _challenge.getTimeLeftPercent(), C.cYellow + C.Bold + _challenge.getName());
|
||||
player.setLevel(_challenge.getRemainingPlaces());
|
||||
player.setExp(_challenge.getTimeLeftPercent());
|
||||
}
|
||||
UtilTextTop.displayTextBar(player, _challenge.getTimeLeftPercent(), C.cYellow + C.Bold + _challenge.getName());
|
||||
player.setLevel(_challenge.getRemainingPlaces());
|
||||
player.setExp(_challenge.getTimeLeftPercent());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1492,8 +1478,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (living <= 1)
|
||||
{
|
||||
_winners.add(0, getChallengers().get(0));
|
||||
|
||||
// Collections.reverse(_winners);
|
||||
Collections.swap(_winners, 2, 1);
|
||||
|
||||
if (_winners.size() >= 1)
|
||||
{
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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;
|
||||
@ -94,37 +93,37 @@ public class ChallengeNavigationMaze extends Challenge
|
||||
addBlock(block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ArrayList<Block> mazeBlocks = generateMaze();
|
||||
|
||||
|
||||
for (Block mazeBlock : mazeBlocks)
|
||||
{
|
||||
addBlock(mazeBlock);
|
||||
}
|
||||
|
||||
// for (int i = 0; i < 30; i++)
|
||||
// {
|
||||
// ArrayList<Block> mazeBlocks = generateMaze();
|
||||
//
|
||||
// if (isMazeValid())
|
||||
// {
|
||||
// for (Block mazeBlock : mazeBlocks)
|
||||
// {
|
||||
// addBlock(mazeBlock);
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// System.out.print("Generated bad maze, trying again..");
|
||||
//
|
||||
// for (Block mazeBlock : mazeBlocks)
|
||||
// {
|
||||
// mazeBlock.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for (int i = 0; i < 30; i++)
|
||||
// {
|
||||
// ArrayList<Block> mazeBlocks = generateMaze();
|
||||
//
|
||||
// if (isMazeValid())
|
||||
// {
|
||||
// for (Block mazeBlock : mazeBlocks)
|
||||
// {
|
||||
// addBlock(mazeBlock);
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// System.out.print("Generated bad maze, trying again..");
|
||||
//
|
||||
// for (Block mazeBlock : mazeBlocks)
|
||||
// {
|
||||
// mazeBlock.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -164,22 +163,21 @@ public class ChallengeNavigationMaze extends Challenge
|
||||
{
|
||||
Block block = nextLoop.remove(0);
|
||||
|
||||
for (BlockFace face : new BlockFace[] {
|
||||
BlockFace.EAST,
|
||||
BlockFace.WEST,
|
||||
BlockFace.SOUTH,
|
||||
BlockFace.NORTH
|
||||
})
|
||||
for (BlockFace face : new BlockFace[] { BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH })
|
||||
{
|
||||
Block b = block.getRelative(face);
|
||||
|
||||
if (blocks.contains(b))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
blocks.add(b);
|
||||
|
||||
if (b.getType() == Material.STONE || b.getX() < getCenter().getX() + -14 || b.getZ() < getCenter().getZ() + -12 || b.getZ() > getCenter().getZ() + 15)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (b.getX() >= getCenter().getX() + 15)
|
||||
{
|
||||
@ -199,12 +197,6 @@ public class ChallengeNavigationMaze extends Challenge
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
int[][] maze = new MazeGenerator(11, 10).getMaze();
|
||||
|
||||
// Divisable by 2's are up and down walls
|
||||
// Other's are left and right. All walls have a corner block.
|
||||
|
||||
// This means I need to loop over all of the blocks, figure out if its a corner if yes then set block
|
||||
// Else if its a wall, then figure out if I'm making the wall or not
|
||||
|
||||
for (int x = 1; x < 11; x++)
|
||||
{
|
||||
for (int z = 1; z < 10; z++)
|
||||
@ -223,7 +215,6 @@ public class ChallengeNavigationMaze extends Challenge
|
||||
blocks.add(block);
|
||||
}
|
||||
|
||||
// Set blocks for x
|
||||
if (x < 10 && (maze[x][z] & 8) == 0)
|
||||
{
|
||||
for (int i = 1; i <= 2; i++)
|
||||
@ -243,7 +234,6 @@ public class ChallengeNavigationMaze extends Challenge
|
||||
|
||||
}
|
||||
|
||||
// Set blocks for z
|
||||
if ((maze[x][z] & 1) == 0)
|
||||
{
|
||||
for (int i = 1; i <= 2; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user