Example #1
0
        //This is for a future update :D
        //const string SteamApiKey = "D57A6B0437CB735FFEE9317A9D42CCAA";

        protected override void Load()
        {
            instance = this;

            RocketLogger.Log(string.Format("Welcome to Gun Game v{0}!", Assembly.GetName().Version), ConsoleColor.Yellow);
            RocketLogger.Log("For any update information or support join my Discord Guild: discord.gg/BaE4Tka!", ConsoleColor.Yellow);

            GunGameConfig.Initialize();
            GameManager.Initialize();
            CommandManager.Initialize();
            EconomyManager.Initialize();

            if (GunGameConfig.instance.sqlSettings.enabled)
            {
                if (!SQLManager.Initialize())
                {
                    GunGamePlayerConfig.Initialize();
                    IsMySqlEnabled = false;
                    RocketLogger.Log("NOTE: Connection to MySQL database failed!", ConsoleColor.Red);
                    RocketLogger.Log("Initialized with MySQL support disabled.", ConsoleColor.Yellow);
                }
                else
                {
                    RocketLogger.Log("Initialized with MySQL support enabled.", ConsoleColor.Yellow);
                }
            }
            else
            {
                GunGamePlayerConfig.Initialize();
                IsMySqlEnabled = false;
                RocketLogger.Log("Initialized with MySQL support disabled.", ConsoleColor.Yellow);
            }

            EventManager.Register();

            if (GunGameConfig.instance.positions[0].x == 0 && GunGameConfig.instance.positions[0].y == 0 && GunGameConfig.instance.positions[0].z == 0)
            {
                RocketLogger.Log("NOTE: You have not set any spawn positions yet!", ConsoleColor.Yellow);
            }

            if (GunGameConfig.instance.safezone.x == 0 && GunGameConfig.instance.safezone.y == 0 && GunGameConfig.instance.safezone.z == 0)
            {
                RocketLogger.Log("NOTE: You have not set the lobby yet!", ConsoleColor.Yellow);
            }

            isLoaded = true;
        }
Example #2
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length == 0)
            {
                ((UnturnedPlayer)caller).Player.sendBrowserRequest("For any information on this plugin, visit our Wiki!", "https://github.com/Graybad1/Gun-Game/wiki");
                return;
            }
            try {
                CommandManager.ExcecuteCommand(caller, command);
            } catch (GunGameException e) {
                switch (e.type)
                {
                case EExceptionType.INVALID_ARGS:
                    GunGame.Say(caller, "invalid_args", Color.red);
                    break;

                case EExceptionType.INVALID_CMD:
                    GunGame.Say(caller, "invalid_cmd", Color.red);
                    break;

                case EExceptionType.INVALID_PERMS:
                    string permLevel = "";
                    switch (e.level)
                    {
                    case EPermissionLevel.HIGH:
                        permLevel = "High";
                        break;

                    case EPermissionLevel.MEDIUM:
                        permLevel = "Medium";
                        break;

                    case EPermissionLevel.LOW:
                        permLevel = "Low";
                        break;
                    }
                    GunGame.Say(caller, "invalid_perms", Color.red, permLevel);
                    break;

                case EExceptionType.INVALID_TIME:
                    bool   hasMultiple = false;
                    string str         = "";
                    if (e.timing.HasFlags(ECommandTiming.RUNNING))
                    {
                        str        += "Running";
                        hasMultiple = true;
                    }
                    if (e.timing.HasFlags(ECommandTiming.STOPPED))
                    {
                        if (hasMultiple)
                        {
                            str += " or Stopped";
                        }
                        else
                        {
                            str        += "Stopped";
                            hasMultiple = true;
                        }
                    }
                    if (e.timing.HasFlags(ECommandTiming.WAITING))
                    {
                        if (hasMultiple)
                        {
                            str += " or Waiting";
                        }
                        else
                        {
                            str += "Waiting";
                        }
                    }
                    GunGame.Say(caller, "invalid_time", Color.red, str);
                    break;
                }
            }
        }
Example #3
0
 public static void RemoveGame(GunGame game)
 {
     lock (GunMain.Games)
         GunMain.Games.Remove(game);
 }