public override void OnEnabled()
        {
            base.OnEnabled();

            /*pluginDir = Path.Combine(Paths.Configs, "RoundMod");
             * if (!Directory.Exists(pluginDir))
             *  Directory.CreateDirectory(pluginDir);
             * if (!File.Exists(Path.Combine(pluginDir, "config-" + typeof(ServerStatic).GetField("ServerPort", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null).ToString() + ".yml")))
             *  File.WriteAllText(Path.Combine(pluginDir, "config-" + typeof(ServerStatic).GetField("ServerPort", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null).ToString() + ".yml"), "");
             * ConfigLoad();*/
            PLEV = new PluginEvents(this);
            Exiled.Events.Handlers.Server.RoundStarted      += PLEV.RoundStart;
            Exiled.Events.Handlers.Server.RestartingRound   += PLEV.RoundRestart;
            Exiled.Events.Handlers.Server.WaitingForPlayers += PLEV.WaitForPlayers;
            Exiled.Events.Handlers.Player.Spawning          += PLEV.PlayerSpawn;
            Exiled.Events.Handlers.Server.RespawningTeam    += PLEV.TeamSpawn;
            Exiled.Events.Handlers.Player.Joined            += PLEV.PlayerJoin;
            Exiled.Events.Handlers.Player.Escaping          += PLEV.PlayerEscape;
            Exiled.Events.Handlers.Player.Died += PLEV.PlayerDeath;
            Exiled.Events.Handlers.Player.FailingEscapePocketDimension += PLEV.PDDie;
            //Events.RemoteAdminCommandEvent += PLEV.RACmd;
            Exiled.Events.Handlers.Player.Hurting += PLEV.PlayerHurt;
            instance = this;
            //Harmony instance2 = new Harmony("net.virtualbrightplayz.roundmod");
            //instance2.PatchAll();
        }
Esempio n. 2
0
        public PluginEvents(RoundMod mod)
        {
            plugin       = mod;
            roundStarted = false;
            respawning   = false;

            mods.Add(ModType.NONE, ModCategory.NONE);
            mods.Add(ModType.SINGLESCPTYPE, ModCategory.SCPMODS);
            mods.Add(ModType.PLAYERSIZE, ModCategory.PLAYERMODS);
            mods.Add(ModType.SCPBOSS, ModCategory.SCPMODS);
            mods.Add(ModType.UPSIDEDOWN, ModCategory.PLAYERMODS);
            mods.Add(ModType.NORESPAWN, ModCategory.TEAMMODS);
            mods.Add(ModType.EXPLODEONDEATH, ModCategory.DEATHMODS);
            mods.Add(ModType.FINDWEAPONS, ModCategory.ITEMMODS);
            mods.Add(ModType.ITEMRANDOMIZER, ModCategory.NONE);
            mods.Add(ModType.CLASSINFECT, ModCategory.DEATHMODS);

            //GetRandom();
            try
            {
                ServerConsole.singleton.NameFormatter.Commands.Add("rm_current_mods", (e) =>
                {
                    if (plugin.curMod.HasFlag(ModType.NONE) && plugin.enabledTypes.Contains(ModType.NONE))
                    {
                        return(plugin.translations[ModType.NONE]);
                    }
                    else
                    {
                        string str = string.Empty;
                        int j      = 0;
                        for (int i = 0; i < Enum.GetValues(typeof(ModType)).Length; i++)
                        {
                            ModType item = Enum.GetValues(typeof(ModType)).ToArray <ModType>()[i];
                            if (plugin.curMod.HasFlag(item))
                            {
                                j++;
                                if (j == 1)
                                {
                                    str += plugin.translations[item];
                                }
                                else
                                {
                                    str += ", " + plugin.translations[item];
                                }
                            }
                        }
                        return(str);
                    }
                });
            }
            catch (Exception e)
            { }
        }
 public override void OnDisabled()
 {
     base.OnDisabled();
     Exiled.Events.Handlers.Server.RoundStarted      -= PLEV.RoundStart;
     Exiled.Events.Handlers.Server.RestartingRound   -= PLEV.RoundRestart;
     Exiled.Events.Handlers.Server.WaitingForPlayers -= PLEV.WaitForPlayers;
     Exiled.Events.Handlers.Player.Spawning          -= PLEV.PlayerSpawn;
     Exiled.Events.Handlers.Server.RespawningTeam    -= PLEV.TeamSpawn;
     Exiled.Events.Handlers.Player.Joined            -= PLEV.PlayerJoin;
     Exiled.Events.Handlers.Player.Escaping          -= PLEV.PlayerEscape;
     Exiled.Events.Handlers.Player.Died -= PLEV.PlayerDeath;
     Exiled.Events.Handlers.Player.FailingEscapePocketDimension -= PLEV.PDDie;
     //Events.RemoteAdminCommandEvent -= PLEV.RACmd;
     Exiled.Events.Handlers.Player.Hurting -= PLEV.PlayerHurt;
     PLEV     = null;
     instance = null;
 }