Respect /ignore drawoutput in more cases

This commit is contained in:
Goodlyay 2025-09-17 20:32:33 -07:00
parent 06cd9259e0
commit 73a2f987fe
3 changed files with 16 additions and 7 deletions

View File

@ -94,7 +94,7 @@ namespace MCGalaxy.Commands.Building
}
}
p.Message("Place or break two blocks to determine the edges.");
DrawCmd.DrawMessage(p, "Place or break two blocks to determine the edges.");
int marks = cArgs.offsetIndex != -1 ? 3 : 2;
p.MakeSelection(marks, "Selecting region for &SCopy", cArgs, DoCopy, DoCopyMark);
}
@ -117,7 +117,7 @@ namespace MCGalaxy.Commands.Building
copy.Offset.Y = copy.OriginY - m[i].Y;
copy.Offset.Z = copy.OriginZ - m[i].Z;
p.Message("Set offset of where to paste from.");
DrawCmd.DrawMessage(p, "Set offset of where to paste from.");
CompleteCopy(p, m, cArgs);
return;
}
@ -157,14 +157,14 @@ namespace MCGalaxy.Commands.Building
cState.CopySource = "level " + p.level.name;
p.CurrentCopy = cState;
p.Message("Copied &a{0} &Sblocks, origin at ({1}, {2}, {3}) corner", cState.UsedBlocks,
DrawCmd.DrawMessage(p, "Copied &a{0} &Sblocks, origin at ({1}, {2}, {3}) corner", cState.UsedBlocks,
cState.OriginX == cState.X ? "Min" : "Max",
cState.OriginY == cState.Y ? "Min" : "Max",
cState.OriginZ == cState.Z ? "Min" : "Max");
if (!cState.PasteAir) p.Message("To also copy air blocks, use &T/Copy Air");
if (!cState.PasteAir) DrawCmd.DrawMessage(p, "To also copy air blocks, use &T/Copy Air");
if (cArgs.offsetIndex != -1) {
p.Message("Place a block to determine where to paste from");
DrawCmd.DrawMessage(p, "Place a block to determine where to paste from");
} else {
CompleteCopy(p, m, cArgs);
}

View File

@ -38,7 +38,7 @@ namespace MCGalaxy.Commands.Building {
BrushArgs args = new BrushArgs(p, message, Block.Air);
if (!BrushFactory.Find("Paste").Validate(args)) return;
p.Message("Place a block in the corner of where you want to paste.");
DrawCmd.DrawMessage(p, "Place a block in the corner of where you want to paste.");
p.MakeSelection(1, "Selecting location for &SPaste", args, DoPaste);
}

View File

@ -42,7 +42,7 @@ namespace MCGalaxy.Commands.Building {
BrushArgs bArgs = new BrushArgs(p, dArgs.BrushArgs, dArgs.Block);
if (!factory.Validate(bArgs)) return;
p.Message(PlaceMessage);
DrawMessage(p, PlaceMessage);
p.MakeSelection(MarksCount, "Selecting " + SelectionType + " for &S" + dArgs.Op.Name, dArgs, DoDraw);
}
@ -93,6 +93,15 @@ namespace MCGalaxy.Commands.Building {
dArgs.BrushArgs = dArgs.Message.Splice(dArgs.ModeArgsCount, 0);
}
/// <summary>
/// Sends a draw-command-feedback related message to the player.
/// If the player ignores draw output and supports MessageTypes, the message will not be sent.
/// Serves the purpose of minimising chat spam while ensuring the player can tell a draw op is happening even if output is ignored
/// </summary>
public static void DrawMessage(Player p, string message, params object[] args) {
if (p.Ignores.DrawOutput && p.Supports(CpeExt.MessageTypes)) return;
p.Message(message, args);
}
protected class DrawArgs {
public DrawMode Mode;
public BlockID Block;