コード例 #1
0
ファイル: Rules.cs プロジェクト: mctraveler/MineSharp
        //Records if the rules was signed
        public static void Verify(Client c, MCBook b)
        {
            if (b.Channel != MCBook.ChannelSign)
                return;

            try
            {
                var list = b.Content ["pages"].ToListString();
                var book = Content ["pages"].ToListString();
                if (list.Count != book.Count)
                    return;

                for (int p = 0; p < list.Count; p++)
                {
                    if (list [p].String != book [p].String)
                        return;
                }

            } catch (Exception e)
            {
                Log.Write(e, c);
            }

            //Signed
            bool first = c.Settings.SignedRules < new DateTime(2000, 01, 01);
            c.Settings.SignedRules = DateTime.Now;
            c.SaveProxyPlayer();
            c.TellSystem(Chat.Green, "You have signed the rules");
            c.TellSystem(Chat.Green, "Welcome to our server");
            if (first)
            {
				if (b.Content ["title"].String.ToLowerInvariant().Contains("mctraveler"))
                    World.Main.Send("give " + c.MinecraftUsername + " " + (int)BlockID.Diamond);
            }
        }
コード例 #2
0
ファイル: Log.cs プロジェクト: mctraveler/MineSharp
        public static void WriteBook(Client player, MCBook pm)
        {
            if (LogDate != DateTime.Now.Date)
                OpenLog();

            try
            {
                if (pm.Content ["author"] != null && pm.Content ["title"] != null)
                    bookLog.WriteLine(Timestamp + "\t" + player.MinecraftUsername + "\t" + pm.Content ["title"].String + " by " + pm.Content ["author"].String);
                else
                    bookLog.WriteLine(Timestamp + "\t" + player.MinecraftUsername + "\tUnsigned");
                foreach (TagString p in pm.Content["pages"].ToListString())
                    bookLog.WriteLine(Timestamp + "\t" + player.MinecraftUsername + "\t" + p.String);

            } catch (Exception e)
            {
                Log.Write(e, player);
            }
        }