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

View File

@ -52,7 +52,7 @@ namespace MCGalaxy.Commands {
p.invincible = false;
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 {
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
@ -85,7 +85,7 @@ namespace MCGalaxy.Commands {
if (!result) return;
p.DespawnEntity(who.id);
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 z = ushort.Parse(args[offset + 2]);
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"); }
}

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 ) {
mesg += " on the " + Colors.red + "red team";
}

View File

@ -25,42 +25,26 @@ using MCGalaxy.SQL;
namespace MCGalaxy.Games
{
/// <summary>
/// This is the team class for CTF
/// </summary>
/// <summary> This is the team class for CTF </summary>
public sealed class Teams
{
public string color;
public int points = 0;
public List<Player> members;
/// <summary>
/// Create a new Team Object
/// </summary>
/// <param name="color">The color code that the team will have</param>
public Teams(string color)
{
this.color = Colors.Parse(color);
/// <summary> Create a new Team Object </summary>
public Teams(string color) {
color = Colors.Parse(color);
members = new List<Player>();
}
/// <summary>
/// Add a player to the team
/// </summary>
/// <param name="p">The player to add</param>
public void Add(Player p)
{
/// <summary> Add a player to the team </summary>
public void Add(Player p) {
members.Add(p);
}
/// <summary>
/// Checks to see if the player is on this team
/// </summary>
/// <param name="p">The player</param>
/// <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;
/// <summary> Checks to see if the player is on this team </summary>
public bool isOnTeam(Player p) {
return members.IndexOf(p) != -1;
}
}
internal sealed class Data
@ -303,13 +287,13 @@ namespace MCGalaxy.Games
{
//cache.Remove(GetPlayer(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))
{
//cache.Remove(GetPlayer(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;
}
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!");
}
else if (redteam.members.Count > blueteam.members.Count)
@ -586,7 +570,7 @@ tags MEDIUMINT UNSIGNED{1});";
GetPlayer(p).blue = true;
}
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!");
}
else if (new Random().Next(2) == 0)
@ -599,7 +583,7 @@ tags MEDIUMINT UNSIGNED{1});";
GetPlayer(p).blue = false;
}
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!");
}
else
@ -612,7 +596,7 @@ tags MEDIUMINT UNSIGNED{1});";
GetPlayer(p).blue = true;
}
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!");
}
}
@ -622,13 +606,13 @@ tags MEDIUMINT UNSIGNED{1});";
{
//cache.Remove(GetPlayer(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))
{
//cache.Remove(GetPlayer(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;
foreach (Player p1 in online) {
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);
}
@ -683,7 +667,7 @@ tags MEDIUMINT UNSIGNED{1});";
Player[] online = PlayerInfo.Online.Items;
foreach (Player p1 in online) {
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);
}

View File

@ -423,8 +423,8 @@ namespace MCGalaxy.Games
{
Kld.TntWarsHealth -= HealthDamage;
Kld.HarmedBy = Killer;
Player.Message(Killer, "TNT Wars: You harmed " + Kld.color + Kld.name);
Player.Message(Kld, "TNT Wars: You were harmed by " + Killer.color + Killer.name);
Player.Message(Killer, "TNT Wars: You harmed " + Kld.ColoredName);
Player.Message(Kld, "TNT Wars: You were harmed by " + Killer.ColoredName);
}
}
foreach (Player Died in Dead)
@ -497,7 +497,7 @@ namespace MCGalaxy.Games
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!)");
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.TNTWarsLastKillStreakAnnounced = Properties.DefaultStreakThreeAmount;
if (GameDifficulty == TntWarsDifficulty.Hard || GameDifficulty == TntWarsDifficulty.Extreme)

View File

@ -777,12 +777,12 @@ namespace MCGalaxy {
// Close the damn socket connection!
socket.Shutdown(SocketShutdown.Both);
#if DEBUG
Server.s.Log("Socket was shutdown for " + this.name ?? this.ip);
Server.s.Log("Socket was shutdown for " + name ?? ip);
#endif
}
catch ( Exception e ) {
#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);
#endif
}
@ -790,12 +790,12 @@ namespace MCGalaxy {
try {
socket.Close();
#if DEBUG
Server.s.Log("Socket was closed for " + this.name ?? this.ip);
Server.s.Log("Socket was closed for " + name ?? ip);
#endif
}
catch ( Exception e ) {
#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);
#endif
}

View File

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

View File

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

View File

@ -290,7 +290,7 @@ namespace MCGalaxy {
}
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]!");
else
SendMessage("&cPlease complete admin verification with &a/pass [Password]!");

View File

@ -542,7 +542,7 @@ namespace MCGalaxy {
}
} catch (Exception 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);
}
}