Make /b show contents of a /mb.

This commit is contained in:
UnknownShadow200 2016-09-02 08:31:55 +10:00
parent 2b49c1adee
commit 9d390d88d9

View File

@ -76,8 +76,9 @@ namespace MCGalaxy.Commands {
Output(p, user, block, deleted, now - time);
}
if (!foundOne)
Player.Message(p, "No block change records found for this block.");
if (!foundOne) Player.Message(p, "No block change records found for this block.");
OutputMessageBlock(p, b, x, y, z);
GC.Collect();
GC.WaitForPendingFinalizers();
}
@ -89,6 +90,23 @@ namespace MCGalaxy.Commands {
deleted ? "&4deleted%S (using " + bName + ")" : "&3placed%S " + bName);
}
static void OutputMessageBlock(Player p, byte block, ushort x, ushort y, ushort z) {
if (!Block.Props[block].IsMessageBlock) return;
try {
//safe against SQL injections because no user input is given here
DataTable Messages = Database.Fill("SELECT * FROM `Messages" + p.level.name +
"` WHERE X=@0 AND Y=@1 AND Z=@2", x, y, z);
int last = Messages.Rows.Count - 1;
if (last == -1) { Messages.Dispose(); return; }
string message = Messages.Rows[last]["Message"].ToString().Trim();
message = message.Replace("\\'", "\'");
Player.Message(p, "Message Block contents: " + message);
} catch {
}
}
public override void Help(Player p) {
Player.Message(p, "%T/about");
Player.Message(p, "%HOutputs the change/edit history for a block.");