Block Hunt winners fix (team/solo)

This commit is contained in:
Chiss 2014-09-05 17:29:23 +10:00
parent abc95853f7
commit 4e94bcfd98
4 changed files with 51 additions and 30 deletions

View File

@ -109,7 +109,7 @@ public class CompassAddon extends MiniPlugin
" " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) +
" " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff));
stack.setItemMeta(itemMeta);
player.getInventory().setItem(i, stack);
}
}

View File

@ -24,9 +24,9 @@ import org.bukkit.entity.Player;
public class GameTeam
{
private Game Host;
private double _respawnTime = 0;
public enum PlayerState
{
IN("In", ChatColor.GREEN),
@ -66,14 +66,14 @@ public class GameTeam
private int _spawnDistance = 0;
private boolean _visible = true;
//Records order players go out in
protected ArrayList<Player> _places = new ArrayList<Player>();
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns)
{
Host = host;
_name = name;
_color = color;
_spawns = spawns;
@ -96,7 +96,7 @@ public class GameTeam
public Location GetSpawn()
{
// ArrayList<Location> valid = new ArrayList<Location>();
// ArrayList<Location> valid = new ArrayList<Location>();
Location best = null;
double bestDist = 0;
@ -119,14 +119,14 @@ public class GameTeam
bestDist = closestPlayer;
}
// if (closestPlayer > _spawnDistance * _spawnDistance)
// {
// valid.add(loc);
// }
// if (closestPlayer > _spawnDistance * _spawnDistance)
// {
// valid.add(loc);
// }
}
// if (valid.size() > 0)
// valid.get(UtilMath.r(valid.size()));
// if (valid.size() > 0)
// valid.get(UtilMath.r(valid.size()));
if (best != null)
return best;
@ -228,7 +228,7 @@ public class GameTeam
{
SpawnTeleport(true);
}
public void SpawnTeleport(boolean aliveOnly)
{
for (Player player : GetPlayers(aliveOnly))
@ -342,7 +342,7 @@ public class GameTeam
{
_respawnTime = i;
}
public double GetRespawnTime()
{
return _respawnTime;
@ -351,32 +351,33 @@ public class GameTeam
public void SetPlacement(Player player, PlayerState state)
{
if (state == PlayerState.OUT)
{
if (!_places.contains(player))
_places.add(0, player);
else
_places.remove(player);
_places.add(0, player);
}
else
_places.remove(player);
}
public ArrayList<Player> GetPlacements(boolean includeAlivePlayers)
{
if (includeAlivePlayers)
{
ArrayList<Player> placesClone = new ArrayList<Player>();
for (Player player : _places)
{
placesClone.add(player);
}
for (Player player : GetPlayers(true))
{
placesClone.add(0, player);
}
return placesClone;
}
return _places;
}
}

View File

@ -73,6 +73,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.hideseek.forms.BlockForm;
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
import nautilus.game.arcade.game.games.hideseek.forms.Form;
@ -958,6 +959,10 @@ public class HideSeek extends TeamGame
public void SetSeeker(Player player, boolean forced)
{
GameTeam pastTeam = GetTeam(player);
if (pastTeam != null && pastTeam.equals(_hiders))
pastTeam.SetPlacement(player, PlayerState.OUT);
SetPlayerTeam(player, _seekers, true);
Manager.GetDisguise().undisguise(player);
@ -1011,12 +1016,25 @@ public class HideSeek extends TeamGame
if (_hiders.GetPlayers(true).isEmpty())
{
SetState(GameState.End);
AnnounceEnd(_seekers);
ArrayList<Player> places = _hiders.GetPlacements(true);
AnnounceEnd(_hiders.GetPlacements(true));
//Gems
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
}
}
@ -1084,8 +1102,7 @@ public class HideSeek extends TeamGame
if (timeLeft <= 0)
{
WriteScoreboard();
SetState(GameState.End);
AnnounceEnd(_hiders);
for (Player player : _hiders.GetPlayers(true))
@ -1094,6 +1111,8 @@ public class HideSeek extends TeamGame
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
}
}
}

View File

@ -108,7 +108,7 @@ public class MineStrike extends TeamGame
private int _roundsToWin = 10;
private long _roundTime = 120000;
private boolean _debug = true;
private boolean _debug = false;
private int _bulletInstant = 2; //0 = Slow, 1 = Instant, 2 = Mix
private boolean _customHitbox = true;
private boolean _bulletAlternate = false;
@ -185,12 +185,13 @@ public class MineStrike extends TeamGame
this._help = new String[]
{
//"Tap Crouch when close to an ally to Boost",
"Open Inventory at spawn to buy guns",
"Hold Right-Click to Plant Bomb",
"Hold Right-Click with knife to Defuse Bomb",
"Moving decreases accuracy",
"Sprinting heavily decreases accuracy",
"Jumping massively decreases accuracy",
"Crouching increases accuracy",
"Hold Right-Click to Plant Bomb",
"Hold Right-Click with knife to Defuse Bomb",
"Left-Click to roll Grenades",
"Right-Click to throw Grenades",
"Burst Fire for greater accuracy",