public void OnUpdate(UpdateEvent ev) { if (DateTime.Now > nextUpdate && plugin.hasConnectedOnce) { // Update player count if (plugin.GetConfigString("discord_activity_playercount") == "on") { plugin.RefreshBotActivity(); } // Update channel topic plugin.RefreshChannelTopic(); nextUpdate = DateTime.Now.AddSeconds(5); } }
public void OnUpdate(UpdateEvent ev) { if (!stopWatch.IsRunning) { stopWatch.Start(); } ticks++; if (stopWatch.ElapsedMilliseconds >= 10000 && plugin.hasConnectedOnce && plugin.clientSocket.Connected) { stopWatch.Reset(); float tps = ticks / 10.0f; ticks = 0; // Update player count if (Config.settings.playercount) { plugin.RefreshBotActivity(); } // Update channel topic plugin.RefreshChannelTopic(tps); } }