From b7362420aec70b48af6d261859a764e0f8a49fee Mon Sep 17 00:00:00 2001 From: byteful Date: Thu, 9 May 2024 18:10:24 -0500 Subject: [PATCH] v1.3.7 --- .../plugin/leveltools/listeners/XPListener.java | 3 +-- .../plugin/leveltools/util/LevelToolsUtil.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java b/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java index 647530f..fd01de4 100644 --- a/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java +++ b/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java @@ -3,7 +3,6 @@ import static redempt.redlib.misc.FormatUtils.formatMoney; import com.cryptomorin.xseries.XSound; -import com.cryptomorin.xseries.messages.ActionBar; import java.util.List; import me.byteful.plugin.leveltools.LevelToolsPlugin; import me.byteful.plugin.leveltools.api.event.LevelToolsLevelIncreaseEvent; @@ -60,7 +59,7 @@ protected void handle(LevelToolsItem tool, Player player, double modifier) { .replace("{level}", String.valueOf(tool.getLevel())) .replace("{max_xp_formatted}", formatMoney(tool.getMaxXp())) .replace("{xp_formatted}", formatMoney(tool.getXp()))); - ActionBar.sendActionBar(player, text); + LevelToolsUtil.sendActionBar(player, text); } if (tool.getXp() >= tool.getMaxXp()) { diff --git a/src/main/java/me/byteful/plugin/leveltools/util/LevelToolsUtil.java b/src/main/java/me/byteful/plugin/leveltools/util/LevelToolsUtil.java index 4153b88..7c78890 100644 --- a/src/main/java/me/byteful/plugin/leveltools/util/LevelToolsUtil.java +++ b/src/main/java/me/byteful/plugin/leveltools/util/LevelToolsUtil.java @@ -5,6 +5,7 @@ import static redempt.redlib.misc.FormatUtils.formatMoney; import com.cryptomorin.xseries.XMaterial; +import com.cryptomorin.xseries.messages.ActionBar; import com.google.common.base.Strings; import de.tr7zw.changeme.nbtapi.NBTItem; import java.math.BigDecimal; @@ -20,6 +21,8 @@ import me.byteful.plugin.leveltools.api.item.LevelToolsItem; import me.byteful.plugin.leveltools.api.item.impl.NBTLevelToolsItem; import me.byteful.plugin.leveltools.api.item.impl.PDCLevelToolsItem; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; import org.apache.commons.lang.math.NumberUtils; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -342,4 +345,12 @@ private static ConfigurationSection getCsFromType(Material material) { return LevelToolsPlugin.getInstance().getConfig().getConfigurationSection("tool_rewards"); } } + + public static void sendActionBar(Player player, String msg) { + if (RedLib.MID_VERSION > 12) { + player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(msg)); + } else { + ActionBar.sendActionBar(player, msg); + } + } }