From 049a0b71f95ff4d2b6841e0402344b08f1b3ed24 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 3 Oct 2017 09:49:45 +1100 Subject: [PATCH] Kill off obsolete methods --- MCGalaxy/Blocks/Block.cs | 11 ----------- MCGalaxy/Commands/CPE/CmdModel.cs | 2 +- MCGalaxy/Commands/CPE/CmdSkin.cs | 2 +- MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs | 9 +++++++-- MCGalaxy/Player/Player.cs | 15 --------------- MCGalaxy/Server/Server.DB.cs | 4 ++-- 6 files changed, 11 insertions(+), 32 deletions(-) diff --git a/MCGalaxy/Blocks/Block.cs b/MCGalaxy/Blocks/Block.cs index 91c42467e..9d3220bbf 100644 --- a/MCGalaxy/Blocks/Block.cs +++ b/MCGalaxy/Blocks/Block.cs @@ -90,11 +90,6 @@ namespace MCGalaxy { && block < CpeCount; } - public static bool RightClick(byte block, bool countAir = false) { - if (countAir && block == Air) return true; - return block >= Water && block <= StillLava; - } - public static bool BuildIn(byte block) { if (block == Op_Water || block == Op_Lava || Props[block].IsPortal || Props[block].IsMessageBlock) return false; @@ -190,11 +185,5 @@ namespace MCGalaxy { lvl.UpdateBlockHandlers(); } } - - [Obsolete("Use BlockPerms.CanModify()")] - public static bool canPlace(Player p, byte type) { return BlockPerms.UsableBy(p, type); } - - [Obsolete("Use BlockPerms.CanModify()")] - public static bool canPlace(LevelPermission perm, byte type) { return BlockPerms.UsableBy(perm, type); } } } diff --git a/MCGalaxy/Commands/CPE/CmdModel.cs b/MCGalaxy/Commands/CPE/CmdModel.cs index 22232df0e..e3f6cfc37 100644 --- a/MCGalaxy/Commands/CPE/CmdModel.cs +++ b/MCGalaxy/Commands/CPE/CmdModel.cs @@ -53,7 +53,7 @@ namespace MCGalaxy.Commands.CPE { Entities.UpdateModel(who, model); if (p != who) { - Player.GlobalMessage(who, who.ColoredName + "'s %Smodel was changed to a &c" + model); + Player.SendChatFrom(who, who.ColoredName + "'s %Smodel was changed to a &c" + model, false); } else { Player.Message(who, "Changed your own model to a &c" + model); } diff --git a/MCGalaxy/Commands/CPE/CmdSkin.cs b/MCGalaxy/Commands/CPE/CmdSkin.cs index a9b9cd138..effb7f2b3 100644 --- a/MCGalaxy/Commands/CPE/CmdSkin.cs +++ b/MCGalaxy/Commands/CPE/CmdSkin.cs @@ -52,7 +52,7 @@ namespace MCGalaxy.Commands.CPE { Entities.GlobalRespawn(who); if (p != who) { - Player.GlobalMessage(who, who.ColoredName + "'s %Sskin was changed to &c" + skin); + Player.SendChatFrom(who, who.ColoredName + "'s %Sskin was changed to &c" + skin, false); } else { Player.Message(who, "Changed your own skin to &c" + skin); } diff --git a/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs b/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs index 2602bb214..05a9c90e1 100644 --- a/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs +++ b/MCGalaxy/Drawing/DrawOps/CuboidDrawOps.cs @@ -26,6 +26,11 @@ namespace MCGalaxy.Drawing.Ops { public override string Name { get { return "Hollow"; } } public byte Skip; + static bool CanHollow(byte block, bool andAir = false) { + if (andAir && block == Block.Air) return true; + return block >= Block.Water && block <= Block.StillLava; + } + public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) { Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max); ExtBlock air = ExtBlock.Air; @@ -36,7 +41,7 @@ namespace MCGalaxy.Drawing.Ops { { bool hollow = true; byte tile = Level.GetTile(x, y, z); - if (!Block.RightClick(Block.Convert(tile), true) && tile != Skip) { + if (!CanHollow(Block.Convert(tile), true) && tile != Skip) { CheckTile(x - 1, y, z, ref hollow); CheckTile(x + 1, y, z, ref hollow); CheckTile(x, y - 1, z, ref hollow); @@ -53,7 +58,7 @@ namespace MCGalaxy.Drawing.Ops { void CheckTile(int x, int y, int z, ref bool hollow) { byte tile = Level.GetTile((ushort)x, (ushort)y, (ushort)z); - if (Block.RightClick(Block.Convert(tile)) || tile == Skip) + if (CanHollow(Block.Convert(tile)) || tile == Skip) hollow = false; } } diff --git a/MCGalaxy/Player/Player.cs b/MCGalaxy/Player/Player.cs index bf862c939..a9a092e89 100644 --- a/MCGalaxy/Player/Player.cs +++ b/MCGalaxy/Player/Player.cs @@ -148,11 +148,6 @@ namespace MCGalaxy { if (p.level == level) p.SendBlockchange(x, y, z, block); } } - - [Obsolete("Use SendChatFrom() instead.")] - public static void GlobalChat(Player from, string message) { SendChatFrom(from, message, true); } - [Obsolete("Use SendChatFrom() instead.")] - public static void GlobalChat(Player from, string message, bool showname) { SendChatFrom(from, message, showname); } public static void SendChatFrom(Player from, string message) { SendChatFrom(from, message, true); } public static void SendChatFrom(Player from, string message, bool showname) { @@ -168,11 +163,6 @@ namespace MCGalaxy { } public static List Last50Chat = new List(); - [Obsolete("Use Chat.MessageAll() instead")] - public static void GlobalMessage(string message) { Chat.MessageGlobal(message); } - [Obsolete("Use Chat.MessageAll() instead")] - public static void GlobalMessage(string message, bool global) { Chat.MessageGlobal(message); } - public static void GlobalIRCMessage(string srcNick, string message) { message = Colors.Escape(message); Player[] players = PlayerInfo.Online.Items; @@ -183,11 +173,6 @@ namespace MCGalaxy { Player.Message(p, message); } } - - public static void GlobalMessage(Player from, string message) { - if (from == null) Chat.MessageGlobal(message); - else SendChatFrom(from, message, false); - } public bool MarkPossessed(string marker = "") { if (marker.Length > 0) { diff --git a/MCGalaxy/Server/Server.DB.cs b/MCGalaxy/Server/Server.DB.cs index b8c3a299c..e1d88293c 100644 --- a/MCGalaxy/Server/Server.DB.cs +++ b/MCGalaxy/Server/Server.DB.cs @@ -39,8 +39,8 @@ namespace MCGalaxy { new ColumnDesc("totalKicked", ColumnType.Int24), new ColumnDesc("TimeSpent", ColumnType.VarChar, 20), new ColumnDesc("color", ColumnType.VarChar, 6), - new ColumnDesc("title_color", ColumnType.VarChar, 6), - new ColumnDesc("Messages", ColumnType.UInt24), + new ColumnDesc("title_color", ColumnType.VarChar, 6), + new ColumnDesc("Messages", ColumnType.UInt24), }; static ColumnDesc[] createOpstats = new ColumnDesc[] {