Skip to content

Commit

Permalink
Drop support for loading obsolete text/ircbancmd.txt - it was obsolet…
Browse files Browse the repository at this point in the history
…e even in MCForge
  • Loading branch information
UnknownShadow200 committed Apr 11, 2021
1 parent f0d9f81 commit 7e7e69e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
1 change: 1 addition & 0 deletions MCGalaxy/Chat/EmotesHandler.cs
Expand Up @@ -6,6 +6,7 @@ namespace MCGalaxy {

public static class EmotesHandler {

/// <summary> Mapping of emote keywords to unicode characters </summary>
public static readonly Dictionary<string, char> Keywords = new Dictionary<string, char> {
{ "darksmile", '☺' },
{ "smile", '☻' },
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/Commands/Information/CmdHelp.cs
Expand Up @@ -99,7 +99,7 @@ public sealed class CmdHelp : Command2 {

static string FormatEmote(char emote) {
List<string> keywords = new List<string>();
foreach (KeyValuePair<string, char> kvp in EmotesHandler.Keywords) {
foreach (var kvp in EmotesHandler.Keywords) {
if (kvp.Value == emote) keywords.Add("(&S" + kvp.Key + ")");
}
return "&f" + emote + " &S- " + keywords.Join();
Expand Down
24 changes: 8 additions & 16 deletions MCGalaxy/Network/IRCPlugin/IRCBot.cs
Expand Up @@ -156,22 +156,14 @@ public sealed class IRCBot {
void LoadBannedCommands() {
SetDefaultBannedCommands();

if (File.Exists("text/ircbancmd.txt")) { // Backwards compatibility
using (StreamWriter w = new StreamWriter("text/irccmdblacklist.txt")) {
w.WriteLine("#Here you can put commands that cannot be used from the IRC bot.");
w.WriteLine("#Lines starting with \"#\" are ignored.");
foreach (string line in File.ReadAllLines("text/ircbancmd.txt"))
w.WriteLine(line);
}
File.Delete("text/ircbancmd.txt");
} else {
if (!File.Exists("text/irccmdblacklist.txt"))
File.WriteAllLines("text/irccmdblacklist.txt", new string[] {
"#Here you can put commands that cannot be used from the IRC bot.",
"#Lines starting with \"#\" are ignored." });
foreach (string line in File.ReadAllLines("text/irccmdblacklist.txt")) {
if (!line.IsCommentLine()) BannedCommands.Add(line);
}
if (!File.Exists("text/irccmdblacklist.txt")) {
File.WriteAllLines("text/irccmdblacklist.txt", new string[] {
"#Here you can put commands that cannot be used from the IRC bot.",
"#Lines starting with \"#\" are ignored." });
}

foreach (string line in File.ReadAllLines("text/irccmdblacklist.txt")) {
if (!line.IsCommentLine()) BannedCommands.Add(line);
}
}
}
Expand Down

0 comments on commit 7e7e69e

Please sign in to comment.