Fixed an issue with action bar messages

This commit is contained in:
Indyuce 2022-11-04 15:11:09 +01:00
parent a48041b756
commit 39d68cfd74

View File

@ -1,8 +1,6 @@
package net.Indyuce.mmoitems.api.util.message; package net.Indyuce.mmoitems.api.util.message;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.adventure.text.serializer.gson.GsonComponentSerializer;
import io.lumine.mythic.lib.api.util.LegacyComponent;
import net.Indyuce.mmocore.api.player.PlayerActivity; import net.Indyuce.mmocore.api.player.PlayerActivity;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOItems;
@ -63,13 +61,11 @@ public class FormattedMessage {
if (message.isEmpty()) if (message.isEmpty())
return; return;
final String jsonMessage = GsonComponentSerializer.gson().serialize(LegacyComponent.simpleParse(message));
if (actionBar) { if (actionBar) {
if (Bukkit.getPluginManager().isPluginEnabled("MMOCore")) if (Bukkit.getPluginManager().isPluginEnabled("MMOCore"))
PlayerData.get(player).setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE); PlayerData.get(player).setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE);
MythicLib.plugin.getVersion().getWrapper().sendActionBar(player, jsonMessage); MythicLib.plugin.getVersion().getWrapper().sendActionBar(player, message);
} else } else
player.sendMessage(message); player.sendMessage(message);
} }