Skip to content

Commit

Permalink
up 错误的初始化顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloryr committed Jul 25, 2024
1 parent 49f6b6b commit 318b66e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 28 deletions.
40 changes: 20 additions & 20 deletions folia/src/main/java/com/coloryr/allmusic/server/AllMusicFolia.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.7
3.1.8

0 comments on commit 318b66e

Please sign in to comment.