diff --git a/Quaver.API/Maps/Qua.cs b/Quaver.API/Maps/Qua.cs
index e51b41e68..054d54643 100644
--- a/Quaver.API/Maps/Qua.cs
+++ b/Quaver.API/Maps/Qua.cs
@@ -26,6 +26,14 @@ namespace Quaver.API.Maps
[Serializable] // ReSharper disable CognitiveComplexity CompareOfFloatsByEqualityOperator
public class Qua
{
+ // 0 versioning added
+ public int QuaVersion { get; set; } = 0;
+
+ // Max supported version by this client
+ // This should be incremented whenever breaking changes are made to quas
+ // DetermineMinimumQuaVersion() should also be updated to allow older clients to load maps without new features
+ public const int CurrentQuaVersion = 0;
+
///
/// The name of the audio file
///
@@ -303,6 +311,12 @@ private bool CompareTimingGroups(Dictionary other)
.WithTagMapping("!ScrollGroup", typeof(ScrollGroup))
.Build();
+
+ public int DetermineMinimumQuaVersion()
+ {
+ return 0;
+ }
+
///
/// Loads a .qua file from a stream
///
@@ -375,6 +389,8 @@ x.Signature is TimeSignature.Quadruple
// Sort the object before saving.
Sort();
+ QuaVersion = DetermineMinimumQuaVersion();
+
// Set default values to zero so they don't waste space in the .qua file.
var originalTimingPoints = TimingPoints;
var originalHitObjects = HitObjects;
@@ -1165,6 +1181,9 @@ private static void AfterLoad(Qua qua, bool checkValidity)
if (checkValidity && qua.Validate() is var errors && errors.Count > 0)
throw new ArgumentException(string.Join("\n", errors));
+ if (qua.QuaVersion > Qua.CurrentQuaVersion)
+ throw new QuaVersionException($"Map \"{qua.Artist} - {qua.Title}\" cannot be loaded because it requires features from a newer client.");
+
// Try to sort the Qua before returning.
qua.Sort();
}
diff --git a/Quaver.API/Maps/QuaVersionException.cs b/Quaver.API/Maps/QuaVersionException.cs
new file mode 100644
index 000000000..2d6f1f6f7
--- /dev/null
+++ b/Quaver.API/Maps/QuaVersionException.cs
@@ -0,0 +1,7 @@
+[System.Serializable]
+public class QuaVersionException : System.Exception
+{
+ public QuaVersionException() { }
+ public QuaVersionException(string message) : base(message) { }
+ public QuaVersionException(string message, System.Exception inner) : base(message, inner) { }
+}
\ No newline at end of file