mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Add /ignore titles (thanks goodlyay) to ignore player titles and team names.
This commit is contained in:
parent
3cc4718397
commit
b68eda6c66
@ -38,15 +38,20 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
if (action == "all") {
|
||||
p.ignoreAll = !p.ignoreAll;
|
||||
Player.Message(p, p.ignoreAll ? "&cNow ignoring all chat" : "&aNo longer ignoring all chat");
|
||||
Player.Message(p, "{0} ignoring all chat", p.ignoreAll ? "&cNow " : "&aNo longer ");
|
||||
CreateIgnoreFile(p); return;
|
||||
} else if (action == "irc") {
|
||||
p.ignoreIRC = !p.ignoreIRC;
|
||||
Player.Message(p, p.ignoreIRC ? "&cNow ignoring IRC chat" : "&aNo longer ignoring IRC chat");
|
||||
Player.Message(p, "{0} ignoring IRC chat", p.ignoreIRC ? "&cNow " : "&aNo longer ");
|
||||
CreateIgnoreFile(p); return;
|
||||
} else if (action == "global") {
|
||||
p.ignoreGlobal = !p.ignoreGlobal;
|
||||
Player.Message(p, p.ignoreGlobal ? "&cNow ignoring Global Chat" : "&aNo longer ignoring Global Chat");
|
||||
Player.Message(p, "{0} ignoring global chat", p.ignoreGlobal ? "&cNow " : "&aNo longer ");
|
||||
CreateIgnoreFile(p); return;
|
||||
} else if (action == "titles") {
|
||||
p.ignoreTitles = !p.ignoreTitles;
|
||||
Player.Message(p, "{0} show before names in chat",
|
||||
p.ignoreTitles ? "&cPlayer titles no longer" : "&aPlayer titles now");
|
||||
CreateIgnoreFile(p); return;
|
||||
} else if (action == "list") {
|
||||
Player.Message(p, "&cCurrently ignoring the following players:");
|
||||
@ -55,6 +60,7 @@ namespace MCGalaxy.Commands {
|
||||
if (p.ignoreAll) Player.Message(p, "&cIgnoring all chat");
|
||||
if (p.ignoreIRC) Player.Message(p, "&cIgnoring IRC chat");
|
||||
if (p.ignoreGlobal) Player.Message(p, "&cIgnoring global chat");
|
||||
if (p.ignoreTitles) Player.Message(p, "&cPlayer titles do not show before names in chat.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -100,6 +106,7 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, "%H If name is \"all\", all chat is ignored.");
|
||||
Player.Message(p, "%H If name is \"global\", MCGalaxy global chat is ignored.");
|
||||
Player.Message(p, "%H If name is \"irc\", IRC chat is ignored.");
|
||||
Player.Message(p, "%H If name is \"titles\", player titles before names are ignored.");
|
||||
Player.Message(p, "%HOtherwise, all chat from the player with [name] is ignored.");
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ namespace MCGalaxy {
|
||||
public bool onWhitelist = false;
|
||||
public bool whisper = false;
|
||||
public string whisperTo = "";
|
||||
public bool ignoreAll, ignoreGlobal, ignoreIRC;
|
||||
public bool ignoreAll, ignoreGlobal, ignoreIRC, ignoreTitles;
|
||||
|
||||
public string storedMessage = "";
|
||||
|
||||
|
@ -158,24 +158,28 @@ namespace MCGalaxy {
|
||||
public static void SendChatFrom(Player from, string message, bool showname) {
|
||||
if (from == null) return; // So we don't fucking derp the hell out!
|
||||
|
||||
if (Last50Chat.Count == 50)
|
||||
Last50Chat.RemoveAt(0);
|
||||
if (Last50Chat.Count == 50) Last50Chat.RemoveAt(0);
|
||||
var chatmessage = new ChatMessage();
|
||||
chatmessage.text = message;
|
||||
chatmessage.username = from.color + from.name;
|
||||
chatmessage.time = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss");
|
||||
|
||||
Last50Chat.Add(chatmessage);
|
||||
if (showname)
|
||||
message = from.voicestring + from.color + from.prefix + from.DisplayName + ": &f" + message;
|
||||
|
||||
string messageLite = message;
|
||||
if (showname) {
|
||||
string prefix = from.group.prefix == "" ? "" : "&f" + from.group.prefix;
|
||||
messageLite = from.voicestring + prefix + from.ColoredName + ": &f" + message;
|
||||
message = from.voicestring + from.FullName + ": &f" + message;
|
||||
}
|
||||
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (p.level.worldChat && p.Chatroom == null) {
|
||||
if (from != null && p.listignored.Contains(from.name)) continue;
|
||||
|
||||
string msg = p.ignoreTitles ? messageLite : message;
|
||||
if (!p.ignoreAll || (from != null && from == p))
|
||||
Player.Message(p, message);
|
||||
Player.Message(p, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -314,7 +318,7 @@ namespace MCGalaxy {
|
||||
Server.s.Log(name + " disconnected (" + discMsg + ").");
|
||||
} else {
|
||||
totalKicked++;
|
||||
SendChatFrom(this, "&c- " + color + prefix + DisplayName + " %Skicked (" + kickMsg + "%S).", false);
|
||||
SendChatFrom(this, "&c- " + FullName + " %Skicked (" + kickMsg + "%S).", false);
|
||||
Server.s.Log(name + " kicked (" + kickMsg + ").");
|
||||
}
|
||||
|
||||
@ -524,6 +528,7 @@ Next: continue;
|
||||
if (ignoreAll) w.WriteLine("&all");
|
||||
if (ignoreGlobal) w.WriteLine("&global");
|
||||
if (ignoreIRC) w.WriteLine("&irc");
|
||||
if (ignoreTitles) w.WriteLine("&titles");
|
||||
|
||||
foreach (string line in listignored)
|
||||
w.WriteLine(line);
|
||||
@ -544,16 +549,17 @@ Next: continue;
|
||||
if (line == "&global") ignoreGlobal = true;
|
||||
else if (line == "&all") ignoreAll = true;
|
||||
else if (line == "&irc") ignoreIRC = true;
|
||||
else if (line == "&titles") ignoreTitles = true;
|
||||
else listignored.Add(line);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Server.ErrorLog(ex);
|
||||
Server.s.Log("Failed to load ignore list for: " + name);
|
||||
}
|
||||
if (ignoreAll || ignoreGlobal || ignoreIRC || listignored.Count > 0) {
|
||||
|
||||
if (ignoreAll || ignoreGlobal || ignoreIRC || ignoreTitles || listignored.Count > 0)
|
||||
SendMessage("&cType &a/ignore list &cto see who you are still ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
internal void RemoveInvalidUndos() {
|
||||
UndoDrawOpEntry[] items = DrawOps.Items;
|
||||
|
Loading…
x
Reference in New Issue
Block a user