diff --git a/MCGalaxy/Chat/Colors.cs b/MCGalaxy/Chat/Colors.cs index 6d1647341..dcd952051 100644 --- a/MCGalaxy/Chat/Colors.cs +++ b/MCGalaxy/Chat/Colors.cs @@ -275,7 +275,8 @@ namespace MCGalaxy { string[] lines = File.ReadAllLines(Paths.CustomColorsFile); ColorDesc col = default(ColorDesc); - for (int i = 0; i < lines.Length; i++) { + for (int i = 0; i < lines.Length; i++) + { string[] parts = lines[i].SplitSpaces(); if (parts.Length != 7) continue; col.Code = parts[0][0]; col.Fallback = parts[1][0]; col.Name = parts[2]; diff --git a/MCGalaxy/Chat/ProfanityFilter.cs b/MCGalaxy/Chat/ProfanityFilter.cs index 1904ca4bd..cb216b61c 100644 --- a/MCGalaxy/Chat/ProfanityFilter.cs +++ b/MCGalaxy/Chat/ProfanityFilter.cs @@ -38,9 +38,11 @@ namespace MCGalaxy { string[] reduced = Reduce(text).SplitSpaces(); // Loop through each reduced word, looking for a bad word - for (int i = 0; i < reduced.Length; i++) { + for (int i = 0; i < reduced.Length; i++) + { bool isFiltered = false; - foreach (string filter in filters) { + foreach (string filter in filters) + { if (reduced[i].Contains(filter)) { isFiltered = true; break; } @@ -79,7 +81,8 @@ namespace MCGalaxy { string[] lines = filterFile.GetText(); filters = new List(); // Run the badwords through the reducer to ensure things like Ls become Is and everything is lowercase - foreach (string line in lines) { + foreach (string line in lines) + { if (line.StartsWith("#") || line.Trim().Length == 0) continue; string word = Reduce(line); diff --git a/MCGalaxy/Drawing/Image/ImagePalette.cs b/MCGalaxy/Drawing/Image/ImagePalette.cs index 55cf24fb8..e2f78b5d7 100644 --- a/MCGalaxy/Drawing/Image/ImagePalette.cs +++ b/MCGalaxy/Drawing/Image/ImagePalette.cs @@ -65,8 +65,9 @@ namespace MCGalaxy.Drawing List entries = new List(); string[] parts = new string[5]; - foreach (string line in lines) { - if (line.StartsWith("#") || line.Length == 0) continue; + foreach (string line in lines) + { + if (line.IsCommentLine()) continue; line.FixedSplit(parts, ':'); if (parts[3] == null || parts[4] != null) continue; // not a proper line diff --git a/MCGalaxy/Games/IGame.cs b/MCGalaxy/Games/IGame.cs index 03266c852..fe756cbdf 100644 --- a/MCGalaxy/Games/IGame.cs +++ b/MCGalaxy/Games/IGame.cs @@ -40,8 +40,12 @@ namespace MCGalaxy.Games } public static bool CheckAllowed(Player p, string action) { - if (p.Game.Referee || GameOn(p.level) == null) - return true; + IGame game = GameOn(p.level); + return game == null || game.CheckRespawnAllowed(p, action); + } + + protected virtual bool CheckRespawnAllowed(Player p, string action) { + if (p.Game.Referee) return true; p.Message("&WYou cannot {0} &Wwhile a game is running", action); return false; diff --git a/MCGalaxy/Modules/Relay/RelayBot.cs b/MCGalaxy/Modules/Relay/RelayBot.cs index c196962b3..5a4df692d 100644 --- a/MCGalaxy/Modules/Relay/RelayBot.cs +++ b/MCGalaxy/Modules/Relay/RelayBot.cs @@ -264,7 +264,8 @@ namespace MCGalaxy.Modules.Relay "# Lines starting with \"#\" are ignored." }); } - foreach (string line in File.ReadAllLines("text/irccmdblacklist.txt")) { + foreach (string line in Utils.ReadAllLinesList("text/irccmdblacklist.txt")) + { if (!line.IsCommentLine()) BannedCommands.Add(line); } }