mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-14 22:56:31 +01:00
Add sendGroupedPacket convenience method to PacketGroupingAudience
This commit is contained in:
parent
6526a2658a
commit
d84964d55b
@ -14,6 +14,7 @@ import net.minestom.server.adventure.AdventurePacketConvertor;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.message.ChatPosition;
|
||||
import net.minestom.server.message.Messenger;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.play.*;
|
||||
import net.minestom.server.utils.PacketUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -44,6 +45,10 @@ public interface PacketGroupingAudience extends ForwardingAudience {
|
||||
*/
|
||||
@NotNull Collection<Player> getPlayers();
|
||||
|
||||
default void sendGroupedPacket(ServerPacket packet) {
|
||||
PacketUtils.sendGroupedPacket(this.getPlayers(), packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void sendMessage(@NotNull Identity source, @NotNull Component message, @NotNull MessageType type) {
|
||||
Messenger.sendMessage(this.getPlayers(), message, ChatPosition.fromMessageType(type), source.uuid());
|
||||
|
Loading…
Reference in New Issue
Block a user