diff --git a/Plugin.cs b/Plugin.cs index 20adee2..7962082 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -4,7 +4,6 @@ using IPA; using System; using System.Text; -using System.Threading; using UnityEngine; using IPALogger = IPA.Logging.Logger; @@ -17,7 +16,6 @@ public class Plugin private DiscordInstance _discord; private const long DiscordClientId = 1028340906740420711; - private Timer _updateTimer; [Init] /// @@ -46,15 +44,6 @@ public void OnApplicationStart() modId = nameof(bsrpc), modName = nameof(bsrpc), }); - - SetUpdateTimer(0); - } - - // Update rich presence regularly on a schedule even if the update events are not fired - private void SetUpdateTimer(int debounceMs = 500) - { - _updateTimer?.Dispose(); - _updateTimer = new Timer((e) => UpdateRichPresence(), null, debounceMs, 5000); } private void UpdateRichPresence(string jsonData) @@ -66,7 +55,6 @@ private void UpdateRichPresence() var activity = GetActivityData(); _discord.UpdateActivity(activity); - SetUpdateTimer(); } private string GetReadableDifficulty(string originalDifficulty) @@ -325,7 +313,9 @@ private long DateTimeToUnixTimestamp(DateTime ticks) [OnExit] public void OnApplicationQuit() { - + MapData.Instance.OnUpdate -= UpdateRichPresence; + LiveData.Instance.OnUpdate -= UpdateRichPresence; + _discord.DestroyInstance(); } } } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index f63cc11..0120be5 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.4")] -[assembly: AssemblyFileVersion("1.0.4")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.5")] +[assembly: AssemblyFileVersion("1.0.5")] \ No newline at end of file diff --git a/README.md b/README.md index 3a03f34..b0db35b 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,5 @@ Discord Rich Presence support for Beat Saber. No customization options whatsoeve ## Dependencies * BSIPA v4.2.2 (ModAssistant) -* DiscordCore v1.0.10 (https://github.com/FizzyApple12/DiscordCore/releases/tag/v1.0.10) +* DiscordCore v3.0.0 (https://github.com/DJDavid98/DiscordCore/releases/tag/v3.0.0) * DataPuller v2.1.1 (https://github.com/ReadieFur/BSDataPuller/releases/tag/2.1.1) \ No newline at end of file diff --git a/manifest.json b/manifest.json index c75ff25..116bb04 100644 --- a/manifest.json +++ b/manifest.json @@ -3,13 +3,13 @@ "id": "bsrpc", "name": "bsrpc", "author": "DJDavid98", - "version": "1.0.4", + "version": "1.0.5", "description": "Discord Rich Presence integration for Beat Saber", "gameVersion": "1.28.0", "dependsOn": { "BSIPA": "^4.2.2", "DataPuller": "^2.1.1", - "DiscordCore": "^1.0.10" + "DiscordCore": "^3.0.0" }, "links": { "project-source": "https://github.com/DJDavid98/bsrpc"