Use p.ColoredName in more places.

This commit is contained in:
UnknownShadow200 2016-08-15 15:59:15 +10:00
parent 62508d8240
commit f437e1b07b
11 changed files with 42 additions and 58 deletions

View File

@ -230,8 +230,8 @@ namespace MCGalaxy.Commands {
} }
Player.Message(pl, "You were kicked from the chat room '" + pl.Chatroom + "'"); Player.Message(pl, "You were kicked from the chat room '" + pl.Chatroom + "'");
Player.Message(p, pl.color + pl.name + " %Swas kicked from the chat room '" + pl.Chatroom + "'"); Player.Message(p, pl.ColoredName + " %Swas kicked from the chat room '" + pl.Chatroom + "'");
Chat.ChatRoom(pl, pl.color + pl.name + " %Swas kicked from your chat room", false, pl.Chatroom); Chat.ChatRoom(pl, pl.ColoredName + " %Swas kicked from your chat room", false, pl.Chatroom);
pl.Chatroom = null; pl.Chatroom = null;
} }
@ -258,7 +258,7 @@ namespace MCGalaxy.Commands {
Player[] players = PlayerInfo.Online.Items; Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) { foreach (Player pl in players) {
if (pl.Chatroom == room) if (pl.Chatroom == room)
Player.Message(p, pl.color + pl.name); Player.Message(p, pl.ColoredName);
} }
} else { } else {
Player.Message(p, "There is no command with the type '" + room + "'," + Player.Message(p, "There is no command with the type '" + room + "'," +

View File

@ -52,7 +52,7 @@ namespace MCGalaxy.Commands {
p.invincible = false; p.invincible = false;
Command.all.Find("hide").Use(p, ""); Command.all.Find("hide").Use(p, "");
Player.Message(p, "Stopped possessing " + who.color + who.name + "%S."); Player.Message(p, "Stopped possessing " + who.ColoredName + "%S.");
} else { } else {
Player who = PlayerInfo.FindMatches(p, message); Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return; if (who == null) return;
@ -85,7 +85,7 @@ namespace MCGalaxy.Commands {
if (!result) return; if (!result) return;
p.DespawnEntity(who.id); p.DespawnEntity(who.id);
who.canBuild = false; who.canBuild = false;
Player.Message(p, "Successfully possessed " + who.color + who.name + "%S."); Player.Message(p, "Successfully possessed {0}%S.", who.ColoredName);
} }
} }

View File

@ -76,7 +76,7 @@ namespace MCGalaxy.Commands {
ushort y = ushort.Parse(args[offset + 1]); ushort y = ushort.Parse(args[offset + 1]);
ushort z = ushort.Parse(args[offset + 2]); ushort z = ushort.Parse(args[offset + 2]);
PlayerActions.MoveCoords(who, x, y, z); PlayerActions.MoveCoords(who, x, y, z);
if (p != who) Player.Message(p, "Moved " + who.color + who.name); if (p != who) Player.Message(p, "Moved " + who.ColoredName);
} }
catch { Player.Message(p, "Invalid co-ordinates"); } catch { Player.Message(p, "Invalid co-ordinates"); }
} }

View File

@ -606,7 +606,7 @@ namespace MCGalaxy.Gui {
} }
} }
{ {
string mesg = pl.p.color + pl.p.name + Server.DefaultColor + " " + "is now"; string mesg = pl.p.ColoredName + Server.DefaultColor + " " + "is now";
if ( pl.Red ) { if ( pl.Red ) {
mesg += " on the " + Colors.red + "red team"; mesg += " on the " + Colors.red + "red team";
} }

View File

@ -25,42 +25,26 @@ using MCGalaxy.SQL;
namespace MCGalaxy.Games namespace MCGalaxy.Games
{ {
/// <summary> /// <summary> This is the team class for CTF </summary>
/// This is the team class for CTF
/// </summary>
public sealed class Teams public sealed class Teams
{ {
public string color; public string color;
public int points = 0; public int points = 0;
public List<Player> members; public List<Player> members;
/// <summary>
/// Create a new Team Object /// <summary> Create a new Team Object </summary>
/// </summary> public Teams(string color) {
/// <param name="color">The color code that the team will have</param> color = Colors.Parse(color);
public Teams(string color)
{
this.color = Colors.Parse(color);
members = new List<Player>(); members = new List<Player>();
} }
/// <summary> /// <summary> Add a player to the team </summary>
/// Add a player to the team public void Add(Player p) {
/// </summary>
/// <param name="p">The player to add</param>
public void Add(Player p)
{
members.Add(p); members.Add(p);
} }
/// <summary>
/// Checks to see if the player is on this team /// <summary> Checks to see if the player is on this team </summary>
/// </summary> public bool isOnTeam(Player p) {
/// <param name="p">The player</param> return members.IndexOf(p) != -1;
/// <returns>If true, then that player is on the team. Otherwise that player isnt</returns>
public bool isOnTeam(Player p)
{
if (members.IndexOf(p) != -1)
return true;
else
return false;
} }
} }
internal sealed class Data internal sealed class Data
@ -303,13 +287,13 @@ namespace MCGalaxy.Games
{ {
//cache.Remove(GetPlayer(p)); //cache.Remove(GetPlayer(p));
blueteam.members.Remove(p); blueteam.members.Remove(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + blueteam.color + "left the ctf game"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + blueteam.color + "left the ctf game");
} }
else if (redteam.members.Contains(p)) else if (redteam.members.Contains(p))
{ {
//cache.Remove(GetPlayer(p)); //cache.Remove(GetPlayer(p));
redteam.members.Remove(p); redteam.members.Remove(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + redteam.color + "left the ctf game"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + redteam.color + "left the ctf game");
} }
} }
} }
@ -573,7 +557,7 @@ tags MEDIUMINT UNSIGNED{1});";
GetPlayer(p).blue = false; GetPlayer(p).blue = false;
} }
redteam.Add(p); redteam.Add(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.red + "joined the RED Team"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + Colors.red + "joined the RED Team");
Player.Message(p, Colors.red + "You are now on the red team!"); Player.Message(p, Colors.red + "You are now on the red team!");
} }
else if (redteam.members.Count > blueteam.members.Count) else if (redteam.members.Count > blueteam.members.Count)
@ -586,7 +570,7 @@ tags MEDIUMINT UNSIGNED{1});";
GetPlayer(p).blue = true; GetPlayer(p).blue = true;
} }
blueteam.Add(p); blueteam.Add(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.blue + "joined the BLUE Team"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + Colors.blue + "joined the BLUE Team");
Player.Message(p, Colors.blue + "You are now on the blue team!"); Player.Message(p, Colors.blue + "You are now on the blue team!");
} }
else if (new Random().Next(2) == 0) else if (new Random().Next(2) == 0)
@ -599,7 +583,7 @@ tags MEDIUMINT UNSIGNED{1});";
GetPlayer(p).blue = false; GetPlayer(p).blue = false;
} }
redteam.Add(p); redteam.Add(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.red + "joined the RED Team"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + Colors.red + "joined the RED Team");
Player.Message(p, Colors.red + "You are now on the red team!"); Player.Message(p, Colors.red + "You are now on the red team!");
} }
else else
@ -612,7 +596,7 @@ tags MEDIUMINT UNSIGNED{1});";
GetPlayer(p).blue = true; GetPlayer(p).blue = true;
} }
blueteam.Add(p); blueteam.Add(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.blue + "joined the BLUE Team"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + Colors.blue + "joined the BLUE Team");
Player.Message(p, Colors.blue + "You are now on the blue team!"); Player.Message(p, Colors.blue + "You are now on the blue team!");
} }
} }
@ -622,13 +606,13 @@ tags MEDIUMINT UNSIGNED{1});";
{ {
//cache.Remove(GetPlayer(p)); //cache.Remove(GetPlayer(p));
blueteam.members.Remove(p); blueteam.members.Remove(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + blueteam.color + "left the ctf game"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + blueteam.color + "left the ctf game");
} }
else if (redteam.members.Contains(p)) else if (redteam.members.Contains(p))
{ {
//cache.Remove(GetPlayer(p)); //cache.Remove(GetPlayer(p));
redteam.members.Remove(p); redteam.members.Remove(p);
Chat.MessageLevel(mainlevel, p.color + p.name + " " + redteam.color + "left the ctf game"); Chat.MessageLevel(mainlevel, p.ColoredName + " " + redteam.color + "left the ctf game");
} }
} }
} }
@ -674,7 +658,7 @@ tags MEDIUMINT UNSIGNED{1});";
Player[] online = PlayerInfo.Online.Items; Player[] online = PlayerInfo.Online.Items;
foreach (Player p1 in online) { foreach (Player p1 in online) {
if (blueteam.members.Contains(p1)) if (blueteam.members.Contains(p1))
Player.Message(p1, "(Blue) " + p.color + p.name + ":&f " + message); Player.Message(p1, "(Blue) " + p.ColoredName + ":&f " + message);
} }
Plugin.CancelPlayerEvent(PlayerEvents.PlayerChat, p); Plugin.CancelPlayerEvent(PlayerEvents.PlayerChat, p);
} }
@ -683,7 +667,7 @@ tags MEDIUMINT UNSIGNED{1});";
Player[] online = PlayerInfo.Online.Items; Player[] online = PlayerInfo.Online.Items;
foreach (Player p1 in online) { foreach (Player p1 in online) {
if (redteam.members.Contains(p1)) if (redteam.members.Contains(p1))
Player.Message(p1, "(Red) " + p.color + p.name + ":&f " + message); Player.Message(p1, "(Red) " + p.ColoredName + ":&f " + message);
} }
Plugin.CancelPlayerEvent(PlayerEvents.PlayerChat, p); Plugin.CancelPlayerEvent(PlayerEvents.PlayerChat, p);
} }

View File

@ -423,8 +423,8 @@ namespace MCGalaxy.Games
{ {
Kld.TntWarsHealth -= HealthDamage; Kld.TntWarsHealth -= HealthDamage;
Kld.HarmedBy = Killer; Kld.HarmedBy = Killer;
Player.Message(Killer, "TNT Wars: You harmed " + Kld.color + Kld.name); Player.Message(Killer, "TNT Wars: You harmed " + Kld.ColoredName);
Player.Message(Kld, "TNT Wars: You were harmed by " + Killer.color + Killer.name); Player.Message(Kld, "TNT Wars: You were harmed by " + Killer.ColoredName);
} }
} }
foreach (Player Died in Dead) foreach (Player Died in Dead)
@ -497,7 +497,7 @@ namespace MCGalaxy.Games
else if (Killer.TntWarsKillStreak >= Properties.DefaultStreakThreeAmount && Killer.TNTWarsLastKillStreakAnnounced != Properties.DefaultStreakThreeAmount) else if (Killer.TntWarsKillStreak >= Properties.DefaultStreakThreeAmount && Killer.TNTWarsLastKillStreakAnnounced != Properties.DefaultStreakThreeAmount)
{ {
Player.Message(Killer, "TNT Wars: Kill streak of " + Killer.TntWarsKillStreak.ToString() + " (Multiplier of " + Properties.DefaultStreakThreeMultiplier.ToString() + " and you now have 1 extra health!)"); Player.Message(Killer, "TNT Wars: Kill streak of " + Killer.TntWarsKillStreak.ToString() + " (Multiplier of " + Properties.DefaultStreakThreeMultiplier.ToString() + " and you now have 1 extra health!)");
SendAllPlayersMessage("TNT Wars: " + Killer.color + Killer.name + " %Shas a kill streak of " + Killer.TntWarsKillStreak.ToString() + " and now has 1 extra health!"); SendAllPlayersMessage("TNT Wars: " + Killer.ColoredName + " %Shas a kill streak of " + Killer.TntWarsKillStreak.ToString() + " and now has 1 extra health!");
Killer.TntWarsScoreMultiplier = Properties.DefaultStreakThreeMultiplier; Killer.TntWarsScoreMultiplier = Properties.DefaultStreakThreeMultiplier;
Killer.TNTWarsLastKillStreakAnnounced = Properties.DefaultStreakThreeAmount; Killer.TNTWarsLastKillStreakAnnounced = Properties.DefaultStreakThreeAmount;
if (GameDifficulty == TntWarsDifficulty.Hard || GameDifficulty == TntWarsDifficulty.Extreme) if (GameDifficulty == TntWarsDifficulty.Hard || GameDifficulty == TntWarsDifficulty.Extreme)

View File

@ -777,12 +777,12 @@ namespace MCGalaxy {
// Close the damn socket connection! // Close the damn socket connection!
socket.Shutdown(SocketShutdown.Both); socket.Shutdown(SocketShutdown.Both);
#if DEBUG #if DEBUG
Server.s.Log("Socket was shutdown for " + this.name ?? this.ip); Server.s.Log("Socket was shutdown for " + name ?? ip);
#endif #endif
} }
catch ( Exception e ) { catch ( Exception e ) {
#if DEBUG #if DEBUG
Exception ex = new Exception("Failed to shutdown socket for " + this.name ?? this.ip, e); Exception ex = new Exception("Failed to shutdown socket for " + name ?? ip, e);
Server.ErrorLog(ex); Server.ErrorLog(ex);
#endif #endif
} }
@ -790,12 +790,12 @@ namespace MCGalaxy {
try { try {
socket.Close(); socket.Close();
#if DEBUG #if DEBUG
Server.s.Log("Socket was closed for " + this.name ?? this.ip); Server.s.Log("Socket was closed for " + name ?? ip);
#endif #endif
} }
catch ( Exception e ) { catch ( Exception e ) {
#if DEBUG #if DEBUG
Exception ex = new Exception("Failed to close socket for " + this.name ?? this.ip, e); Exception ex = new Exception("Failed to close socket for " + name ?? ip, e);
Server.ErrorLog(ex); Server.ErrorLog(ex);
#endif #endif
} }

View File

@ -76,7 +76,7 @@ namespace MCGalaxy {
if (!Server.TablistGlobal) if (!Server.TablistGlobal)
TabList.Add(dst, p, id); TabList.Add(dst, p, id);
if (!Server.zombie.Running || !p.Game.Infected) { if (!Server.zombie.Running || !p.Game.Infected) {
string col = GetSupportedCol(dst, p.color); string col = GetSupportedCol(dst, p.color);
if (dst.hasExtList) { if (dst.hasExtList) {
dst.SendExtAddEntity2(id, p.skinName, col + p.truename + possession, x, y, z, rotx, roty); dst.SendExtAddEntity2(id, p.skinName, col + p.truename + possession, x, y, z, rotx, roty);
} else { } else {

View File

@ -610,8 +610,8 @@ return;
}*/ }*/
text = HandleJoker(text); text = HandleJoker(text);
//chatroom stuff //chatroom stuff
if ( this.Chatroom != null ) { if ( Chatroom != null ) {
Chat.ChatRoom(this, text, true, this.Chatroom); Chat.ChatRoom(this, text, true, Chatroom);
return; return;
} }
@ -674,11 +674,11 @@ return;
bool IsHandledMessage(string text) { bool IsHandledMessage(string text) {
if (Server.voteKickInProgress && text.Length == 1) { if (Server.voteKickInProgress && text.Length == 1) {
if (text.ToLower() == "y") { if (text.ToLower() == "y") {
this.voteKickChoice = VoteKickChoice.Yes; voteKickChoice = VoteKickChoice.Yes;
SendMessage("Thanks for voting!"); SendMessage("Thanks for voting!");
return true; return true;
} else if (text.ToLower() == "n") { } else if (text.ToLower() == "n") {
this.voteKickChoice = VoteKickChoice.No; voteKickChoice = VoteKickChoice.No;
SendMessage("Thanks for voting!"); SendMessage("Thanks for voting!");
return true; return true;
} }

View File

@ -290,7 +290,7 @@ namespace MCGalaxy {
} }
if (Server.verifyadmins && group.Permission >= Server.verifyadminsrank) { if (Server.verifyadmins && group.Permission >= Server.verifyadminsrank) {
if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + this.name + ".dat")) if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + name + ".dat"))
SendMessage("&cPlease set your admin verification password with &a/setpass [Password]!"); SendMessage("&cPlease set your admin verification password with &a/setpass [Password]!");
else else
SendMessage("&cPlease complete admin verification with &a/pass [Password]!"); SendMessage("&cPlease complete admin verification with &a/pass [Password]!");

View File

@ -542,7 +542,7 @@ namespace MCGalaxy {
} }
} catch (Exception ex) { } catch (Exception ex) {
Server.ErrorLog(ex); Server.ErrorLog(ex);
Server.s.Log("Failed to save ignored list for player: " + this.name); Server.s.Log("Failed to save ignored list for player: " + name);
} }
} }