Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
d82396d59b
@ -77,8 +77,13 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
|
||||
|
||||
_donationManager = new DonationManager(this, GetWebServerAddress());
|
||||
|
||||
<<<<<<< HEAD
|
||||
PreferencesManager preferences = new PreferencesManager(this, _clientManager, _donationManager);
|
||||
new MessageManager(this, _clientManager, preferences);
|
||||
=======
|
||||
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
||||
new MessageManager(this, _clientManager, preferenceManager);
|
||||
>>>>>>> 0bf702902e17516316ac3453297110af4cfdec5f
|
||||
|
||||
AntiStack antistack = new AntiStack(this);
|
||||
|
||||
@ -98,7 +103,11 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
|
||||
AntiHack.Initialize(this, punish, portal);
|
||||
|
||||
//Arcade Manager
|
||||
<<<<<<< HEAD
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferences, GetWebServerAddress());
|
||||
=======
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, GetWebServerAddress());
|
||||
>>>>>>> 0bf702902e17516316ac3453297110af4cfdec5f
|
||||
|
||||
new MemoryFix(this);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class GameFactory
|
||||
|
||||
public GameFactory(ArcadeManager gameManager)
|
||||
{
|
||||
_manager = gameManager;
|
||||
_manager = gameManager;
|
||||
}
|
||||
|
||||
public Game CreateGame(GameType gameType, HashMap<String, ChatColor> pastTeams)
|
||||
|
@ -27,6 +27,7 @@ import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.managers.GameLobbyManager;
|
||||
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -96,8 +97,7 @@ public abstract class Game implements Listener
|
||||
private NautHashMap<String, Location> _playerLocationStore = new NautHashMap<String, Location>();
|
||||
|
||||
//Scoreboard
|
||||
private Scoreboard _scoreboard;
|
||||
private Objective _sideObjective;
|
||||
protected GameScoreboard Scoreboard;
|
||||
|
||||
//Loaded from Map Config
|
||||
public WorldData WorldData = null;
|
||||
@ -210,13 +210,9 @@ public abstract class Game implements Listener
|
||||
|
||||
//Kits
|
||||
_kits = kits;
|
||||
|
||||
|
||||
//Scoreboard
|
||||
_scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
|
||||
_sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy");
|
||||
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
_sideObjective.setDisplayName(C.Bold + GetName());
|
||||
Scoreboard = new GameScoreboard(this);
|
||||
|
||||
//Map Select
|
||||
_files = Manager.LoadFiles(GetName());
|
||||
@ -272,14 +268,14 @@ public abstract class Game implements Listener
|
||||
_customWinLine = line;
|
||||
}
|
||||
|
||||
public Scoreboard GetScoreboard()
|
||||
public GameScoreboard GetScoreboard()
|
||||
{
|
||||
return _scoreboard;
|
||||
return Scoreboard;
|
||||
}
|
||||
|
||||
public Objective GetObjectiveSide()
|
||||
{
|
||||
return _sideObjective;
|
||||
return Scoreboard.GetObjectiveSide();
|
||||
}
|
||||
|
||||
public ArrayList<GameTeam> GetTeamList()
|
||||
@ -384,42 +380,7 @@ public abstract class Game implements Listener
|
||||
return false;
|
||||
}
|
||||
|
||||
public void CreateScoreboardTeams()
|
||||
{
|
||||
System.out.println("Creating Scoreboard Teams.");
|
||||
|
||||
//Base Groups
|
||||
for (Rank rank : Rank.values())
|
||||
{
|
||||
//Spectator
|
||||
if (rank == Rank.ALL)
|
||||
{
|
||||
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
|
||||
}
|
||||
else
|
||||
{
|
||||
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
|
||||
//_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY);
|
||||
}
|
||||
}
|
||||
|
||||
//Team Groups
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
for (Rank rank : Rank.values())
|
||||
{
|
||||
if (rank == Rank.ALL)
|
||||
{
|
||||
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
|
||||
}
|
||||
else
|
||||
{
|
||||
//_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor());
|
||||
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void RestrictKits()
|
||||
{
|
||||
@ -455,8 +416,6 @@ public abstract class Game implements Listener
|
||||
//Use this to parse in extra location data from maps
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetPlayerTeam(Player player, GameTeam team)
|
||||
{
|
||||
//Clean Old Team
|
||||
@ -472,23 +431,12 @@ public abstract class Game implements Listener
|
||||
ValidateKit(player, team);
|
||||
|
||||
//Game Scoreboard
|
||||
SetPlayerScoreboardTeam(player, team.GetName().toUpperCase());
|
||||
Scoreboard.SetPlayerTeam(player, team.GetName().toUpperCase());
|
||||
|
||||
//Lobby Scoreboard
|
||||
Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase());
|
||||
}
|
||||
|
||||
public void SetPlayerScoreboardTeam(Player player, String teamName)
|
||||
{
|
||||
for (Team team : GetScoreboard().getTeams())
|
||||
team.removePlayer(player);
|
||||
|
||||
if (teamName == null)
|
||||
teamName = "";
|
||||
|
||||
GetScoreboard().getTeam(Manager.GetClients().Get(player).GetRank().Name + teamName).addPlayer(player);
|
||||
}
|
||||
|
||||
public GameTeam ChooseTeam(Player player)
|
||||
{
|
||||
GameTeam team = null;
|
||||
@ -629,7 +577,7 @@ public abstract class Game implements Listener
|
||||
|
||||
public boolean SetPlayerState(Player player, PlayerState state)
|
||||
{
|
||||
GetScoreboard().resetScores(player.getName());
|
||||
GetScoreboard().ResetScore(player.getName());
|
||||
|
||||
GameTeam team = GetTeam(player);
|
||||
|
||||
@ -795,12 +743,7 @@ public abstract class Game implements Listener
|
||||
|
||||
Manager.GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true);
|
||||
|
||||
if (GetTeam(player) != null && _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()) != null)
|
||||
{
|
||||
_scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()).removePlayer(player);
|
||||
}
|
||||
|
||||
SetPlayerScoreboardTeam(player, "SPEC");
|
||||
Scoreboard.SetPlayerTeam(player, "SPEC");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -816,21 +759,7 @@ public abstract class Game implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
String name = team.GetColor() + team.GetName();
|
||||
if (name.length() > 16)
|
||||
name = name.substring(0, 16);
|
||||
|
||||
Score score = GetObjectiveSide().getScore(name);
|
||||
score.setScore(team.GetPlayers(true).size());
|
||||
}
|
||||
}
|
||||
public abstract void ScoreboardUpdate(UpdateEvent event);
|
||||
|
||||
public DeathMessageType GetDeathMessageType()
|
||||
{
|
||||
|
@ -95,10 +95,44 @@ public abstract class SoloGame extends Game
|
||||
if (GetTeamList().isEmpty())
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
GameTeam team = GetTeamList().get(0);
|
||||
|
||||
GetObjectiveSide().getScore(team.GetColor() + "Alive").setScore(team.GetPlayers(true).size());
|
||||
GetObjectiveSide().getScore(C.cRed + "Dead").setScore(team.GetPlayers(false).size() - team.GetPlayers(true).size());
|
||||
|
||||
if (team.GetPlayers(false).size() < 16)
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
{
|
||||
if (team.IsAlive(player))
|
||||
{
|
||||
Scoreboard.Write(C.cGreen + player.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cGray + player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (team.GetPlayers(true).size() < 16)
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(C.cGreen + player.getName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cGreen + "Players Alive");
|
||||
Scoreboard.Write("" + team.GetPlayers(true).size());
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cRed + "Players Dead");
|
||||
Scoreboard.Write("" + (team.GetPlayers(false).size() - team.GetPlayers(true).size()));
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
public ArrayList<Player> GetPlaces()
|
||||
|
@ -188,4 +188,37 @@ public abstract class TeamGame extends Game
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event != null && event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
//Display Individual Players
|
||||
if (this.GetPlayers(true).size() < 16)
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(team.GetColor() + player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
//Display Players Alive
|
||||
else
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(team.GetColor() + team.GetName());
|
||||
Scoreboard.Write("" + team.GetPlayers(true).size());
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
}
|
||||
|
@ -1056,23 +1056,13 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Display Players Alive
|
||||
if (!_tournament)
|
||||
{
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
String out = team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName();
|
||||
if (out.length() > 16)
|
||||
out = out.substring(0, 16);
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
Score score = GetObjectiveSide().getScore(out);
|
||||
score.setScore(team.GetPlayers(true).size());
|
||||
}
|
||||
super.ScoreboardUpdate(event);
|
||||
return;
|
||||
}
|
||||
//Display Kills + Players
|
||||
else
|
||||
@ -1083,18 +1073,15 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
if (_tournamentKills.containsKey(team))
|
||||
kills = _tournamentKills.get(team);
|
||||
|
||||
String out = kills + " " + team.GetColor() + team.GetPlayers(true).size() + " " + team.GetName();
|
||||
if (out.length() > 16)
|
||||
out = out.substring(0, 16);
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
if (kills == 0)
|
||||
kills = -1;
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Score score = GetObjectiveSide().getScore(out);
|
||||
score.setScore(kills);
|
||||
Scoreboard.Write(team.GetColor() + C.Bold + team.GetName());
|
||||
Scoreboard.Write(team.GetColor() + " " + team.GetPlayers(true).size() + " Players");
|
||||
Scoreboard.Write(team.GetColor() + " " + kills + " Kills");
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -409,82 +409,25 @@ public class CastleSiege extends TeamGame
|
||||
}
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
|
||||
int line = 1;
|
||||
String space = " ";
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Teams
|
||||
for (String group : _scoreGroup.keySet())
|
||||
{
|
||||
//Score
|
||||
String out = ChatColor.getLastColors(group) + _scoreGroup.get(group) + " Players";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Team
|
||||
out = group;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Space
|
||||
space += " ";
|
||||
out = space;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(group);
|
||||
Scoreboard.Write(ChatColor.getLastColors(group) + _scoreGroup.get(group) + " Players");
|
||||
}
|
||||
|
||||
//King
|
||||
if (_king != null && _king.isValid())
|
||||
{
|
||||
//Score
|
||||
String out = _kingHealth + " Health";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Text
|
||||
out = C.cYellow + C.Bold + "King";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
|
||||
//Space
|
||||
space += " ";
|
||||
out = space;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(line++);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "King");
|
||||
Scoreboard.Write(_kingHealth + " Health");
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,8 +63,8 @@ public class ChampionsTDM extends TeamGame
|
||||
|
||||
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
|
||||
|
||||
_healthObj = GetScoreboard().registerNewObjective("HP", "dummy");
|
||||
_healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
//_healthObj = GetScoreboard().registerNewObjective("HP", "dummy");
|
||||
//_healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -99,7 +99,7 @@ public class ChampionsTDM extends TeamGame
|
||||
|
||||
_kills.put(killer, kills);
|
||||
|
||||
ScoreboardRefresh();
|
||||
ScoreboardUpdate(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,58 +117,6 @@ public class ChampionsTDM extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (!InProgress())
|
||||
return;
|
||||
|
||||
ScoreboardRefresh();
|
||||
}
|
||||
|
||||
public void ScoreboardRefresh()
|
||||
{
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
|
||||
int pos = 1;
|
||||
String space = " ";
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
{
|
||||
int kills = 0;
|
||||
if (_kills.containsKey(player))
|
||||
kills = _kills.get(player);
|
||||
|
||||
String out = kills + " ";
|
||||
|
||||
if (IsAlive(player))
|
||||
out += team.GetColor() + player.getName();
|
||||
else
|
||||
out += C.cGray + player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(pos++);
|
||||
}
|
||||
|
||||
GetObjectiveSide().getScore(space).setScore(pos++);
|
||||
|
||||
space += " ";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||
{
|
||||
|
@ -498,87 +498,27 @@ public class Christmas extends SoloGame
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
|
||||
int index = 15;
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Rounds
|
||||
String out = " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cWhite + "Challenge:";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cYellow + (5 - _parts.size()) + " of " + 5;
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Challenge:");
|
||||
Scoreboard.Write(C.cYellow + (5 - _parts.size()) + " of " + 5);
|
||||
|
||||
//Presents
|
||||
out = " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cWhite + "Presents:";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cYellow + GetSleigh().GetPresents().size() + " of " + 10;
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Presents:");
|
||||
Scoreboard.Write(C.cYellow + GetSleigh().GetPresents().size() + " of " + 10);
|
||||
|
||||
//Players
|
||||
out = " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cWhite + "Players:";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cYellow + GetPlayers(true).size();
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Players:");
|
||||
Scoreboard.Write(C.cYellow + GetPlayers(true).size());
|
||||
|
||||
//Time
|
||||
out = " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cWhite + "Time Left:";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cYellow + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime()));
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Time Left:");
|
||||
Scoreboard.Write(C.cYellow + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,13 +2,11 @@ package nautilus.game.arcade.game.games.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -18,7 +16,6 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.elo.EloPlayer;
|
||||
import mineplex.core.elo.EloTeam;
|
||||
@ -49,9 +46,6 @@ public class Domination extends TeamGame
|
||||
//Stats
|
||||
private HashMap<String, PlayerData> _stats = new HashMap<String, PlayerData>();
|
||||
|
||||
//Scoreboard
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
//Scores
|
||||
private int _victoryScore = 15000;
|
||||
private int _redScore = 0;
|
||||
@ -62,7 +56,7 @@ public class Domination extends TeamGame
|
||||
super(manager, type, kits,
|
||||
|
||||
new String[]
|
||||
{
|
||||
{
|
||||
"Capture Beacons for Points",
|
||||
"+500 Points for Emerald Powerups",
|
||||
"+50 Points for Kills",
|
||||
@ -70,7 +64,6 @@ public class Domination extends TeamGame
|
||||
|
||||
});
|
||||
|
||||
|
||||
this.DeathOut = false;
|
||||
this.PrepareFreeze = true;
|
||||
this.HungerSet = 20;
|
||||
@ -223,37 +216,26 @@ public class Domination extends TeamGame
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(string);
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Scores
|
||||
String redScore = _redScore + C.cRed + C.Bold + " Red";
|
||||
_lastScoreboard.add(redScore);
|
||||
GetObjectiveSide().getScore(redScore).setScore(8);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cRed + "Red Team");
|
||||
Scoreboard.Write(C.cRed + _redScore);
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cAqua + "Blue Team");
|
||||
Scoreboard.Write(C.cAqua + _blueScore);
|
||||
|
||||
String blueScore = _blueScore + C.cAqua + C.Bold + " Blue";
|
||||
_lastScoreboard.add(blueScore);
|
||||
GetObjectiveSide().getScore(blueScore).setScore(7);
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
_lastScoreboard.add(" ");
|
||||
GetObjectiveSide().getScore(" ").setScore(6);
|
||||
|
||||
//Write New
|
||||
//Write CPs
|
||||
for (int i=0 ; i<_points.size() ; i++)
|
||||
{
|
||||
CapturePoint cp = _points.get(i);
|
||||
|
||||
String out = cp.GetScoreboardName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(5 - i);
|
||||
Scoreboard.Write(_points.get(i).GetScoreboardName());
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
public void EndCheckScore()
|
||||
|
@ -291,13 +291,11 @@ public class DragonEscape extends SoloGame
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
|
||||
SortScores();
|
||||
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Write New
|
||||
for (int i=0 ; i<_ranks.size() && i<15 ; i++)
|
||||
{
|
||||
@ -307,15 +305,10 @@ public class DragonEscape extends SoloGame
|
||||
if (!IsAlive(score.Player))
|
||||
col = ChatColor.RED;
|
||||
|
||||
String out = i+1 + " " + col + score.Player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(16-i);
|
||||
Scoreboard.WriteOrdered("Rank", col + score.Player.getName(), i+1, true);
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -365,48 +365,20 @@ public class DragonEscapeTeams extends TeamGame
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
int i=1;
|
||||
String space = " ";
|
||||
HashMap<GameTeam, Double> scores = GetTeamScores();
|
||||
for (GameTeam team : scores.keySet())
|
||||
{
|
||||
//Time
|
||||
int score = scores.get(team).intValue();
|
||||
|
||||
String out = team.GetColor() + "" + score;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(i++);
|
||||
|
||||
//Team
|
||||
out = team.GetColor() + C.Bold + team.GetName() + " Score";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(i++);
|
||||
|
||||
//Space
|
||||
space += " ";
|
||||
out = space;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(i++);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(team.GetColor() + team.GetName());
|
||||
Scoreboard.Write(team.GetColor() + "" + score);
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -250,9 +250,7 @@ public class DragonsTeams extends TeamGame
|
||||
private void WriteScoreboard()
|
||||
{
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
int i=1;
|
||||
String space = " ";
|
||||
@ -261,36 +259,12 @@ public class DragonsTeams extends TeamGame
|
||||
//Time
|
||||
int seconds = _teamScore.get(team);
|
||||
|
||||
String out = team.GetColor() + "" + seconds + " Seconds";
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(i++);
|
||||
|
||||
//Team
|
||||
out = team.GetColor() + C.Bold + team.GetName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(i++);
|
||||
|
||||
//Space
|
||||
space += " ";
|
||||
out = space;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(i++);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(team.GetColor() + team.GetName());
|
||||
Scoreboard.Write(team.GetColor() + "" + seconds + " Seconds");
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +49,6 @@ import nautilus.game.arcade.kit.Kit;
|
||||
public class Draw extends SoloGame
|
||||
{
|
||||
private ArrayList<GameScore> _ranks = new ArrayList<GameScore>();
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
private GameTeam _drawers = null;
|
||||
private GameTeam _guessers = null;
|
||||
@ -612,87 +611,33 @@ public class Draw extends SoloGame
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
|
||||
SortScores();
|
||||
|
||||
int index = 15;
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Rounds
|
||||
String out = C.cRed + " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cRed + " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cWhite + "Round:";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cYellow + Math.min(_roundCount+1, _roundMax) + " of " + _roundMax;
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Round:");
|
||||
Scoreboard.Write(C.cYellow + Math.min(_roundCount+1, _roundMax) + " of " + _roundMax);
|
||||
|
||||
//Drawer
|
||||
out = C.cRed + " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cWhite + "Drawer:";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cYellow + "None";
|
||||
if (_round != null)
|
||||
out = C.cYellow + _round.Drawer.getName();
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
|
||||
out = C.cRed + " ";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Drawer:");
|
||||
if (_round == null)
|
||||
Scoreboard.Write(C.cYellow + "None");
|
||||
else
|
||||
Scoreboard.Write(C.cYellow + _round.Drawer.getName());
|
||||
|
||||
//Scores
|
||||
out = C.cWhite + "Scores:";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Scores:");
|
||||
|
||||
//Write New
|
||||
for (int i=0 ; i<_ranks.size() && index > 0 ; i++)
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
{
|
||||
GameScore score = _ranks.get(i);
|
||||
|
||||
out = (int)score.Score + " " + C.cYellow + score.Player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(index--);
|
||||
Scoreboard.WriteOrdered("Score", C.cYellow + _ranks.get(i).Player.getName(), (int)_ranks.get(i).Score, true);
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class DrawRound
|
||||
public int Revealed = 0;
|
||||
public boolean[] WordReveal;
|
||||
public long Time;
|
||||
public double TimeMax = 45;
|
||||
public double TimeMax = 50;
|
||||
public HashSet<String> Guessed = new HashSet<String>();
|
||||
|
||||
public DrawRound(Draw draw, Player player, String word)
|
||||
|
@ -78,7 +78,7 @@ public class Evolution extends SoloGame
|
||||
|
||||
this.SpawnDistanceRequirement = 16;
|
||||
|
||||
_scoreObj = GetScoreboard().registerNewObjective("Evolutions", "dummy");
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
@ -293,27 +293,13 @@ public class Evolution extends SoloGame
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(string);
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
|
||||
//Write New
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
int score = GetScore(player);
|
||||
|
||||
String out = score + " " + C.cGreen + player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(score);
|
||||
Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), GetScore(player), true);
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class MilkCow extends SoloGame
|
||||
this.CompassEnabled = true;
|
||||
this.DeathOut = false;
|
||||
|
||||
_scoreObj = GetScoreboard().registerNewObjective("Milk", "dummy");
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Milk", "dummy");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
@ -474,43 +474,19 @@ public class MilkCow extends SoloGame
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(string);
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
boolean added = false;
|
||||
|
||||
//Write New
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
int score = (int)GetScore(player);
|
||||
|
||||
if (score > 0)
|
||||
added = true;
|
||||
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team == null) continue;
|
||||
|
||||
String out = score + " " + team.GetColor() + player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(score);
|
||||
}
|
||||
|
||||
if (!added)
|
||||
{
|
||||
String out = "DRINK ITS MILK!";
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(1);
|
||||
|
||||
Scoreboard.WriteOrdered("Milk", team.GetColor() + player.getName(), score, true);
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -250,7 +250,7 @@ public class MineWare extends SoloGame
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
|
||||
|
||||
_lives.put(player, lives);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
|
||||
@ -258,7 +258,7 @@ public class MineWare extends SoloGame
|
||||
|
||||
player.damage(5000);
|
||||
|
||||
GetScoreboard().resetScores(player);
|
||||
Scoreboard.ResetScore(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class Quiver extends SoloGame
|
||||
this.BlockBreakAllow.add(102);
|
||||
this.BlockBreakAllow.add(20);
|
||||
|
||||
_scoreObj = GetScoreboard().registerNewObjective("Kills", "dummy");
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
@ -256,29 +256,20 @@ public class Quiver extends SoloGame
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(string);
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
|
||||
SortScores();
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Write New
|
||||
for (int i=0 ; i<_ranks.size() && i<15 ; i++)
|
||||
{
|
||||
QuiverScore score = _ranks.get(i);
|
||||
|
||||
String out = score.Kills + " " + C.cGreen + score.Player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(score.Kills);
|
||||
Scoreboard.WriteOrdered("Score", C.cGreen + score.Player.getName(), score.Kills, true);
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -186,26 +186,18 @@ public class QuiverTeams extends TeamGame
|
||||
private void WriteScoreboard()
|
||||
{
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
for (GameTeam team : _teamKills.keySet())
|
||||
{
|
||||
int kills = _teamKills.get(team);
|
||||
|
||||
String out = kills + " " + team.GetColor() + team.GetName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
if (kills == 0)
|
||||
kills = -1;
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(kills);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(team.GetColor() + team.GetName());
|
||||
Scoreboard.Write(team.GetColor() + "" + kills + " Kills");
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -488,13 +488,9 @@ public class SheepGame extends TeamGame
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
GetScoreboard().resetScores(string);
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Write New
|
||||
String out;
|
||||
|
||||
for (GameTeam team : _sheepPens.keySet())
|
||||
{
|
||||
int score = 0;
|
||||
@ -507,17 +503,7 @@ public class SheepGame extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
out = score + " " + team.GetColor() + team.GetName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
if (score == 0)
|
||||
score = -1;
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(score);
|
||||
Scoreboard.WriteOrdered("Sheep", team.GetColor() + team.GetName(), score, true);
|
||||
|
||||
_teamScore.put(team, score);
|
||||
}
|
||||
@ -525,23 +511,11 @@ public class SheepGame extends TeamGame
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
//Space
|
||||
out = " ";
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(-2);
|
||||
|
||||
//Timer
|
||||
out = C.Bold + "Next Sheep;";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(-3);
|
||||
|
||||
out = C.cGreen + C.Bold + (int)UtilTime.convert(_sheepDelay - (System.currentTimeMillis() - _sheepTimer), 0, TimeUnit.FIT) + " Seconds";
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(-4);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.Bold + "Next Sheep;");
|
||||
Scoreboard.Write(C.cGreen + C.Bold + (int)UtilTime.convert(_sheepDelay - (System.currentTimeMillis() - _sheepTimer), 0, TimeUnit.FIT) + " Seconds");
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
public void GetTeamPen(SheepData data)
|
||||
|
@ -24,6 +24,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -39,8 +40,6 @@ public class SuperSmash extends SoloGame
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
public SuperSmash(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Smash,
|
||||
@ -154,21 +153,17 @@ public class SuperSmash extends SoloGame
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(string);
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
if (GetPlayers(true).size() > 15)
|
||||
{
|
||||
String out = C.cGreen + "Players Alive";
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(GetPlayers(true).size());
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cGreen + "Players Alive");
|
||||
Scoreboard.Write(GetPlayers(true).size() + " ");
|
||||
|
||||
out = C.cRed + "Players Dead";
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(GetPlayers(false).size() - GetPlayers(true).size());
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cRed + "Players Dead");
|
||||
Scoreboard.Write((GetPlayers(false).size() - GetPlayers(true).size()) + " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -185,15 +180,12 @@ public class SuperSmash extends SoloGame
|
||||
else if (lives == 0) out = C.cRed + player.getName();
|
||||
else
|
||||
continue;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(lives);
|
||||
|
||||
Scoreboard.WriteOrdered("Lives", out, lives, true);
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
@ -153,22 +153,20 @@ public class SuperSmashTeam extends TeamGame
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(string);
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
Scoreboard.Reset();
|
||||
|
||||
if (GetPlayers(true).size() > 12)
|
||||
if (GetPlayers(true).size() > 15)
|
||||
{
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
String out = team.GetPlayers(true).size() + " " + team.GetFormattedName();
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(team.GetFormattedName());
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
GetObjectiveSide().getScore(out).setScore(team.GetPlayers(true).size());
|
||||
int lives = 0;
|
||||
for (Player player : team.GetPlayers(true))
|
||||
lives += GetLives(player);
|
||||
|
||||
Scoreboard.Write(team.GetColor() + "" + lives + " Lives");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -178,18 +176,14 @@ public class SuperSmashTeam extends TeamGame
|
||||
{
|
||||
int lives = GetLives(player);
|
||||
|
||||
String out = lives + " " + GetTeam(player).GetColor() + player.getName();
|
||||
if (lives <= 0)
|
||||
continue;
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(lives);
|
||||
|
||||
Scoreboard.WriteOrdered("Lives", GetTeam(player).GetColor() + player.getName(), lives, true);
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
@ -119,27 +119,16 @@ public class SquidShooter extends SoloGame
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
for (String string : _lastScoreboard)
|
||||
{
|
||||
GetScoreboard().resetScores(string);
|
||||
}
|
||||
_lastScoreboard.clear();
|
||||
|
||||
SortScores();
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Write New
|
||||
for (QuiverScore score : _ranks)
|
||||
{
|
||||
String out = score.Kills + " " + C.cGreen + score.Player.getName();
|
||||
|
||||
if (out.length() >= 16)
|
||||
out = out.substring(0, 15);
|
||||
|
||||
_lastScoreboard.add(out);
|
||||
|
||||
GetObjectiveSide().getScore(out).setScore(score.Kills);
|
||||
}
|
||||
Scoreboard.WriteOrdered("Kills", C.cGreen + score.Player.getName(), score.Kills, true);
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -860,7 +860,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
Manager.GetGame().GetState() != GameState.Recruit))
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.setScoreboard(Manager.GetGame().GetScoreboard());
|
||||
player.setScoreboard(Manager.GetGame().GetScoreboard().GetScoreboard());
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -326,7 +326,7 @@ public class GameManager implements Listener
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
event.GetGame().CreateScoreboardTeams();
|
||||
event.GetGame().GetScoreboard().CreateTeams();
|
||||
}
|
||||
|
||||
public void TeamPreferenceJoin(Game game)
|
||||
|
@ -115,7 +115,7 @@ public class GamePlayerManager implements Listener
|
||||
UtilPlayer.message(player, F.main("Game", Manager.GetGame().GetName() + " is in progress, please wait for next game!"));
|
||||
}
|
||||
|
||||
player.setScoreboard(Manager.GetGame().GetScoreboard());
|
||||
player.setScoreboard(Manager.GetGame().GetScoreboard().GetScoreboard());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -0,0 +1,180 @@
|
||||
package nautilus.game.arcade.scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class GameScoreboard
|
||||
{
|
||||
private Game Game;
|
||||
|
||||
private Scoreboard _scoreboard;
|
||||
private Objective _sideObjective;
|
||||
|
||||
private ArrayList<ScoreboardElement> _elements = new ArrayList<ScoreboardElement>();
|
||||
private String _space = " ";
|
||||
|
||||
public GameScoreboard(Game game)
|
||||
{
|
||||
Game = game;
|
||||
|
||||
//Scoreboard
|
||||
_scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
|
||||
_sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy");
|
||||
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
_sideObjective.setDisplayName(C.Bold + game.GetName());
|
||||
}
|
||||
|
||||
public Scoreboard GetScoreboard()
|
||||
{
|
||||
return _scoreboard;
|
||||
}
|
||||
|
||||
public Objective GetObjectiveSide()
|
||||
{
|
||||
return _sideObjective;
|
||||
}
|
||||
|
||||
public void CreateTeams()
|
||||
{
|
||||
System.out.println("Creating Scoreboard Teams.");
|
||||
|
||||
//Base Groups
|
||||
for (Rank rank : Rank.values())
|
||||
{
|
||||
//Spectator
|
||||
if (rank == Rank.ALL)
|
||||
{
|
||||
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
|
||||
}
|
||||
else
|
||||
{
|
||||
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
|
||||
//_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY);
|
||||
}
|
||||
}
|
||||
|
||||
//Team Groups
|
||||
for (GameTeam team : Game.GetTeamList())
|
||||
{
|
||||
for (Rank rank : Rank.values())
|
||||
{
|
||||
if (rank == Rank.ALL)
|
||||
{
|
||||
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
|
||||
}
|
||||
else
|
||||
{
|
||||
//_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor());
|
||||
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPlayerTeam(Player player, String teamName)
|
||||
{
|
||||
for (Team team : _scoreboard.getTeams())
|
||||
team.removePlayer(player);
|
||||
|
||||
if (teamName == null)
|
||||
teamName = "";
|
||||
|
||||
_scoreboard.getTeam(Game.Manager.GetClients().Get(player).GetRank().Name + teamName).addPlayer(player);
|
||||
}
|
||||
|
||||
public void ResetScore(String line)
|
||||
{
|
||||
_scoreboard.resetScores(line);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
for (ScoreboardElement elem : _elements)
|
||||
{
|
||||
for (String line : elem.GetLines())
|
||||
{
|
||||
ResetScore(line);
|
||||
}
|
||||
}
|
||||
|
||||
_elements.clear();
|
||||
|
||||
_space = " ";
|
||||
}
|
||||
|
||||
public String Clean(String line)
|
||||
{
|
||||
if (line.length() >= 16)
|
||||
line = line.substring(0, 15);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
public void Write(String line)
|
||||
{
|
||||
line = Clean(line);
|
||||
|
||||
_elements.add(new ScoreboardElementText(line));
|
||||
}
|
||||
|
||||
public void WriteOrdered(String key, String line, int value, boolean prependScore)
|
||||
{
|
||||
if (prependScore)
|
||||
line = value + " " + line;
|
||||
|
||||
line = Clean(line);
|
||||
|
||||
for (ScoreboardElement elem : _elements)
|
||||
{
|
||||
if (elem instanceof ScoreboardElementScores)
|
||||
{
|
||||
ScoreboardElementScores scores = (ScoreboardElementScores)elem;
|
||||
|
||||
if (scores.IsKey(key))
|
||||
{
|
||||
scores.AddScore(line, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_elements.add(new ScoreboardElementScores(key, line, value, true));
|
||||
}
|
||||
|
||||
public void WriteBlank()
|
||||
{
|
||||
_elements.add(new ScoreboardElementText(_space));
|
||||
_space += " ";
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
int i = 15;
|
||||
for (ScoreboardElement elem : _elements)
|
||||
{
|
||||
for (String line : elem.GetLines())
|
||||
{
|
||||
GetObjectiveSide().getScore(line).setScore(i--);
|
||||
}
|
||||
|
||||
if (i <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package nautilus.game.arcade.scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class ScoreboardElement
|
||||
{
|
||||
public abstract ArrayList<String> GetLines();
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package nautilus.game.arcade.scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ScoreboardElementScores extends ScoreboardElement
|
||||
{
|
||||
private String _key;
|
||||
|
||||
private HashMap<String, Integer> _scores;
|
||||
|
||||
private boolean _higherIsBetter;
|
||||
|
||||
public ScoreboardElementScores(String key, String line, int value, boolean higherIsBetter)
|
||||
{
|
||||
_scores = new HashMap<String, Integer>();
|
||||
|
||||
_key = key;
|
||||
|
||||
AddScore(line, value);
|
||||
|
||||
_higherIsBetter = higherIsBetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> GetLines()
|
||||
{
|
||||
ArrayList<String> orderedScores = new ArrayList<String>();
|
||||
|
||||
//Order Scores
|
||||
while (orderedScores.size() < _scores.size())
|
||||
{
|
||||
String bestKey = null;
|
||||
int bestScore = 0;
|
||||
|
||||
for (String key : _scores.keySet())
|
||||
{
|
||||
if (orderedScores.contains(key))
|
||||
continue;
|
||||
|
||||
if (bestKey == null ||
|
||||
(_higherIsBetter && _scores.get(key) >= bestScore) ||
|
||||
(!_higherIsBetter && _scores.get(key) <= bestScore))
|
||||
{
|
||||
bestKey = key;
|
||||
bestScore = _scores.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
orderedScores.add(bestKey);
|
||||
}
|
||||
|
||||
return orderedScores;
|
||||
}
|
||||
|
||||
public boolean IsKey(String key)
|
||||
{
|
||||
return _key.equals(key);
|
||||
}
|
||||
|
||||
public void AddScore(String line, int value)
|
||||
{
|
||||
_scores.put(line, value);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ScoreboardElementText extends ScoreboardElement
|
||||
{
|
||||
private String _line;
|
||||
|
||||
public ScoreboardElementText(String line)
|
||||
{
|
||||
_line = line;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> GetLines()
|
||||
{
|
||||
ArrayList<String> orderedScores = new ArrayList<String>();
|
||||
|
||||
orderedScores.add(_line);
|
||||
|
||||
return orderedScores;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user