From 3f3257f2320018f6deb28729177db75af9e741ba Mon Sep 17 00:00:00 2001 From: SuperSkidder Date: Sat, 10 Aug 2024 09:37:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E9=9F=B3?= =?UTF-8?q?=E4=B9=90=E6=92=AD=E6=94=BE=E6=9A=82=E5=81=9C=E7=9A=84=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/top/fpsmaster/features/GlobalSubmitter.kt | 12 +----------- .../top/fpsmaster/ui/screens/mainmenu/MainMenu.kt | 6 ++++++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/shared/java/top/fpsmaster/features/GlobalSubmitter.kt b/shared/java/top/fpsmaster/features/GlobalSubmitter.kt index 9c1e7b8..ae0cb8e 100644 --- a/shared/java/top/fpsmaster/features/GlobalSubmitter.kt +++ b/shared/java/top/fpsmaster/features/GlobalSubmitter.kt @@ -93,17 +93,7 @@ class GlobalSubmitter { @Subscribe fun onTick(e: EventTick) { - if (time.delay(500)) { - if (Minecraft.getMinecraft().currentScreen is MainMenu) { - if (!MusicPlayer.playList.musics.isEmpty()) { - if (MusicPlayer.isPlaying) { - MusicPlayer.playList.pause() - } - } - } - } - - if (musicSwitchTimer.delay(3000)) { + if (musicSwitchTimer.delay(1000)) { if (MusicPlayer.isPlaying && MusicPlayer.playProgress > 0.999) { MusicPlayer.playList.next() } diff --git a/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.kt b/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.kt index 71e2c76..dcad8d4 100644 --- a/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.kt +++ b/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.kt @@ -8,6 +8,7 @@ import net.minecraft.util.ResourceLocation import org.lwjgl.input.Mouse import top.fpsmaster.FPSMaster import top.fpsmaster.interfaces.ProviderManager +import top.fpsmaster.modules.music.MusicPlayer import top.fpsmaster.ui.screens.account.GuiWaiting import top.fpsmaster.ui.screens.oobe.GuiLogin import top.fpsmaster.ui.screens.plugins.GuiPlugins @@ -51,6 +52,11 @@ class MainMenu : GuiScreen() { */ override fun initGui() { ProviderManager.mainmenuProvider.initGui() + if (!MusicPlayer.playList.musics.isEmpty()) { + if (MusicPlayer.isPlaying) { + MusicPlayer.playList.pause() + } + } } /**