mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Add /ignore drawoutput to ignore output of draw commands. (Thanks goodlyay)
This commit is contained in:
parent
ea23d13877
commit
e5e565cbf1
@ -36,34 +36,29 @@ namespace MCGalaxy.Commands.Chatting {
|
|||||||
string action = args[0].ToLower();
|
string action = args[0].ToLower();
|
||||||
|
|
||||||
if (action == "all") {
|
if (action == "all") {
|
||||||
p.ignoreAll = !p.ignoreAll;
|
Toggle(p, ref p.ignoreAll, "{0} ignoring all chat"); return;
|
||||||
Player.Message(p, "{0} ignoring all chat", p.ignoreAll ? "&cNow" : "&aNo longer");
|
|
||||||
SaveIgnores(p); return;
|
|
||||||
} else if (action == "irc") {
|
} else if (action == "irc") {
|
||||||
p.ignoreIRC = !p.ignoreIRC;
|
Toggle(p, ref p.ignoreIRC, "{0} ignoring IRC chat"); return;
|
||||||
Player.Message(p, "{0} ignoring IRC chat", p.ignoreIRC ? "&cNow" : "&aNo longer");
|
|
||||||
SaveIgnores(p); return;
|
|
||||||
} else if (action == "titles") {
|
} else if (action == "titles") {
|
||||||
p.ignoreTitles = !p.ignoreTitles;
|
Toggle(p, ref p.ignoreTitles, "{1}Player titles {0} show before names in chat"); return;
|
||||||
Player.Message(p, "{0} show before names in chat",
|
|
||||||
p.ignoreTitles ? "&cPlayer titles no longer" : "&aPlayer titles now");
|
|
||||||
SaveIgnores(p); return;
|
|
||||||
} else if (action == "nicks") {
|
} else if (action == "nicks") {
|
||||||
p.ignoreNicks = !p.ignoreNicks;
|
Toggle(p, ref p.ignoreNicks, "{1}Custom player nicks {0} show in chat"); return;
|
||||||
Player.Message(p, "{0} show in chat",
|
|
||||||
p.ignoreNicks ? "&cCustom player nicks no longer" : "&aCustom player nicks");
|
|
||||||
SaveIgnores(p); return;
|
|
||||||
} else if (action == "8ball") {
|
} else if (action == "8ball") {
|
||||||
p.ignore8ball = !p.ignore8ball;
|
Toggle(p, ref p.ignore8ball, "{0} ignoring %T/8ball"); return;
|
||||||
Player.Message(p, "{0} ignoring %T/8ball", p.ignore8ball ? "&cNow" : "&aNo longer");
|
} else if (action == "drawoutput") {
|
||||||
SaveIgnores(p); return;
|
Toggle(p, ref p.ignoreDrawOutput, "{0} ignoring draw command output"); return;
|
||||||
} else if (action == "list") {
|
} else if (action == "list") {
|
||||||
Player.Message(p, "&cCurrently ignoring the following players:");
|
|
||||||
string names = p.listignored.Join();
|
string names = p.listignored.Join();
|
||||||
if (names != "") Player.Message(p, names);
|
if (names != "") {
|
||||||
|
Player.Message(p, "&cCurrently ignoring the following players:");
|
||||||
|
Player.Message(p, names);
|
||||||
|
}
|
||||||
|
|
||||||
if (p.ignoreAll) Player.Message(p, "&cIgnoring all chat");
|
if (p.ignoreAll) Player.Message(p, "&cIgnoring all chat");
|
||||||
if (p.ignoreIRC) Player.Message(p, "&cIgnoring IRC chat");
|
if (p.ignoreIRC) Player.Message(p, "&cIgnoring IRC chat");
|
||||||
if (p.ignore8ball) Player.Message(p, "&cIgnoring %T/8ball");
|
if (p.ignore8ball) Player.Message(p, "&cIgnoring %T/8ball");
|
||||||
|
|
||||||
|
if (p.ignoreDrawOutput) Player.Message(p, "&cIgnoring draw command output.");
|
||||||
if (p.ignoreTitles) Player.Message(p, "&cPlayer titles do not show before names in chat.");
|
if (p.ignoreTitles) Player.Message(p, "&cPlayer titles do not show before names in chat.");
|
||||||
if (p.ignoreNicks) Player.Message(p, "&cCustom player nicks do not show in chat.");
|
if (p.ignoreNicks) Player.Message(p, "&cCustom player nicks do not show in chat.");
|
||||||
return;
|
return;
|
||||||
@ -99,6 +94,15 @@ namespace MCGalaxy.Commands.Chatting {
|
|||||||
SaveIgnores(p);
|
SaveIgnores(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Toggle(Player p, ref bool ignore, string format) {
|
||||||
|
ignore = !ignore;
|
||||||
|
if (format.StartsWith("{0}")) {
|
||||||
|
Player.Message(p, format, ignore ? "&cNow" : "&aNo longer");
|
||||||
|
} else {
|
||||||
|
Player.Message(p, format, ignore ? "now" : "no longer", ignore ? "&c" : "&a");
|
||||||
|
}
|
||||||
|
SaveIgnores(p);
|
||||||
|
}
|
||||||
static void SaveIgnores(Player p) {
|
static void SaveIgnores(Player p) {
|
||||||
string path = "ranks/ignore/" + p.name + ".txt";
|
string path = "ranks/ignore/" + p.name + ".txt";
|
||||||
if (!Directory.Exists("ranks/ignore"))
|
if (!Directory.Exists("ranks/ignore"))
|
||||||
@ -109,6 +113,8 @@ namespace MCGalaxy.Commands.Chatting {
|
|||||||
if (p.ignoreAll) w.WriteLine("&all");
|
if (p.ignoreAll) w.WriteLine("&all");
|
||||||
if (p.ignoreIRC) w.WriteLine("&irc");
|
if (p.ignoreIRC) w.WriteLine("&irc");
|
||||||
if (p.ignore8ball) w.WriteLine("&8ball");
|
if (p.ignore8ball) w.WriteLine("&8ball");
|
||||||
|
|
||||||
|
if (p.ignoreDrawOutput) w.WriteLine("&drawoutput");
|
||||||
if (p.ignoreTitles) w.WriteLine("&titles");
|
if (p.ignoreTitles) w.WriteLine("&titles");
|
||||||
if (p.ignoreNicks) w.WriteLine("&nicks");
|
if (p.ignoreNicks) w.WriteLine("&nicks");
|
||||||
|
|
||||||
@ -126,7 +132,8 @@ namespace MCGalaxy.Commands.Chatting {
|
|||||||
Player.Message(p, "%HUsing the same name again will unignore.");
|
Player.Message(p, "%HUsing the same name again will unignore.");
|
||||||
Player.Message(p, "%H If name is \"all\", all chat is ignored.");
|
Player.Message(p, "%H If name is \"all\", all chat is ignored.");
|
||||||
Player.Message(p, "%H If name is \"irc\", IRC chat is ignored.");
|
Player.Message(p, "%H If name is \"irc\", IRC chat is ignored.");
|
||||||
Player.Message(p, "%H If name is \"8ball\", %T/8ball %Sis ignored.");
|
Player.Message(p, "%H If name is \"8ball\", %T/8ball %His ignored.");
|
||||||
|
Player.Message(p, "%H If name is \"drawoutput\", drawing command output is ignored.");
|
||||||
Player.Message(p, "%H If name is \"titles\", player titles before names are ignored.");
|
Player.Message(p, "%H If name is \"titles\", player titles before names are ignored.");
|
||||||
Player.Message(p, "%H If name is \"nicks\", custom player nicks do not show in chat.");
|
Player.Message(p, "%H If name is \"nicks\", custom player nicks do not show in chat.");
|
||||||
Player.Message(p, "%HOtherwise, all chat from the player with [name] is ignored.");
|
Player.Message(p, "%HOtherwise, all chat from the player with [name] is ignored.");
|
||||||
|
@ -67,16 +67,19 @@ namespace MCGalaxy.Drawing.Ops {
|
|||||||
long affected = op.BlocksAffected(lvl, marks);
|
long affected = op.BlocksAffected(lvl, marks);
|
||||||
if (p != null && op.AffectedByTransform)
|
if (p != null && op.AffectedByTransform)
|
||||||
p.Transform.GetBlocksAffected(ref affected);
|
p.Transform.GetBlocksAffected(ref affected);
|
||||||
|
if (checkLimit && !op.CanDraw(marks, p, affected)) return false;
|
||||||
|
|
||||||
if (checkLimit && !op.CanDraw(marks, p, affected))
|
|
||||||
return false;
|
|
||||||
if (brush != null && affected != -1) {
|
if (brush != null && affected != -1) {
|
||||||
const string format = "{0}({1}): affecting up to {2} blocks";
|
const string format = "{0}({1}): affecting up to {2} blocks";
|
||||||
|
if (p == null || !p.ignoreDrawOutput) {
|
||||||
Player.Message(p, format, op.Name, brush.Name, affected);
|
Player.Message(p, format, op.Name, brush.Name, affected);
|
||||||
|
}
|
||||||
} else if (affected != -1) {
|
} else if (affected != -1) {
|
||||||
const string format = "{0}: affecting up to {1} blocks";
|
const string format = "{0}: affecting up to {1} blocks";
|
||||||
|
if (p == null || !p.ignoreDrawOutput) {
|
||||||
Player.Message(p, format, op.Name, affected);
|
Player.Message(p, format, op.Name, affected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DoQueuedDrawOp(p, op, brush, marks);
|
DoQueuedDrawOp(p, op, brush, marks);
|
||||||
return true;
|
return true;
|
||||||
@ -190,7 +193,9 @@ namespace MCGalaxy.Drawing.Ops {
|
|||||||
|
|
||||||
// Potentially buffer the block change
|
// Potentially buffer the block change
|
||||||
if (op.TotalModified == ServerConfig.DrawReloadLimit) {
|
if (op.TotalModified == ServerConfig.DrawReloadLimit) {
|
||||||
|
if (p == null || !p.ignoreDrawOutput) {
|
||||||
Player.Message(p, "Changed over {0} blocks, preparing to reload map..", ServerConfig.DrawReloadLimit);
|
Player.Message(p, "Changed over {0} blocks, preparing to reload map..", ServerConfig.DrawReloadLimit);
|
||||||
|
}
|
||||||
lock (lvl.queueLock)
|
lock (lvl.queueLock)
|
||||||
lvl.blockqueue.Clear();
|
lvl.blockqueue.Clear();
|
||||||
} else if (op.TotalModified < ServerConfig.DrawReloadLimit) {
|
} else if (op.TotalModified < ServerConfig.DrawReloadLimit) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user