mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-22 11:55:54 +01:00
Change Chatty & LunaChat send logic to Components
This commit is contained in:
parent
74d661d523
commit
26c472d0b8
@ -28,6 +28,7 @@ import com.discordsrv.common.component.util.ComponentUtil;
|
||||
import com.discordsrv.common.logging.NamedLogger;
|
||||
import com.discordsrv.common.module.type.PluginIntegration;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitComponentSerializer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -129,7 +130,10 @@ public class ChattyChatIntegration extends PluginIntegration<BukkitDiscordSRV> i
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull MinecraftComponent component) {
|
||||
chat.sendMessage(BukkitComponentSerializer.legacy().serialize(ComponentUtil.fromAPI(component)));
|
||||
Component comp = ComponentUtil.fromAPI(component);
|
||||
for (Player recipient : chat.getRecipients(null)) {
|
||||
discordSRV.playerProvider().player(recipient).sendMessage(comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ import com.github.ucchyocean.lc3.channel.Channel;
|
||||
import com.github.ucchyocean.lc3.member.ChannelMember;
|
||||
import com.github.ucchyocean.lc3.member.ChannelMemberPlayer;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -145,8 +147,10 @@ public class LunaChatIntegration extends PluginIntegration<BukkitDiscordSRV> imp
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull MinecraftComponent component) {
|
||||
String message = BukkitComponentSerializer.legacy().serialize(ComponentUtil.fromAPI(component));
|
||||
channel.chatFromOtherSource("Discord", null, message);
|
||||
BaseComponent[] baseComponent = BungeeComponentSerializer.get().serialize(ComponentUtil.fromAPI(component));
|
||||
for (ChannelMember member : channel.getMembers()) {
|
||||
member.sendMessage(baseComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user