diff --git a/Changelog.txt b/Changelog.txt index 3e344b5c2..4a800a9e3 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,79 @@ +v1.8.0.0 +- Fixed /undo from console and IRC not doing anything after restart. +- /texture with a scope without a url will output the current url for that scope. +- Fixed not being able to whisper from console. +- Fixed /portal show not working. +- Fixed 'survival' mode not working properly. +- Implemented EnvMapAppearance version 2, allowing usage of .zip texture packs, changing of cloud height, and limiting to a max fog distance. +- Fixed cases where some IRC colour codes were not being converted. +- Fixed code page 437 characters not working with IRC. +- Add 'buildable' and 'deleteable' properties to maps, allowing building/deleting to be disabled client side. +- Fixed IRC announcing secondary disconnect of hidden players. +- Added /pclients command which outputs which clients the players are using. +- Implemented BlockDefinitions, with a /gb command to go with it. +- Removed 'GrieferStone' and old 'Anti-tunneling' code. +- Fix guns not being disabled on maps that didn't allow guns. +- Implement a new undo binary file format that is much more efficient space and parsing wise. +- Removed /quick. +- Removed the old and broken translation stuff. +- Fixed some .x IRC commands crashing the server. +- Fixed /players not working. +- Fixed global chat not working. +- Implemented CPE LongerMessages extension. +- Added /reach, allowing players to place/delete blocks further away. +- Removed /megaboid, removed old MCForge protection code. +- Fixed /spin not working on recent mono versions. +- Optimised /copy and /paste to be much more memory efficient. +- Created /tpa and /hug commands. +- Implemented CPE CPFull437 extension, allowing usage of all code page 437 characters in chat, commands, and messages. +- Begun work on BlockDefinitions. +- Updated help for /env to be more visually nice. +- DisplayName is used in most places instead of name. +- Fixed some cases of hidden players being revealed. +- Added /mark command that 'marks' the current position as a coordinate for selections/cuboids etc. +- Added /os block, unblock, kickall, kick, and blacklist. +- /ranks show ranks logs for a player. +- Added /promote and /demote which also show rank reasons. +- Prevent hidden players interacting with killer blocks. +- Added an 'empty' map generation type. +- Prevent slapping of hidden players. +- Fix /freeze not working with console. +- Added /xmodel. +v1.7.3.0 +- Show env properties in /mapinfo. +- Add more os commands: weather, env, texture, motd, pervisit, allowguns +- Cannot set pervisit to higher than own rank. +- Reintroduced emotes. +- Fixed model not changing your own player model until reload. +- Removed Global Chat banlist update. +- Removed ability to change global change nick. +- No message causes current level to be used for /unload. +- Show level texture in /mapinfo, fix level.properties not saving. +- Created a new /help menu layout. +- Fixed /scinema error. +- Created /xnick, /xtitle, /xtcolor, /xcolor. +- Made warnings visible in IRC/GUI. +- Temp fix for MCGalaxy-protection-levl. +- Use /tcolor (or normal color if no title color) for both brakcers in player title. +- Adminchat should be turned on when using /xhide. +- Hidden players should not be announced as AFK. +- prevent /hackrank being used to spam. +v1.7.0.0 +- Add an api for localhost. +- Made /reloadcontrollers, not exposed though. +- Fix commands not working on console. +- Allow saving own map with /os map save. +- Fixed /env save issue. + +v1.6.0.0 +- Added /quit. +- Added /env. +v1.5.1.2 +- Fix IRC commands and colors. +v1.5.0.7 + - IRC color codes supported. + - /whonick added. + - Implemented EnvMapAppearance. v1.0.3.1 - Fixed aliases (hopefully) v1.0.0.2 diff --git a/Commands/World/CmdTexture.cs b/Commands/World/CmdTexture.cs index 58b3fdb98..57217f3a8 100644 --- a/Commands/World/CmdTexture.cs +++ b/Commands/World/CmdTexture.cs @@ -30,10 +30,23 @@ namespace MCGalaxy.Commands { public override void Use(Player p, string message) { if (message == "") { Help(p); return; } string[] args = message.Split(' '); - if (args.Length != 2) { Help(p); return; } string scope = args[0].ToLower(); - string url = args[1]; + if (args.Length == 1) { + if (scope == "level") + Player.SendMessage(p, "Level terrain: " + GetPath(p.level.terrainUrl)); + else if (scope == "levelzip") + Player.SendMessage(p, "Level tex pack: " + GetPath(p.level.texturePackUrl)); + else if (scope == "global") + Player.SendMessage(p, "Global terrain: " + GetPath(Server.defaultTerrainUrl)); + else if (scope == "globalzip") + Player.SendMessage(p, "Global tex pack: " + GetPath(Server.defaultTexturePackUrl)); + else + Help(p); + return; + } + + string url = args[1]; if (url.ToLower() == "normal" || url.ToLower() == "reset") { url = ""; } else if (!(url.StartsWith("http://") || url.StartsWith("https://"))) { @@ -66,6 +79,10 @@ namespace MCGalaxy.Commands { } } + static string GetPath(string url) { + return url == "" ? "(none)" : url; + } + void UpdateGlobally(Player p, bool zip) { foreach (Player pl in Player.players) { bool hasExt = pl.HasCpeExt(CpeExt.EnvMapAppearance) || pl.HasCpeExt(CpeExt.EnvMapAppearance, 2); diff --git a/Database/DatabaseTransactionHelper.cs b/Database/DatabaseTransactionHelper.cs index f8a26338e..d60be68b3 100644 --- a/Database/DatabaseTransactionHelper.cs +++ b/Database/DatabaseTransactionHelper.cs @@ -39,7 +39,7 @@ namespace MCGalaxy } } - public abstract void Execute(string query); + public abstract bool Execute(string query); public abstract void Commit(); diff --git a/Database/MySQLTransactionHelper.cs b/Database/MySQLTransactionHelper.cs index c482d7bd7..62e1debc2 100644 --- a/Database/MySQLTransactionHelper.cs +++ b/Database/MySQLTransactionHelper.cs @@ -1,19 +1,19 @@ /* - Copyright 2011 MCGalaxy - - Dual-licensed under the Educational Community License, Version 2.0 and - the GNU General Public License, Version 3 (the "Licenses"); you may - not use this file except in compliance with the Licenses. You may - obtain a copy of the Licenses at - - http://www.opensource.org/licenses/ecl2.php - http://www.gnu.org/licenses/gpl-3.0.html - - Unless required by applicable law or agreed to in writing, - software distributed under the Licenses are distributed on an "AS IS" - BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the Licenses for the specific language governing - permissions and limitations under the Licenses. + Copyright 2011 MCGalaxy + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. */ using System; using System.Collections.Generic; @@ -64,7 +64,7 @@ namespace MCGalaxy } } - public override void Execute(string query) + public override bool Execute(string query) { try { using (MySqlCommand cmd = new MySqlCommand(query, connection, transaction)) { @@ -73,7 +73,9 @@ namespace MCGalaxy } catch (Exception e) { System.IO.File.AppendAllText("MySQL_error.log", DateTime.Now + " " + query + "\r\n"); Server.ErrorLog(e); + return false; } + return true; } public override void Commit() diff --git a/Database/SQLiteTransactionHelper.cs b/Database/SQLiteTransactionHelper.cs index 4c57628b8..d6444a7d2 100644 --- a/Database/SQLiteTransactionHelper.cs +++ b/Database/SQLiteTransactionHelper.cs @@ -1,19 +1,19 @@ /* - Copyright 2011 MCGalaxy - - Dual-licensed under the Educational Community License, Version 2.0 and - the GNU General Public License, Version 3 (the "Licenses"); you may - not use this file except in compliance with the Licenses. You may - obtain a copy of the Licenses at - - http://www.opensource.org/licenses/ecl2.php - http://www.gnu.org/licenses/gpl-3.0.html - - Unless required by applicable law or agreed to in writing, - software distributed under the Licenses are distributed on an "AS IS" - BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the Licenses for the specific language governing - permissions and limitations under the Licenses. + Copyright 2011 MCGalaxy + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. */ using System; using System.Data.SQLite; @@ -64,7 +64,7 @@ namespace MCGalaxy } } - public override void Execute(string query) + public override bool Execute(string query) { try { using (SQLiteCommand cmd = new SQLiteCommand(query, connection, transaction)) { @@ -73,8 +73,9 @@ namespace MCGalaxy } catch (Exception e) { System.IO.File.AppendAllText("MySQL_error.log", DateTime.Now + " " + query + "\r\n"); Server.ErrorLog(e); - throw e; // Ensures that only one error is thrown (though two will be caught.) + return false; } + return true; } public override void Commit() diff --git a/Levels/Level.cs b/Levels/Level.cs index 594562390..d15594fb6 100644 --- a/Levels/Level.cs +++ b/Levels/Level.cs @@ -356,9 +356,11 @@ namespace MCGalaxy { int deleted = bP.deleted ? 1 : 0; IntToPos(bP.index, out x, out y, out z); - transaction.Execute(String.Format(template, bP.name, + if (!transaction.Execute(String.Format(template, bP.name, bP.TimePerformed.ToString("yyyy-MM-dd HH:mm:ss"), - x, y, z, bP.type, deleted)); + x, y, z, bP.type, deleted))) { + + } } transaction.Commit(); } diff --git a/Player/Undo/UndoFile.cs b/Player/Undo/UndoFile.cs index 23583e9de..01a2b212f 100644 --- a/Player/Undo/UndoFile.cs +++ b/Player/Undo/UndoFile.cs @@ -54,7 +54,7 @@ namespace MCGalaxy.Util { int numFiles = Directory.GetFiles(playerDir).Length; string path = Path.Combine(playerDir, numFiles + NewFormat.Extension); - NewFormat.SaveUndoData(p.UndoBuffer, path); + NewFormat.SaveUndoData(p.UndoBuffer.ToList(), path); } public static void UndoPlayer(Player p, string targetName, long seconds, ref bool FoundUser) { diff --git a/Player/Undo/UndoFileBin.cs b/Player/Undo/UndoFileBin.cs index 01fa9eefe..0f1545dcc 100644 --- a/Player/Undo/UndoFileBin.cs +++ b/Player/Undo/UndoFileBin.cs @@ -80,6 +80,7 @@ namespace MCGalaxy.Util { List list = new List(); DateTime now = DateTime.Now; Player.UndoPos Pos; + bool isPlayer = p != null && p.group.Permission < LevelPermission.Nobody; using (Stream fs = File.OpenRead(path)) using (BinaryReader r = new BinaryReader(fs)) @@ -90,7 +91,7 @@ namespace MCGalaxy.Util { Level lvl; if (!CheckChunk(chunk, now, seconds, p, out lvl)) return false; - if (lvl == null || lvl != p.level) continue; + if (lvl == null || (isPlayer && lvl != p.level)) continue; Pos.mapName = chunk.LevelName; fs.Seek(chunk.DataPosition, SeekOrigin.Begin); @@ -113,7 +114,7 @@ namespace MCGalaxy.Util { Pos.newtype = oldType; Pos.newExtType = oldExtType; Pos.extType = newExtType; Pos.timePlaced = now; lvl.Blockchange(Pos.x, Pos.y, Pos.z, Pos.newtype, true, "", Pos.newExtType); - if (p != null) + if (isPlayer) p.RedoBuffer.Add(Pos); } }