Fix cloudy brush noise messages showing even when /ignore drawoutput is on. (Thanks tornato)

This commit is contained in:
UnknownShadow200 2018-07-02 17:42:18 +10:00
parent 33561ee9d4
commit d0de51ef5d
3 changed files with 13 additions and 7 deletions

View File

@ -25,8 +25,8 @@ namespace MCGalaxy.SQL {
/// <summary> Executes an SQL command that does not return any results. </summary>
public static void Execute(string sql, object[] parameters, bool createDB) {
IDatabaseBackend db = Database.Backend;
using (IDbConnection conn = db.CreateConnection()) {
IDatabaseBackend db = Database.Backend;
using (IDbConnection conn = db.CreateConnection()) {
conn.Open();
if (!createDB && db.MultipleSchema)
conn.ChangeDatabase(ServerConfig.MySQLDatabaseName);
@ -41,7 +41,7 @@ namespace MCGalaxy.SQL {
/// <summary> Excecutes an SQL query, invoking a callback on the returned rows one by one. </summary>
public static object Iterate(string sql, object[] parameters, object arg, ReaderCallback callback) {
IDatabaseBackend db = Database.Backend;
IDatabaseBackend db = Database.Backend;
using (IDbConnection conn = db.CreateConnection()) {
conn.Open();
if (db.MultipleSchema)

View File

@ -47,7 +47,10 @@ namespace MCGalaxy.Drawing.Brushes {
public override string Name { get { return "Cloudy"; } }
public unsafe override void Configure(DrawOp op, Player p) {
Player.Message(p, "Calculating noise distribution...");
if (!p.Ignores.DrawOutput) {
Player.Message(p, "Calculating noise distribution...");
}
// Initalise our noise histogram
const int accuracy = 10000;
int* values = stackalloc int[accuracy];
@ -96,7 +99,10 @@ namespace MCGalaxy.Drawing.Brushes {
sum += values[i] / (float)volume;
}
thresholds[blocks.Length - 1] = 1;
Player.Message(p, "Finished calculating, now drawing.");
if (!p.Ignores.DrawOutput) {
Player.Message(p, "Finished calculating, now drawing.");
}
}
int next;

View File

@ -279,7 +279,7 @@ namespace MCGalaxy {
try {
lock (saveLock) {
using (StreamWriter w = new StreamWriter(path)) {
w.WriteLine("#Level properties for " + map);
w.WriteLine("#Level properties for " + map);
w.WriteLine("#Drown-time is in tenths of a second");
ConfigElement.Serialise(Server.levelConfig, w, this);
}