Scoreboard Refactor

This commit is contained in:
Chiss 2014-06-10 12:51:47 +10:00
parent 6cba6b9b9e
commit 7fc2fbe564
26 changed files with 226 additions and 632 deletions

View File

@ -27,6 +27,7 @@ import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge;
import mineplex.core.spawn.Spawn;
@ -76,7 +77,8 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
_donationManager = new DonationManager(this, GetWebServerAddress());
new MessageManager(this, _clientManager);
PreferencesManager preferences = new PreferencesManager(this, _clientManager, _donationManager);
new MessageManager(this, _clientManager, preferences);
AntiStack antistack = new AntiStack(this);
@ -96,7 +98,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
AntiHack.Initialize(this, punish, portal);
//Arcade Manager
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, GetWebServerAddress());
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferences, GetWebServerAddress());
new MemoryFix(this);

View File

@ -51,7 +51,7 @@ public class GameFactory
public GameFactory(ArcadeManager gameManager)
{
_manager = gameManager;
_manager = gameManager;
}
public Game CreateGame(GameType gameType, HashMap<String, ChatColor> pastTeams)

View File

@ -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()
{

View File

@ -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()

View File

@ -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();
}
}

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();
}
}

View File

@ -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)

View File

@ -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();
}
}

View File

@ -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

View File

@ -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());
}
}

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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