diff --git a/src/Application/Common/Resources/Messages.Designer.cs b/src/Application/Common/Resources/Messages.Designer.cs
index f3b2d211..e7072d81 100644
--- a/src/Application/Common/Resources/Messages.Designer.cs
+++ b/src/Application/Common/Resources/Messages.Designer.cs
@@ -294,6 +294,15 @@ internal static string NextRank {
}
}
+ ///
+ /// Looks up a localized string similar to You do not have permissions to use this command.
+ ///
+ internal static string NoPermissions {
+ get {
+ return ResourceManager.GetString("NoPermissions", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Password cannot be empty.
///
diff --git a/src/Application/Common/Resources/Messages.resx b/src/Application/Common/Resources/Messages.resx
index 96773167..67294f6a 100644
--- a/src/Application/Common/Resources/Messages.resx
+++ b/src/Application/Common/Resources/Messages.resx
@@ -195,6 +195,9 @@
You moved up to {Name} rank, congratulations!
+
+ You do not have permissions to use this command
+
Password cannot be empty
diff --git a/src/Application/Maps/Systems/MapRotationSystem.cs b/src/Application/Maps/Systems/MapRotationSystem.cs
index c7c9a3a5..119fe5c4 100644
--- a/src/Application/Maps/Systems/MapRotationSystem.cs
+++ b/src/Application/Maps/Systems/MapRotationSystem.cs
@@ -15,4 +15,22 @@ public void OnGameModeInit()
{
mapRotationService.StartRotation();
}
+
+ [PlayerCommand("settimeleft")]
+ public void SetTimeLeft(Player player, int minutes)
+ {
+ if (player.HasLowerRoleThan(RoleId.Moderator))
+ return;
+
+ var interval = new Minutes(minutes);
+ TimeLeft timeLeft = mapRotationService.TimeLeft;
+ Result result = timeLeft.SetInterval(interval);
+ if(result.IsFailed)
+ {
+ player.SendClientMessage(Color.Red, result.Message);
+ return;
+ }
+
+ mapTextDrawRenderer.UpdateTimeLeft(timeLeft);
+ }
}
diff --git a/src/Application/Players/Extensions/PlayerRoleExtensions.cs b/src/Application/Players/Extensions/PlayerRoleExtensions.cs
new file mode 100644
index 00000000..54cd39ad
--- /dev/null
+++ b/src/Application/Players/Extensions/PlayerRoleExtensions.cs
@@ -0,0 +1,16 @@
+namespace CTF.Application.Players.Extensions;
+
+public static class PlayerRoleExtensions
+{
+ public static bool HasLowerRoleThan(this Player player, RoleId id)
+ {
+ PlayerInfo playerInfo = player.GetInfo();
+ if (playerInfo.HasLowerRoleThan(id))
+ {
+ player.SendClientMessage(Color.Red, Messages.NoPermissions);
+ return true;
+ }
+
+ return false;
+ }
+}