Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow OPs to ignore 'Lately known as...' messages #798

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions MCGalaxy/Commands/Chat/CmdIgnore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public override void Use(Player p, string message, CommandData data) {
Toggle(p, ref p.Ignores.DrawOutput, "{0} ignoring draw command output"); return;
} else if (action == "worldchanges") {
Toggle(p, ref p.Ignores.WorldChanges, "{0} ignoring world changes"); return;
} else if (action == "altlogins") {
Toggle(p, ref p.Ignores.AltLogins, "{0} ignoring alt accounts messages when a player joins"); return;
} else if (IsListAction(action)) {
p.Ignores.Output(p); return;
}
Expand Down Expand Up @@ -115,6 +117,7 @@ public override void Help(Player p, string message) {
p.Message("&H 8ball - &T/8ball &His ignored.");
p.Message("&H drawoutput - drawing command output is ignored.");
p.Message("&H worldchanges - world change messages are ignored.");
p.Message("&H altlogins - login messages showing alt accounts are ignored.");
}
}
}
2 changes: 1 addition & 1 deletion MCGalaxy/Player/Player.Login.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static void ShowAltsTask(SchedulerTask task) {
string altsMsg = "λNICK &Sis lately known as: " + alts.Join();

Chat.MessageFrom(p, altsMsg,
(pl, obj) => pl.CanSee(p) && opchat.UsableBy(pl));
(pl, obj) => pl.CanSee(p) && opchat.UsableBy(pl) && !pl.Ignores.AltLogins);

//IRCBot.Say(temp, true); //Tells people in op channel on IRC
altsMsg = altsMsg.Replace("λNICK", name);
Expand Down
7 changes: 5 additions & 2 deletions MCGalaxy/Player/PlayerIgnores.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace MCGalaxy {

public class PlayerIgnores {
public List<string> Names = new List<string>(), IRCNicks = new List<string>();
public bool All, IRC, Titles, Nicks, EightBall, DrawOutput, WorldChanges;
public bool All, IRC, Titles, Nicks, EightBall, DrawOutput, WorldChanges, AltLogins;

public void Load(Player p) {
string path = "ranks/ignore/" + p.name + ".txt";
Expand All @@ -42,6 +42,7 @@ public void Load(Player p) {
if (line == "&8ball") { EightBall = true; continue; }
if (line == "&drawoutput") { DrawOutput = true; continue; }
if (line == "&worldchanges") { WorldChanges = true; continue; }
if (line == "&altlogins") { AltLogins = true; continue; }

if (line.StartsWith("&irc_")) {
IRCNicks.Add(line.Substring("&irc_".Length));
Expand All @@ -53,7 +54,7 @@ public void Load(Player p) {
Logger.LogError("Error loading ignores for " + p.name, ex);
}

bool special = All || IRC || Titles || Nicks || EightBall || DrawOutput || WorldChanges;
bool special = All || IRC || Titles || Nicks || EightBall || DrawOutput || WorldChanges || AltLogins;
if (special || Names.Count > 0 || IRCNicks.Count > 0) {
p.Message("&cType &a/ignore list &cto see who you are still ignoring");
}
Expand All @@ -75,6 +76,7 @@ public void Save(Player p) {
if (EightBall) w.WriteLine("&8ball");
if (DrawOutput) w.WriteLine("&drawoutput");
if (WorldChanges) w.WriteLine("&worldchanges");
if (AltLogins) w.WriteLine("&altlogins");

foreach (string nick in IRCNicks) { w.WriteLine("&irc_" + nick); }
foreach (string name in Names) { w.WriteLine(name); }
Expand Down Expand Up @@ -103,6 +105,7 @@ public void Output(Player p) {
if (EightBall) p.Message("&cIgnoring &T/8ball");
if (DrawOutput) p.Message("&cIgnoring draw command output");
if (WorldChanges) p.Message("&cIgnoring world change messages");
if (AltLogins) p.Message("&cPlayer alt accounts do not show when they join");
}
}
}