diff --git a/Commands/Chat/CmdChatRoom.cs b/Commands/Chat/CmdChatRoom.cs index 957612546..9662f9e5c 100644 --- a/Commands/Chat/CmdChatRoom.cs +++ b/Commands/Chat/CmdChatRoom.cs @@ -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 + "'," + diff --git a/Commands/Moderation/CmdPossess.cs b/Commands/Moderation/CmdPossess.cs index 94231786b..78fb0ad18 100644 --- a/Commands/Moderation/CmdPossess.cs +++ b/Commands/Moderation/CmdPossess.cs @@ -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); } } diff --git a/Commands/other/CmdMove.cs b/Commands/other/CmdMove.cs index 22c1284d4..43e1167b6 100644 --- a/Commands/other/CmdMove.cs +++ b/Commands/other/CmdMove.cs @@ -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"); } } diff --git a/GUI/PropertyWindow.Games.cs b/GUI/PropertyWindow.Games.cs index 0502378f2..a650dfa0b 100644 --- a/GUI/PropertyWindow.Games.cs +++ b/GUI/PropertyWindow.Games.cs @@ -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"; } diff --git a/Games/CTF/Auto_CTF.cs b/Games/CTF/Auto_CTF.cs index 589986e3b..4a2c194be 100644 --- a/Games/CTF/Auto_CTF.cs +++ b/Games/CTF/Auto_CTF.cs @@ -25,42 +25,26 @@ using MCGalaxy.SQL; namespace MCGalaxy.Games { - /// - /// This is the team class for CTF - /// + /// This is the team class for CTF public sealed class Teams { public string color; public int points = 0; public List members; - /// - /// Create a new Team Object - /// - /// The color code that the team will have - public Teams(string color) - { - this.color = Colors.Parse(color); + + /// Create a new Team Object + public Teams(string color) { + color = Colors.Parse(color); members = new List(); } - /// - /// Add a player to the team - /// - /// The player to add - public void Add(Player p) - { + /// Add a player to the team + public void Add(Player p) { members.Add(p); } - /// - /// Checks to see if the player is on this team - /// - /// The player - /// If true, then that player is on the team. Otherwise that player isnt - public bool isOnTeam(Player p) - { - if (members.IndexOf(p) != -1) - return true; - else - return false; + + /// Checks to see if the player is on this team + 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); } diff --git a/Games/TntWars/TntWars.cs b/Games/TntWars/TntWars.cs index 9ae08337f..1e058ef13 100644 --- a/Games/TntWars/TntWars.cs +++ b/Games/TntWars/TntWars.cs @@ -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) diff --git a/Network/Player.Networking.cs b/Network/Player.Networking.cs index fd5179e02..d8a5a3ffd 100644 --- a/Network/Player.Networking.cs +++ b/Network/Player.Networking.cs @@ -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 } diff --git a/Player/Entities.cs b/Player/Entities.cs index 8cdd833e2..07c026f2b 100644 --- a/Player/Entities.cs +++ b/Player/Entities.cs @@ -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 { diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index 2b2d46fa8..79bf3f9d8 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -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; } diff --git a/Player/Player.Login.cs b/Player/Player.Login.cs index 5ab12155e..dae2e91f7 100644 --- a/Player/Player.Login.cs +++ b/Player/Player.Login.cs @@ -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]!"); diff --git a/Player/Player.cs b/Player/Player.cs index 7ab2e6d78..05cd128dd 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -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); } }