From 73a2f987fe78b56d122f783bdbd2d2f2db746be6 Mon Sep 17 00:00:00 2001 From: Goodlyay Date: Wed, 17 Sep 2025 20:32:33 -0700 Subject: [PATCH] Respect /ignore drawoutput in more cases --- MCGalaxy/Commands/building/CmdCopy.cs | 10 +++++----- MCGalaxy/Commands/building/CmdPaste.cs | 2 +- MCGalaxy/Commands/building/DrawCmd.cs | 11 ++++++++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/MCGalaxy/Commands/building/CmdCopy.cs b/MCGalaxy/Commands/building/CmdCopy.cs index d1db95753..44aabbee9 100644 --- a/MCGalaxy/Commands/building/CmdCopy.cs +++ b/MCGalaxy/Commands/building/CmdCopy.cs @@ -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); } diff --git a/MCGalaxy/Commands/building/CmdPaste.cs b/MCGalaxy/Commands/building/CmdPaste.cs index b519feeda..005b38a88 100644 --- a/MCGalaxy/Commands/building/CmdPaste.cs +++ b/MCGalaxy/Commands/building/CmdPaste.cs @@ -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); } diff --git a/MCGalaxy/Commands/building/DrawCmd.cs b/MCGalaxy/Commands/building/DrawCmd.cs index 49f6fb207..832ea2b48 100644 --- a/MCGalaxy/Commands/building/DrawCmd.cs +++ b/MCGalaxy/Commands/building/DrawCmd.cs @@ -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); } + /// + /// 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 + /// + 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;