diff --git a/MCGalaxy/Blocks/Physics/HunterPhysics.cs b/MCGalaxy/Blocks/Physics/HunterPhysics.cs index 53288a9fe..850a4152c 100644 --- a/MCGalaxy/Blocks/Physics/HunterPhysics.cs +++ b/MCGalaxy/Blocks/Physics/HunterPhysics.cs @@ -45,7 +45,7 @@ namespace MCGalaxy.Blocks.Physics { case 5: case 6: if (closest.Pos.BlockY - y != 0) { - index = lvl.PosToInt(x, (ushort)(y + Math.Sign(closest.Pos.BlockY - y)), z); + index = lvl.PosToInt(x, (ushort)(y + Math.Sign(closest.Pos.BlockY - y)), z); if (MoveFish(lvl, C.b, index, target)) return; } dirsVisited++; @@ -55,7 +55,7 @@ namespace MCGalaxy.Blocks.Physics { case 8: case 9: if (closest.Pos.BlockZ - z != 0) { - index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z))); + index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z))); if (MoveFish(lvl, C.b, index, target)) return; } dirsVisited++; @@ -80,7 +80,7 @@ namespace MCGalaxy.Blocks.Physics { case 2: case 3: if (closest.Pos.BlockX - x != 0) { - index = lvl.PosToInt((ushort)(x - Math.Sign(closest.Pos.BlockX - x)), y, z); + index = lvl.PosToInt((ushort)(x - Math.Sign(closest.Pos.BlockX - x)), y, z); if (MoveFish(lvl, C.b, index, target)) return; } dirsVisited++; @@ -90,7 +90,7 @@ namespace MCGalaxy.Blocks.Physics { case 5: case 6: if (closest.Pos.BlockY - y != 0) { - index = lvl.PosToInt(x, (ushort)(y - Math.Sign(closest.Pos.BlockY - y)), z); + index = lvl.PosToInt(x, (ushort)(y - Math.Sign(closest.Pos.BlockY - y)), z); if (MoveFish(lvl, C.b, index, target)) return; } dirsVisited++; @@ -100,7 +100,7 @@ namespace MCGalaxy.Blocks.Physics { case 8: case 9: if (closest.Pos.BlockZ - z != 0) { - index = lvl.PosToInt(x, y, (ushort)(z - Math.Sign(closest.Pos.BlockZ - z))); + index = lvl.PosToInt(x, y, (ushort)(z - Math.Sign(closest.Pos.BlockZ - z))); if (MoveFish(lvl, C.b, index, target)) return; } dirsVisited++; diff --git a/MCGalaxy/Blocks/Physics/ZombiePhysics.cs b/MCGalaxy/Blocks/Physics/ZombiePhysics.cs index ec7681dc9..6e090f2ec 100644 --- a/MCGalaxy/Blocks/Physics/ZombiePhysics.cs +++ b/MCGalaxy/Blocks/Physics/ZombiePhysics.cs @@ -45,7 +45,7 @@ namespace MCGalaxy.Blocks.Physics { index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign((closest.Pos.BlockZ - z)))); if (index != C.b && MoveZombie(lvl, ref C, index)) return; } else { - index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z))); + index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z))); if (index != C.b && MoveZombie(lvl, ref C, index)) return; index = lvl.PosToInt((ushort)(x + Math.Sign(closest.Pos.BlockX - x)), y, z); diff --git a/MCGalaxy/Bots/PlayerBot.cs b/MCGalaxy/Bots/PlayerBot.cs index 4b5c33133..05e0ae9b0 100644 --- a/MCGalaxy/Bots/PlayerBot.cs +++ b/MCGalaxy/Bots/PlayerBot.cs @@ -166,7 +166,7 @@ namespace MCGalaxy { DoMove(); } - // TODO: check if external code modified pos/rot + // TODO: check if external code modified pos/rot byte[] packet = Entities.GetPositionPacket(this); lastPos = Pos; lastRot = Rot; if (packet == null) return; diff --git a/MCGalaxy/Chat/ProfanityFilter.cs b/MCGalaxy/Chat/ProfanityFilter.cs index cf135fe6c..c6a053a16 100644 --- a/MCGalaxy/Chat/ProfanityFilter.cs +++ b/MCGalaxy/Chat/ProfanityFilter.cs @@ -37,7 +37,7 @@ namespace MCGalaxy { // Replace any whole word containing a bad word inside it (including partial word matches) static string FilterWords(string text) { - string[] words = text.SplitSpaces(); + string[] words = text.SplitSpaces(); string[] reduced = Reduce(text).SplitSpaces(); // Loop through each reduced word, looking for a bad word diff --git a/MCGalaxy/Commands/CPE/CmdEntityRot.cs b/MCGalaxy/Commands/CPE/CmdEntityRot.cs index 3171ac15e..4290f8653 100644 --- a/MCGalaxy/Commands/CPE/CmdEntityRot.cs +++ b/MCGalaxy/Commands/CPE/CmdEntityRot.cs @@ -37,44 +37,39 @@ namespace MCGalaxy.Commands.CPE { UseBotOrPlayer(p, message, "rotation"); } - protected override void SetBotData(Player p, PlayerBot bot, string[] args) { - EntityProp prop = EntityProp.RotX; - int angle = 0; - if (!ParseArgs(p, args, 2, ref prop, ref angle)) return; - - Entities.UpdateEntityProp(bot, prop, angle); + protected override void SetBotData(Player p, PlayerBot bot, string args) { + if (!ParseArgs(p, args, bot)) return; BotsFile.UpdateBot(bot); } - protected override void SetPlayerData(Player p, Player who, string[] args) { - EntityProp prop = EntityProp.RotX; - int angle = 0; - if (!ParseArgs(p, args, 1, ref prop, ref angle)) return; - - Entities.UpdateEntityProp(who, prop, angle); + protected override void SetPlayerData(Player p, Player who, string args) { + if (!ParseArgs(p, args, who)) return; Server.rotations.AddOrReplace(who.name, who.Rot.RotX + " " + who.Rot.RotZ); Server.rotations.Save(); } - static bool ParseArgs(Player p, string[] args, int i, ref EntityProp prop, ref int angle) { - string[] bits; - if (args.Length <= i) { - Player.Message(p, "You need to provide an axis name and angle."); return false; + static bool ParseArgs(Player p, string args, Entity entity) { + if (args == "") { + Entities.UpdateEntityProp(entity, EntityProp.RotX, 0); + Entities.UpdateEntityProp(entity, EntityProp.RotZ, 0); + return true; } - bits = args[i].SplitSpaces(); + + string[] bits = args.SplitSpaces(); if (bits.Length != 2) { Player.Message(p, "You need to provide an axis name and angle."); return false; } + int angle = 0; + if (!CommandParser.GetInt(p, bits[1], "Angle", ref angle, -360, 360)) return false; if (bits[0].CaselessEq("x")) { - prop = EntityProp.RotX; + Entities.UpdateEntityProp(entity, EntityProp.RotX, angle); } else if (bits[0].CaselessEq("z")) { - prop = EntityProp.RotZ; + Entities.UpdateEntityProp(entity, EntityProp.RotZ, angle); } else { Player.Message(p, "Axis name must be X or Z."); return false; } - - return CommandParser.GetInt(p, bits[1], "Angle", ref angle, -360, 360); + return true; } public override void Help(Player p) { diff --git a/MCGalaxy/Commands/CPE/CmdModel.cs b/MCGalaxy/Commands/CPE/CmdModel.cs index 478329a5a..5a6e9bb4c 100644 --- a/MCGalaxy/Commands/CPE/CmdModel.cs +++ b/MCGalaxy/Commands/CPE/CmdModel.cs @@ -40,16 +40,16 @@ namespace MCGalaxy.Commands.CPE { UseBotOrPlayer(p, message, "model"); } - protected override void SetBotData(Player p, PlayerBot bot, string[] args) { - string model = GetModel(p, args, 2); + protected override void SetBotData(Player p, PlayerBot bot, string model) { + model = GetModel(model); Entities.UpdateModel(bot, model); Player.Message(p, "You changed the model of bot " + bot.ColoredName + " %Sto a &c" + model); BotsFile.UpdateBot(bot); } - protected override void SetPlayerData(Player p, Player who, string[] args) { - string model = GetModel(p, args, 1); + protected override void SetPlayerData(Player p, Player who, string model) { + model = GetModel(model); Entities.UpdateModel(who, model); if (p != who) { @@ -66,8 +66,8 @@ namespace MCGalaxy.Commands.CPE { Server.models.Save(); } - static string GetModel(Player p, string[] args, int i) { - string model = args.Length > i ? args[i] : "humanoid"; + static string GetModel(string model) { + if (model == "") model = "humanoid"; model = model.ToLower(); model = model.Replace(':', '|'); // since many assume : is for scale instead of |. return model; diff --git a/MCGalaxy/Commands/CPE/CmdSkin.cs b/MCGalaxy/Commands/CPE/CmdSkin.cs index 4fccdc8de..bcd575c52 100644 --- a/MCGalaxy/Commands/CPE/CmdSkin.cs +++ b/MCGalaxy/Commands/CPE/CmdSkin.cs @@ -36,9 +36,8 @@ namespace MCGalaxy.Commands.CPE { UseBotOrPlayer(p, message, "skin"); } - protected override void SetBotData(Player p, PlayerBot bot, string[] args) { - string skin = GetSkin(p, args, 2, bot.name); - if (skin == null) return; + protected override void SetBotData(Player p, PlayerBot bot, string skin) { + skin = GetSkin(skin, bot.name); bot.SkinName = skin; Player.Message(p, "You changed the skin of bot " + bot.ColoredName + " %Sto &c" + skin); @@ -47,9 +46,8 @@ namespace MCGalaxy.Commands.CPE { BotsFile.UpdateBot(bot); } - protected override void SetPlayerData(Player p, Player who, string[] args) { - string skin = GetSkin(p, args, 1, who.truename); - if (skin == null) return; + protected override void SetPlayerData(Player p, Player who, string skin) { + skin = GetSkin(skin, who.truename); who.SkinName = skin; Entities.GlobalDespawn(who, true); Entities.GlobalSpawn(who, true); @@ -68,8 +66,8 @@ namespace MCGalaxy.Commands.CPE { Server.skins.Save(); } - static string GetSkin(Player p, string[] args, int i, string defSkin) { - string skin = args.Length > i ? args[i] : defSkin; + static string GetSkin(string skin, string defSkin) { + if (skin == "") skin = defSkin; if (skin[0] == '+') skin = "http://skins.minecraft.net/MinecraftSkins/" + skin.Substring(1) + ".png"; return skin; diff --git a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs index b542d3452..aa1d181e1 100644 --- a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs +++ b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs @@ -482,7 +482,7 @@ namespace MCGalaxy.Commands.CPE { } return block; } - + static byte GetFreeId(bool global, Level lvl) { // Start from opposite ends to avoid overlap. @@ -541,7 +541,7 @@ namespace MCGalaxy.Commands.CPE { } static bool CheckBlockId(Player p, string arg, out int blockId) { - blockId = 0; + blockId = 0; return CommandParser.GetInt(p, arg, "Block ID", ref blockId, 0, 254); } diff --git a/MCGalaxy/Commands/Chat/CmdColor.cs b/MCGalaxy/Commands/Chat/CmdColor.cs index d0946fe97..a8e65d05b 100644 --- a/MCGalaxy/Commands/Chat/CmdColor.cs +++ b/MCGalaxy/Commands/Chat/CmdColor.cs @@ -32,14 +32,14 @@ namespace MCGalaxy.Commands { } public override void Use(Player p, string message) { UseBotOrPlayer(p, message, "color"); } - protected override void SetBotData(Player p, PlayerBot bot, string[] args) { + protected override void SetBotData(Player p, PlayerBot bot, string colName) { if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) { Player.Message(p, "Hence, you cannot change the color of that bot."); return; } - string color = args.Length > 2 ? Colors.Parse(args[2]) : "&1"; - if (color == "") { Player.Message(p, "There is no color \"" + args[2] + "\"."); return; } + string color = colName == "" ? "&1" : Colors.Parse(colName); + if (color == "") { Player.Message(p, "There is no color \"" + colName + "\"."); return; } Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Scolor was set to " + color + Colors.Name(color)); bot.color = color; @@ -49,14 +49,14 @@ namespace MCGalaxy.Commands { BotsFile.UpdateBot(bot); } - protected override void SetPlayerData(Player p, Player who, string[] args) { + protected override void SetPlayerData(Player p, Player who, string colName) { string color = ""; - if (args.Length == 1) { + if (colName == "") { Chat.MessageGlobal(who, who.ColoredName + " %Shad their color removed.", false); who.color = who.group.color; } else { - color = Colors.Parse(args[1]); - if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; } + color = Colors.Parse(colName); + if (color == "") { Player.Message(p, "There is no color \"" + colName + "\"."); return; } else if (color == who.color) { Player.Message(p, who.DisplayName + " %Salready has that color."); return; } Chat.MessageGlobal(who, who.ColoredName + " %Shad their color changed to " + color + Colors.Name(color) + "%S.", false); diff --git a/MCGalaxy/Commands/Chat/CmdLoginMessage.cs b/MCGalaxy/Commands/Chat/CmdLoginMessage.cs index 3e4057f4f..539d01259 100644 --- a/MCGalaxy/Commands/Chat/CmdLoginMessage.cs +++ b/MCGalaxy/Commands/Chat/CmdLoginMessage.cs @@ -32,16 +32,16 @@ namespace MCGalaxy.Commands { UsePlayer(p, message, "login message"); } - protected override void SetPlayerData(Player p, Player who, string[] args) { - if (args.Length == 1) { + protected override void SetPlayerData(Player p, Player who, string loginMsg) { + if (loginMsg == "") { string path = PlayerDB.LoginPath(who.name); if (File.Exists(path)) File.Delete(path); Player.Message(p, "The login message of {0} %Shas been removed.", who.ColoredName); } else { - PlayerDB.SetLoginMessage(who.name, args[1]); + PlayerDB.SetLoginMessage(who.name, loginMsg); Player.Message(p, "The login message of {0} %Shas been changed to: {1}", - who.ColoredName, args[1]); + who.ColoredName, loginMsg); } } diff --git a/MCGalaxy/Commands/Chat/CmdLogoutMessage.cs b/MCGalaxy/Commands/Chat/CmdLogoutMessage.cs index bd2ee1bd3..131730eaa 100644 --- a/MCGalaxy/Commands/Chat/CmdLogoutMessage.cs +++ b/MCGalaxy/Commands/Chat/CmdLogoutMessage.cs @@ -32,16 +32,16 @@ namespace MCGalaxy.Commands { UsePlayer(p, message, "logout message"); } - protected override void SetPlayerData(Player p, Player who, string[] args) { - if (args.Length == 1) { + protected override void SetPlayerData(Player p, Player who, string logoutMsg) { + if (logoutMsg == "") { string path = PlayerDB.LogoutPath(who.name); if (File.Exists(path)) File.Delete(path); Player.Message(p, "The logout message of {0} %Shas been removed.", who.ColoredName); } else { - PlayerDB.SetLogoutMessage(who.name, args[1]); + PlayerDB.SetLogoutMessage(who.name, logoutMsg); Player.Message(p, "The logout message of {0} %Shas been changed to: {1}", - who.ColoredName, args[1]); + who.ColoredName, logoutMsg); } } diff --git a/MCGalaxy/Commands/Chat/CmdNick.cs b/MCGalaxy/Commands/Chat/CmdNick.cs index 267d916f8..68252ea10 100644 --- a/MCGalaxy/Commands/Chat/CmdNick.cs +++ b/MCGalaxy/Commands/Chat/CmdNick.cs @@ -38,17 +38,16 @@ namespace MCGalaxy.Commands { UseBotOrPlayer(p, message, "nick"); } - protected override void SetBotData(Player p, PlayerBot bot, string[] args) { - string newName = args.Length > 2 ? args[2] : ""; - if (newName == "") { + protected override void SetBotData(Player p, PlayerBot bot, string nick) { + if (nick == "") { bot.DisplayName = bot.name; Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + " %Sreverted to their original name."); } else { - string nameTag = newName.CaselessEq("empty") ? "" : newName; - if (newName.Length > 62) { Player.Message(p, "Name must be 62 or fewer letters."); return; } + string nameTag = nick.CaselessEq("empty") ? "" : nick; + if (nick.Length > 62) { Player.Message(p, "Name must be 62 or fewer letters."); return; } Player.Message(p, "You changed the name of bot " + bot.ColoredName + " %Sto &c" + nameTag); - bot.DisplayName = Colors.EscapeColors(newName); + bot.DisplayName = Colors.EscapeColors(nick); } bot.GlobalDespawn(); @@ -56,16 +55,15 @@ namespace MCGalaxy.Commands { BotsFile.UpdateBot(bot); } - protected override void SetPlayerData(Player p, Player who, string[] args) { - string newName = args.Length > 1 ? args[1] : ""; - if (newName == "") { + protected override void SetPlayerData(Player p, Player who, string nick) { + if (nick == "") { Chat.MessageGlobal(who, who.FullName + " %Sreverted their nick to their original name.", false); who.DisplayName = who.truename; } else { - if (newName.Length >= 30) { Player.Message(p, "Nick must be under 30 letters."); return; } + if (nick.Length >= 30) { Player.Message(p, "Nick must be under 30 letters."); return; } - Chat.MessageGlobal(who, who.FullName + " %Shad their nick changed to " + who.color + newName + "%S.", false); - who.DisplayName = newName; + Chat.MessageGlobal(who, who.FullName + " %Shad their nick changed to " + who.color + nick + "%S.", false); + who.DisplayName = nick; } PlayerDB.Save(who); diff --git a/MCGalaxy/Commands/Chat/CmdTColor.cs b/MCGalaxy/Commands/Chat/CmdTColor.cs index dec22dd2f..d92c71a50 100644 --- a/MCGalaxy/Commands/Chat/CmdTColor.cs +++ b/MCGalaxy/Commands/Chat/CmdTColor.cs @@ -30,13 +30,13 @@ namespace MCGalaxy.Commands { } public override void Use(Player p, string message) { UsePlayer(p, message, "title color"); } - protected override void SetPlayerData(Player p, Player who, string[] args) { + protected override void SetPlayerData(Player p, Player who, string colName) { string color = ""; - if (args.Length == 1) { + if (colName == "") { Chat.MessageGlobal(who, who.ColoredName + " %Shad their title color removed.", false); } else { - color = Colors.Parse(args[1]); - if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; } + color = Colors.Parse(colName); + if (color == "") { Player.Message(p, "There is no color \"" + colName + "\"."); return; } else if (color == who.titlecolor) { Player.Message(p, who.DisplayName + " %Salready has that title color."); return; } Chat.MessageGlobal(who, who.ColoredName + " %Shad their title color changed to " + color + Colors.Name(color) + "%S.", false); diff --git a/MCGalaxy/Commands/Chat/CmdTitle.cs b/MCGalaxy/Commands/Chat/CmdTitle.cs index 8f361a3fc..82c523a64 100644 --- a/MCGalaxy/Commands/Chat/CmdTitle.cs +++ b/MCGalaxy/Commands/Chat/CmdTitle.cs @@ -34,8 +34,7 @@ namespace MCGalaxy.Commands { UsePlayer(p, message, "title"); } - protected override void SetPlayerData(Player p, Player who, string[] args) { - string title = args.Length > 1 ? args[1] : ""; + protected override void SetPlayerData(Player p, Player who, string title) { if (title.Length >= 20) { Player.Message(p, "Title must be under 20 letters."); return; } if (title == "") { diff --git a/MCGalaxy/Commands/Economy/CmdAwards.cs b/MCGalaxy/Commands/Economy/CmdAwards.cs index c5ed822c8..1bab7e8b0 100644 --- a/MCGalaxy/Commands/Economy/CmdAwards.cs +++ b/MCGalaxy/Commands/Economy/CmdAwards.cs @@ -28,7 +28,7 @@ namespace MCGalaxy.Commands { public override LevelPermission defaultRank { get { return LevelPermission.Guest; } } public override void Use(Player p, string message) { - string[] args = message.SplitSpaces(); + string[] args = message.SplitSpaces(); if (args.Length > 2) { Help(p); return; } string plName = "", modifier = args[args.Length - 1]; int ignored; diff --git a/MCGalaxy/Commands/EntityPropertyCmd.cs b/MCGalaxy/Commands/EntityPropertyCmd.cs index 7e0850bb8..d25fe3571 100644 --- a/MCGalaxy/Commands/EntityPropertyCmd.cs +++ b/MCGalaxy/Commands/EntityPropertyCmd.cs @@ -41,7 +41,7 @@ namespace MCGalaxy.Commands { Player.Message(p, "Hence, you cannot change the " + type + " of that bot."); return; } - SetBotData(p, bot, args); + SetBotData(p, bot, args.Length > 2 ? args[2] : ""); } else { if (p != who && !CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; @@ -50,7 +50,7 @@ namespace MCGalaxy.Commands { if (p != null && who.Rank > p.Rank) { MessageTooHighRank(p, "change the " + type + " of", true); return; } - SetPlayerData(p, who, args); + SetPlayerData(p, who, args.Length > 1 ? args[1] : ""); } } @@ -66,7 +66,7 @@ namespace MCGalaxy.Commands { MessageTooHighRank(p, "change the " + type + " of", true); return; } if (p != who && !CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } - SetPlayerData(p, who, args); + SetPlayerData(p, who, args.Length > 1 ? args[1] : ""); } bool CheckOwn(Player p, string[] args, string type) { @@ -77,8 +77,8 @@ namespace MCGalaxy.Commands { return true; } - protected virtual void SetBotData(Player p, PlayerBot bot, string[] args) { } + protected virtual void SetBotData(Player p, PlayerBot bot, string args) { } - protected virtual void SetPlayerData(Player p, Player who, string[] args) { } + protected virtual void SetPlayerData(Player p, Player who, string args) { } } } diff --git a/MCGalaxy/Commands/Moderation/CmdBlockSpeed.cs b/MCGalaxy/Commands/Moderation/CmdBlockSpeed.cs index 4666b914c..7ed0d7226 100644 --- a/MCGalaxy/Commands/Moderation/CmdBlockSpeed.cs +++ b/MCGalaxy/Commands/Moderation/CmdBlockSpeed.cs @@ -42,7 +42,7 @@ namespace MCGalaxy.Commands { if (cmd == "bs") { if (!CommandParser.GetInt(p, args[1], "Blocks per interval", ref value, 0)) return; - + BlockQueue.blockupdates = value; Player.Message(p, "Blocks per interval is now {0}.", BlockQueue.blockupdates); } else if (cmd == "ts") { diff --git a/MCGalaxy/Commands/Moderation/CmdNotes.cs b/MCGalaxy/Commands/Moderation/CmdNotes.cs index eac8dd766..66e52a2db 100644 --- a/MCGalaxy/Commands/Moderation/CmdNotes.cs +++ b/MCGalaxy/Commands/Moderation/CmdNotes.cs @@ -42,9 +42,9 @@ namespace MCGalaxy.Commands { string target = PlayerInfo.GetColoredName(p, name); if (notes.Count == 0) { - Player.Message(p, "{0} %Shas no notes.", target); return; + Player.Message(p, "{0} %Shas no notes.", target); return; } else { - Player.Message(p, " Notes for {0}:", target); + Player.Message(p, " Notes for {0}:", target); } foreach (string line in notes) { diff --git a/MCGalaxy/Commands/Moderation/CmdUnban.cs b/MCGalaxy/Commands/Moderation/CmdUnban.cs index 3206c5dd3..d05dc333d 100644 --- a/MCGalaxy/Commands/Moderation/CmdUnban.cs +++ b/MCGalaxy/Commands/Moderation/CmdUnban.cs @@ -38,7 +38,7 @@ namespace MCGalaxy.Commands.Moderation { // Check tempbans first if (Server.tempBans.Remove(name)) { Server.tempBans.Save(); - + Chat.MessageGlobal("{0} had their temporary ban lifted by {1}.", name, srcFull); Server.s.Log("UNBANNED: " + name + " by " + src); Server.IRC.Say(name + " was unbanned by " + src + "."); diff --git a/MCGalaxy/Commands/Moderation/ModActionCmd.cs b/MCGalaxy/Commands/Moderation/ModActionCmd.cs index 79b6178d9..f9873b0c3 100644 --- a/MCGalaxy/Commands/Moderation/ModActionCmd.cs +++ b/MCGalaxy/Commands/Moderation/ModActionCmd.cs @@ -21,9 +21,9 @@ using System.IO; using System.Net; namespace MCGalaxy.Commands.Moderation { - - /// Provides common helper methods for moderation commands. - public static class ModActionCmd { + + /// Provides common helper methods for moderation commands. + public static class ModActionCmd { /// Expands @[rule number] to the actual rule with that number. public static string ExpandReason(Player p, string reason) { diff --git a/MCGalaxy/Commands/World/CmdFixGrass.cs b/MCGalaxy/Commands/World/CmdFixGrass.cs index 47416036e..460f2a7d6 100644 --- a/MCGalaxy/Commands/World/CmdFixGrass.cs +++ b/MCGalaxy/Commands/World/CmdFixGrass.cs @@ -143,7 +143,7 @@ namespace MCGalaxy.Commands.World { extAbove = lvl.GetExtTile((ushort)x, (ushort)(y + 1), (ushort)z); if (lvl.LightPasses(above, extAbove)) { - if (p.level.DoBlockchange(p, (ushort)x, (ushort)y, (ushort)z, Block.grass) == 2) { + if (p.level.DoBlockchange(p, (ushort)x, (ushort)y, (ushort)z, Block.grass) == 2) { buffer.Add(index, Block.grass, 0); totalFixed++; } diff --git a/MCGalaxy/Commands/World/CmdPause.cs b/MCGalaxy/Commands/World/CmdPause.cs index 671aa4065..e53b9ec4f 100644 --- a/MCGalaxy/Commands/World/CmdPause.cs +++ b/MCGalaxy/Commands/World/CmdPause.cs @@ -36,8 +36,8 @@ namespace MCGalaxy.Commands { if (lvl == null) return; } } else { - if (!CommandParser.GetInt(p, parts[0], "Pause time", ref seconds, 0)) return; - + if (!CommandParser.GetInt(p, parts[0], "Pause time", ref seconds, 0)) return; + lvl = Matcher.FindLevels(p, parts[1]); if (lvl == null) return; } diff --git a/MCGalaxy/Commands/building/CmdTree.cs b/MCGalaxy/Commands/building/CmdTree.cs index 41ff616ab..ea3d776c7 100644 --- a/MCGalaxy/Commands/building/CmdTree.cs +++ b/MCGalaxy/Commands/building/CmdTree.cs @@ -50,7 +50,7 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, "Value must be {0} or below for {1} trees.", tree.MaxSize, parts[0]); return; } - dArgs.size = size; + dArgs.size = size; dArgs.brushMsg = parts.Length >= 3 ? parts[2] : ""; // type value brush } else { dArgs.brushMsg = parts.Length >= 2 ? parts[1] : ""; // type brush diff --git a/MCGalaxy/Commands/other/CmdTpA.cs b/MCGalaxy/Commands/other/CmdTpA.cs index 3ce804291..b9c9a9593 100644 --- a/MCGalaxy/Commands/other/CmdTpA.cs +++ b/MCGalaxy/Commands/other/CmdTpA.cs @@ -64,7 +64,7 @@ namespace MCGalaxy.Commands { static void ShowRequestMessage(Player p, Player target) { if (!Chat.NotIgnoring(p, target)) return; - + Player.Message(target, p.ColoredName + " %Swould like to teleport to you."); Player.Message(target, "Type &2/tpaccept %Sor &4/tpdeny%S."); Player.Message(target, "This request will timeout after &b90 %Sseconds."); diff --git a/MCGalaxy/Drawing/Image/IPaletteMatcher.cs b/MCGalaxy/Drawing/Image/IPaletteMatcher.cs index fef00a78b..56f0985cf 100644 --- a/MCGalaxy/Drawing/Image/IPaletteMatcher.cs +++ b/MCGalaxy/Drawing/Image/IPaletteMatcher.cs @@ -36,8 +36,8 @@ namespace MCGalaxy.Drawing { public sealed class RgbPaletteMatcher : IPaletteMatcher { - PaletteEntry[] front, back; - public void SetPalette(PaletteEntry[] front, PaletteEntry[] back) { + PaletteEntry[] front, back; + public void SetPalette(PaletteEntry[] front, PaletteEntry[] back) { this.front = front; this.back = back; } diff --git a/MCGalaxy/Entity/Entities.cs b/MCGalaxy/Entity/Entities.cs index 8d078100a..46552cace 100644 --- a/MCGalaxy/Entity/Entities.cs +++ b/MCGalaxy/Entity/Entities.cs @@ -202,12 +202,10 @@ namespace MCGalaxy { Level lvl = entity.Level; Orientation rot = entity.Rot; - if (prop == EntityProp.RotX) - rot.RotX = Orientation.DegreesToPacked(value); - if (prop == EntityProp.RotY) - rot.RotY = Orientation.DegreesToPacked(value); - if (prop == EntityProp.RotZ) - rot.RotZ = Orientation.DegreesToPacked(value); + byte angle = Orientation.DegreesToPacked(value); + if (prop == EntityProp.RotX) rot.RotX = angle; + if (prop == EntityProp.RotY) rot.RotY = angle; + if (prop == EntityProp.RotZ) rot.RotZ = angle; entity.Rot = rot; if (prop == EntityProp.RotY) entity.SetYawPitch(rot.RotY, rot.HeadX); @@ -217,7 +215,8 @@ namespace MCGalaxy { if (!pl.CanSeeEntity(entity)) continue; byte id = (pl == entity) ? Entities.SelfID : entity.EntityID; - pl.Send(Packet.EntityProperty(id, prop, value)); + pl.Send(Packet.EntityProperty(id, prop, + Orientation.PackedToDegrees(angle))); } } diff --git a/MCGalaxy/Levels/IO/LvlProperties.cs b/MCGalaxy/Levels/IO/LvlProperties.cs index aa2e89a28..d654702dd 100644 --- a/MCGalaxy/Levels/IO/LvlProperties.cs +++ b/MCGalaxy/Levels/IO/LvlProperties.cs @@ -45,7 +45,7 @@ namespace MCGalaxy.Levels.IO { } public static void LoadEnv(Level level) { - string path = "levels/level properties/" + level.MapName + ".env"; + string path = "levels/level properties/" + level.MapName + ".env"; PropertiesFile.Read(path, ref level, EnvLineProcessor); } diff --git a/MCGalaxy/Network/Packets/Packet.BlockDefs.cs b/MCGalaxy/Network/Packets/Packet.BlockDefs.cs index 83b03d0ca..f1be329d5 100644 --- a/MCGalaxy/Network/Packets/Packet.BlockDefs.cs +++ b/MCGalaxy/Network/Packets/Packet.BlockDefs.cs @@ -43,7 +43,7 @@ namespace MCGalaxy { } static void MakeDefineBlockStart(BlockDefinition def, byte[] buffer, ref int i, - bool uniqueSideTexs, bool hasCP437) { + bool uniqueSideTexs, bool hasCP437) { // speed = 2^((raw - 128) / 64); // therefore raw = 64log2(speed) + 128 byte rawSpeed = (byte)(64 * Math.Log(def.Speed, 2) + 128); diff --git a/MCGalaxy/Network/Packets/Packet.cs b/MCGalaxy/Network/Packets/Packet.cs index b85db3aee..fc269b12f 100644 --- a/MCGalaxy/Network/Packets/Packet.cs +++ b/MCGalaxy/Network/Packets/Packet.cs @@ -38,7 +38,7 @@ namespace MCGalaxy { buffer[130] = Block.canPlace(p, Block.blackrock) ? (byte)100 : (byte)0; return buffer; } - + public static byte[] LevelFinalise(ushort width, ushort height, ushort length) { byte[] buffer = new byte[7]; buffer[0] = Opcode.LevelFinalise; @@ -49,7 +49,7 @@ namespace MCGalaxy { } public static byte[] AddEntity(byte id, string name, Position pos, - Orientation rot, bool hasCP437) { + Orientation rot, bool hasCP437) { byte[] buffer = new byte[74]; buffer[0] = Opcode.AddEntity; buffer[1] = id; diff --git a/MCGalaxy/Player/Group/GroupProperties.cs b/MCGalaxy/Player/Group/GroupProperties.cs index 0b810797c..67d828abe 100644 --- a/MCGalaxy/Player/Group/GroupProperties.cs +++ b/MCGalaxy/Player/Group/GroupProperties.cs @@ -106,7 +106,7 @@ namespace MCGalaxy { } static void AddGroup(ref Group grp) { - Group.AddAndLoadGroup( + Group.AddAndLoadGroup( new Group(grp.Permission, grp.maxBlocks, grp.maxUndo, grp.trueName, grp.color[0], grp.MOTD, grp.fileName, grp.OverseerMaps, grp.prefix)); grp = null; diff --git a/MCGalaxy/Player/Warp.cs b/MCGalaxy/Player/Warp.cs index 631388dac..afb07e811 100644 --- a/MCGalaxy/Player/Warp.cs +++ b/MCGalaxy/Player/Warp.cs @@ -51,9 +51,9 @@ namespace MCGalaxy { PlayerActions.ChangeMap(p, lvl); if (p.level.name.CaselessEq(wp.lvlname)) { - p.SendPos(Entities.SelfID, - new Position(wp.x, wp.y, wp.z), - new Orientation(wp.rotx, wp.roty)); + p.SendPos(Entities.SelfID, + new Position(wp.x, wp.y, wp.z), + new Orientation(wp.rotx, wp.roty)); Player.Message(p, "Sent you to waypoint/warp"); } else { Player.Message(p, "Unable to send you to the warp as the map it is on is not loaded."); diff --git a/MCGalaxy/Server/Server.cs b/MCGalaxy/Server/Server.cs index 187c8541c..6cc143227 100644 --- a/MCGalaxy/Server/Server.cs +++ b/MCGalaxy/Server/Server.cs @@ -208,7 +208,7 @@ namespace MCGalaxy { // Backwards compatibility with old config, where some permissions were global if (perms.viewPerm != -1) - CommandExtraPerms.Find("review", 1).MinRank = (LevelPermission)perms.viewPerm; + CommandExtraPerms.Find("review", 1).MinRank = (LevelPermission)perms.viewPerm; if (perms.nextPerm != -1) CommandExtraPerms.Find("review", 2).MinRank = (LevelPermission)perms.nextPerm; if (perms.clearPerm != -1) diff --git a/MCGalaxy/util/Formatting/Formatter.cs b/MCGalaxy/util/Formatting/Formatter.cs index 218cfe335..57ba01849 100644 --- a/MCGalaxy/util/Formatting/Formatter.cs +++ b/MCGalaxy/util/Formatting/Formatter.cs @@ -58,7 +58,7 @@ namespace MCGalaxy { Player.Message(p, "%TExtra permissions:"); foreach (CommandExtraPerms extra in extraPerms) { Player.Message(p, "{0}) {1}%S{2}", extra.Number, - Group.GetColoredName(extra.MinRank), extra.Description); + Group.GetColoredName(extra.MinRank), extra.Description); } } diff --git a/MCGalaxy/util/Formatting/MultiPageOutput.cs b/MCGalaxy/util/Formatting/MultiPageOutput.cs index 7ba175d5f..266e09851 100644 --- a/MCGalaxy/util/Formatting/MultiPageOutput.cs +++ b/MCGalaxy/util/Formatting/MultiPageOutput.cs @@ -23,8 +23,8 @@ namespace MCGalaxy { /// Outputs a large range of values across a number of 'pages'. (Pagination) public static class MultiPageOutput { - /// Outputs a large range of values across a number of 'pages'. (Pagination) - /// true if each item is printed on a separate line, false if combined. + /// Outputs a large range of values across a number of 'pages'. (Pagination) + /// true if each item is printed on a separate line, false if combined. public static void Output(Player p, IList items, Func formatter, string cmd, string type, string modifier, bool lines) { int page = 0, total = items.Count; diff --git a/MCGalaxy/util/Utils.cs b/MCGalaxy/util/Utils.cs index 226eddfa4..578cca042 100644 --- a/MCGalaxy/util/Utils.cs +++ b/MCGalaxy/util/Utils.cs @@ -23,7 +23,7 @@ using System.IO; namespace MCGalaxy { public static class Utils { - /// The absolute path on disc of the folder MCGalaxy.exe is currently running from. + /// The absolute path on disc of the folder MCGalaxy.exe is currently running from. public static string FolderPath { get { return AppDomain.CurrentDomain.BaseDirectory; } } public static bool IsValidHex(string hex) {