Example #1
0
 internal static void start(object[] args)
 {
     OakMisc.Log($"^F[^5INFO^F] SharpWood {Oakwood.GetVersion()} ^Asuccessfully ^Fstarted on this server!^R");
     Console.WriteLine($"[INFO] Registered {OakwoodCommandSystem.GetCommandCount()} commands, {OakwoodCommandSystem.GetEventCount()} events");
     if (OnStart != null)
     {
         OnStart();
     }
 }
Example #2
0
        internal static void OnChat(object[] args)
        {
            int    playerID = int.Parse(args[0].ToString());
            string msg      = (string)args[1];

            OakwoodPlayer player = null;

            foreach (OakwoodPlayer pl in Oakwood.Players)
            {
                if (pl.ID == playerID)
                {
                    player = pl;
                    break;
                }
            }

            if (msg.StartsWith("/"))
            {
                string[] t       = msg.Split(' ');
                string   cmd     = t[0];
                string[] cmdargs = t.Skip(1).ToArray();

                if (cmd.Substring(1) == "shwood")
                {
                    player.HUD.Message($"SharpWood {Oakwood.GetVersion()} made by Sevenisko & NanobotZ.", OakColor.White);
                }
                else if (cmd.Substring(1) == "help")
                {
                    player.SendMessage($"Command help:");
                    for (int i = 0; i < OakwoodCommandSystem.cmdDescriptions.Count; i++)
                    {
                        string[] welp = OakwoodCommandSystem.cmdDescriptions[i].Split(new string[] { " - " }, StringSplitOptions.None);
                        player.SendMessage($"> {welp[0]}");
                        player.SendMessage($" {{888888}}-> {{cccccc}}{welp[1]}");
                    }
                }
                else if (!OakwoodCommandSystem.ExecuteCommand(player, cmd.Substring(1), cmdargs))
                {
                    OakwoodCommandSystem.CallEvent("unknownCommand", new object[] { player, cmd.Substring(1) });
                }
            }
            else
            {
                if (OnPlayerChat != null)
                {
                    OnPlayerChat(player, msg);
                }
            }
        }