Skip to content

Commit

Permalink
fix: use native bossbar title in 1.20.5 or newer
Browse files Browse the repository at this point in the history
EinfachBeez committed Aug 20, 2024
1 parent d8cffc0 commit 58b3eb3
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.codingarea.challenges.plugin.management.server.scoreboard;

import net.anweisen.utilities.bukkit.utils.logging.Logger;
import net.anweisen.utilities.bukkit.utils.misc.MinecraftVersion;
import net.codingarea.challenges.plugin.ChallengeAPI;
import net.codingarea.challenges.plugin.Challenges;
import net.codingarea.challenges.plugin.content.Message;
@@ -35,7 +36,11 @@ private BossBar createBossbar(@Nonnull BossBarInstance instance) {
}

private void apply(@Nonnull BossBar bossbar, @Nonnull BossBarInstance instance) {
NMSUtils.setBossBarTitle(bossbar, instance.title);
if (MinecraftVersion.current().isNewerOrEqualThan(MinecraftVersion.V1_20_5)) {
bossbar.setTitle(instance.title.toPlainText());
} else {
NMSUtils.setBossBarTitle(bossbar, instance.title);
}
bossbar.setColor(instance.color);
bossbar.setStyle(instance.style);
bossbar.setProgress(instance.progress);

0 comments on commit 58b3eb3

Please sign in to comment.