diff --git a/EXILED/Exiled.API/Features/Round.cs b/EXILED/Exiled.API/Features/Round.cs index 38bb4407ed..d23a8b327a 100644 --- a/EXILED/Exiled.API/Features/Round.cs +++ b/EXILED/Exiled.API/Features/Round.cs @@ -193,6 +193,11 @@ public static IEnumerable AliveSides } } + /// + /// Gets get the initial lobby Waiting Time. + /// + public static short InitialLobbyWaitingTime { get; } = ConfigFile.ServerConfig.GetShort("lobby_waiting_time", 20); + /// /// Restarts the round with custom settings. /// @@ -258,5 +263,10 @@ public static bool EndRound(bool forceEnd = false) /// Start the round. /// public static void Start() => CharacterClassManager.ForceRoundStart(); + + /// + /// Reset the CountDown from Config Value. + /// + public static void ResetCountDown() => LobbyWaitingTime = InitialLobbyWaitingTime; } } diff --git a/EXILED/Exiled.Events/EventArgs/Server/RoundStartingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/RoundStartingEventArgs.cs index b97f309edf..544aedfcb6 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/RoundStartingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/RoundStartingEventArgs.cs @@ -7,12 +7,6 @@ namespace Exiled.Events.EventArgs.Server { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Exiled.Events.EventArgs.Interfaces; /// @@ -30,10 +24,9 @@ public class RoundStartingEventArgs : IDeniableEvent public RoundStartingEventArgs(short timeLeft, short originalTimeLeft, int topPlayer, int playerCount) { TimeLeft = timeLeft; - OriginalTimeLeft = originalTimeLeft; + OriginalTimeLeft = originalTimeLeft == -1 ? 1 : originalTimeLeft; TopPlayer = topPlayer; PlayerCount = playerCount; - IsAllowed = TimeLeft == -1; } /// @@ -57,6 +50,6 @@ public RoundStartingEventArgs(short timeLeft, short originalTimeLeft, int topPla public int PlayerCount { get; } /// - public bool IsAllowed { get; set; } + public bool IsAllowed { get; set; } = true; } } diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundStarting.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundStarting.cs index ec5e68b953..1fb35098b5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundStarting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundStarting.cs @@ -13,7 +13,6 @@ namespace Exiled.Events.Patches.Events.Server using System.Reflection; using System.Reflection.Emit; - using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Server; using HarmonyLib; @@ -52,17 +51,20 @@ private static IEnumerable Transpiler(IEnumerable x.Calls(Method(typeof(CharacterClassManager), nameof(CharacterClassManager.ForceRoundStart)))) + offset; + Label continueLabel = generator.DefineLabel(); + Label checkSkip = generator.DefineLabel(); - List