From 318b66e92852be3c7309b7b8daf3525c0a753753 Mon Sep 17 00:00:00 2001 From: Coloryr <402067010@qq.com> Date: Thu, 25 Jul 2024 15:12:34 +0800 Subject: [PATCH] =?UTF-8?q?up=20=E9=94=99=E8=AF=AF=E7=9A=84=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../allmusic/server/AllMusicFolia.java | 40 +++++++++---------- .../allmusic/server/AllMusicBukkit.java | 12 +++--- .../allmusic/server/AllMusicVelocity.java | 5 ++- version | 2 +- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/folia/src/main/java/com/coloryr/allmusic/server/AllMusicFolia.java b/folia/src/main/java/com/coloryr/allmusic/server/AllMusicFolia.java index 0243c5e3..1fc340b9 100644 --- a/folia/src/main/java/com/coloryr/allmusic/server/AllMusicFolia.java +++ b/folia/src/main/java/com/coloryr/allmusic/server/AllMusicFolia.java @@ -50,6 +50,26 @@ public void onEnable() { AllMusic.log.info("§2PAPI未挂钩"); } + if (Bukkit.getPluginManager().getPlugin("Vault") != null + && AllMusic.getConfig().economy.vault) { + try { + VaultHook vault = new VaultHook(); + AllMusic.economy = vault; + if (vault.setupEconomy()) { + AllMusic.log.info("§2Vault支持已启动"); + } else { + AllMusic.log.info("§2Vault未挂钩"); + AllMusic.economy = null; + } + } catch (Exception e) { + AllMusic.log.info("§2Vault未挂钩"); + AllMusic.economy = null; + } + } else { + AllMusic.log.info("§2Vault未挂钩"); + AllMusic.economy = null; + } + if (AllMusic.getConfig().topPAPI) { PlayMusic.nowPlayMusic = new TopSongInfoObj(); PlayMusic.lyric = new TopLyricSave(); @@ -58,26 +78,6 @@ public void onEnable() { getServer().getMessenger().registerIncomingPluginChannel(this, AllMusic.channelBC, pluginMessage); AllMusic.log.info("§2设置为顶层模式"); } else { - if (Bukkit.getPluginManager().getPlugin("Vault") != null - && AllMusic.getConfig().economy.vault) { - try { - VaultHook vault = new VaultHook(); - AllMusic.economy = vault; - if (vault.setupEconomy()) { - AllMusic.log.info("§2Vault支持已启动"); - } else { - AllMusic.log.info("§2Vault未挂钩"); - AllMusic.economy = null; - } - } catch (Exception e) { - AllMusic.log.info("§2Vault未挂钩"); - AllMusic.economy = null; - } - } else { - AllMusic.log.info("§2Vault未挂钩"); - AllMusic.economy = null; - } - CommandFolia command = new CommandFolia(); getServer().getMessenger().registerOutgoingPluginChannel(this, AllMusic.channel); PluginCommand command1 = Bukkit.getPluginCommand("music"); diff --git a/server/src/main/java/com/coloryr/allmusic/server/AllMusicBukkit.java b/server/src/main/java/com/coloryr/allmusic/server/AllMusicBukkit.java index 6f4ccb8e..735ed521 100644 --- a/server/src/main/java/com/coloryr/allmusic/server/AllMusicBukkit.java +++ b/server/src/main/java/com/coloryr/allmusic/server/AllMusicBukkit.java @@ -35,6 +35,12 @@ public void onEnable() { AllMusic.log.info("§2Spigot不支持"); } + new AllMusic().init(plugin.getDataFolder()); + if (!AllMusic.isRun) { + Bukkit.getPluginManager().disablePlugin(this); + return; + } + if (Bukkit.getPluginManager().getPlugin("Vault") != null && AllMusic.getConfig().economy.vault) { try { @@ -55,12 +61,6 @@ public void onEnable() { AllMusic.economy = null; } - new AllMusic().init(plugin.getDataFolder()); - if (!AllMusic.isRun) { - Bukkit.getPluginManager().disablePlugin(this); - return; - } - if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { PAPI = new AllMusicPAPI(this); if (!PAPI.register()) { diff --git a/server_top/src/main/java/com/coloryr/allmusic/server/AllMusicVelocity.java b/server_top/src/main/java/com/coloryr/allmusic/server/AllMusicVelocity.java index 77ea4a62..eee7b18f 100644 --- a/server_top/src/main/java/com/coloryr/allmusic/server/AllMusicVelocity.java +++ b/server_top/src/main/java/com/coloryr/allmusic/server/AllMusicVelocity.java @@ -40,12 +40,15 @@ public AllMusicVelocity(ProxyServer server, Logger logger, @DataDirectory Path d public void onProxyInitialization(ProxyInitializeEvent event) { plugin = this; AllMusic.log = new LogVelocity(logger); + AllMusic.side = new SideVelocity(); + new AllMusic().init(dataDirectory.toFile()); + CommandMeta meta = server.getCommandManager().metaBuilder("music") .build(); channel = () -> AllMusic.channel; channelBC = MinecraftChannelIdentifier.from(AllMusic.channelBC); - AllMusic.side = new SideVelocity(); + server.getChannelRegistrar().register(channelBC); server.getCommandManager().register(meta, new CommandVelocity()); server.getEventManager().register(this, new ListenerVelocity()); diff --git a/version b/version index d40b13a3..dd9db9fc 100644 --- a/version +++ b/version @@ -1 +1 @@ -3.1.7 \ No newline at end of file +3.1.8 \ No newline at end of file