diff --git a/Commands/Moderation/CmdRankInfo.cs b/Commands/Moderation/CmdRankInfo.cs index 44eb46c1c..b6f796c91 100644 --- a/Commands/Moderation/CmdRankInfo.cs +++ b/Commands/Moderation/CmdRankInfo.cs @@ -50,8 +50,8 @@ namespace MCGalaxy.Commands { string reason = parts.Length <= 9 ? null : CP437Reader.ConvertToRaw(parts[9].Replace("%20", " ")); - Player.SendMessage(p, "&aRank changed from: " + newRank.color + newRank.name - + " &ato " + oldRank.color + oldRank.name); + Player.SendMessage(p, "&aRank changed from: " + oldRank.color + oldRank.name + + " &ato " + newRank.color + newRank.name); Player.SendMessage(p, "&aRanked by: %S" + parts[1] + " &aon %S" + timeRanked); if (reason != null) Player.SendMessage(p, "&aRank reason: %S" + reason); diff --git a/Commands/building/CustomBlockCommand.cs b/Commands/building/CustomBlockCommand.cs index 2f32afc67..beee53ef4 100644 --- a/Commands/building/CustomBlockCommand.cs +++ b/Commands/building/CustomBlockCommand.cs @@ -184,7 +184,7 @@ namespace MCGalaxy.Commands { } } else if (step == 11) { bool result = byte.TryParse(value, out bd.BlockDraw); - if (result && bd.BlockDraw >= 0 && bd.BlockDraw <= 3) + if (result && bd.BlockDraw >= 0 && bd.BlockDraw <= 4) step++; } else if (step == 12) { if (value == "0" || value == "1") { @@ -311,7 +311,7 @@ namespace MCGalaxy.Commands { def.Shape = value == "0" ? (byte)0 : def.MaxY; break; case "draw": case "blockdraw": - if (!EditByte(p, value, "Block draw", ref def.BlockDraw, 11, 1, 0, 3)) return; + if (!EditByte(p, value, "Block draw", ref def.BlockDraw, 11, 1, 0, 4)) return; break; case "min": case "mincoords": @@ -431,7 +431,7 @@ namespace MCGalaxy.Commands { }, new[] { "Type '0' if the block should be darkened when in shadow, '1' if not(e.g lava)." }, new[] { "Define the block's draw method.", "0 = Opaque, 1 = Transparent (Like glass)", - "2 = Transparent (Like leaves), 3 = Translucent (Like ice)", + "2 = Transparent (Like leaves), 3 = Translucent (Like ice), 4 = Gas (Like air)", }, new[] { "Type '0' if the block is treated as a sprite(e.g roses), '1' if not." }, new[] { "Enter the three minimum coordinates of the cube in pixels (separated by spaces). There are 16 pixels per block." }, diff --git a/Commands/other/CmdNick.cs b/Commands/other/CmdNick.cs index 86cc88cb1..531f8da61 100644 --- a/Commands/other/CmdNick.cs +++ b/Commands/other/CmdNick.cs @@ -1,54 +1,83 @@ +/* + Copyright 2015 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 MCGalaxy; -namespace MCGalaxy.Commands -{ - public class CmdNick : Command - { +namespace MCGalaxy.Commands { + + public class CmdNick : Command { + public override string name { get { return "nick"; } } public override string shortcut { get { return "nickname"; } } public override string type { get { return CommandTypes.Other; } } public override bool museumUsable { get { return true; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public CmdNick() { } + static char[] trimChars = { ' ' }; - public override void Use(Player p, string message) - { + public override void Use(Player p, string message) { if (message == "") { Help(p); return; } - - int pos = message.IndexOf(' '); - Player who = Player.Find(message.Split(' ')[0]); + string[] parts = message.Split(trimChars, 2); + + Player who = Player.Find(parts[0]); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } - if (p != null && who.group.Permission > p.group.Permission) - { - Player.SendMessage(p, "Cannot change the nick of someone of greater rank"); - return; + if (p != null && who.group.Permission > p.group.Permission) { + Player.SendMessage(p, "Cannot change the nick of someone of greater rank"); return; } - string query; - string newName = ""; - if (message.Split(' ').Length > 1) newName = message.Substring(pos + 1); - else - { + + string newName = parts.Length > 1 ? parts[1] : ""; + if (newName == "") { who.DisplayName = who.name; - Player.GlobalChat(who, who.color + who.prefix + who.DisplayName + "&g has reverted their nick to their original name.", false); - Player.GlobalDespawn(p, false); - Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); - return; + Player.GlobalChat(who, who.color + who.prefix + who.DisplayName + "%S has reverted their nick to their original name.", false); + } else { + if (newName.Length > 60) { Player.SendMessage(p, "Nick must be under 60 letters."); return; } + who.DisplayName = newName; + Player.GlobalChat(who, who.color + who.DisplayName + "%S has changed their nick to " + who.color + newName + "%S.", false); } - - if (newName.Length > 60) { Player.SendMessage(p, "Nick must be under 60 letters."); return; } - - if (newName != "") Player.GlobalChat(who, who.color + who.DisplayName + "&g has changed their nick to " + newName + "&g.", false); - who.DisplayName = newName; + Player.GlobalDespawn(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); PlayerDB.Save(who); } - public override void Help(Player p) - { + + public override void Help(Player p) { Player.SendMessage(p, "/nick [newName] - Gives the nick of [newName]."); Player.SendMessage(p, "If no [newName] is given, the player's nick is reverted to their original name."); } } + + public class CmdXNick : Command { + + public override string name { get { return "xnick"; } } + public override string shortcut { get { return "xnickname"; } } + public override string type { get { return CommandTypes.Other; } } + public override bool museumUsable { get { return true; } } + public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } + public CmdXNick() { } + + public override void Use(Player p, string message) { + Command.all.Find("nick").Use(p, p.name + " " + message); + } + + public override void Help(Player p) { + Player.SendMessage(p, "/xnick [newName] - Gives you the nick of [newName]."); + Player.SendMessage(p, "If no [newName] is given, your nick is reverted to your original name."); + } + } } diff --git a/Commands/other/CmdXNick.cs b/Commands/other/CmdXNick.cs deleted file mode 100644 index 6af21fc6b..000000000 --- a/Commands/other/CmdXNick.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using MCGalaxy; - -namespace MCGalaxy.Commands -{ - public class CmdXNick : Command - { - public override string name { get { return "xnick"; } } - public override string shortcut { get { return "xnickname"; } } - public override string type { get { return CommandTypes.Other; } } - public override bool museumUsable { get { return true; } } - public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } - public CmdXNick() { } - - public override void Use(Player p, string message) - { - if (message == "") - { - p.DisplayName = p.name; - Player.GlobalChat(p, p.color + p.prefix + p.DisplayName + "&g has reverted their nick to their original name.", false); - Player.GlobalDespawn(p, false); - Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); - return; - } - - string newName = ""; - newName = message; - - if (newName.Length > 60) { Player.SendMessage(p, "Nick must be under 60 letters."); return; } - - if (newName != "") Player.GlobalChat(p, p.color + p.DisplayName + "&g has changed their nick to " + newName + "&g.", false); - p.DisplayName = newName; - Player.GlobalDespawn(p, false); - Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); - PlayerDB.Save(p); - } - public override void Help(Player p) - { - Player.SendMessage(p, "/xnick [newName] - Gives you the nick of [newName]."); - Player.SendMessage(p, "If no [newName] is given, your nick is reverted to your original name."); - } - } -} - diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj index 01c329788..cbcb47f9c 100644 --- a/MCGalaxy_.csproj +++ b/MCGalaxy_.csproj @@ -363,7 +363,6 @@ - diff --git a/Player/Player.cs b/Player/Player.cs index 3285c9659..a8297f642 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -1241,8 +1241,10 @@ namespace MCGalaxy { Blockchange(this, x, y, z, Block.air, 0); } Messages.Dispose(); - } - catch { Player.SendMessage(p, "No message was stored."); return; } + } catch { + Player.SendMessage(p, "No message was stored."); + RevertBlock(x, y, z); return; + } } private void DeleteBlock(byte b, ushort x, ushort y, ushort z, byte type, byte extType) {