Skip to content

Commit

Permalink
Merge pull request #97 from webhead1104/master
Browse files Browse the repository at this point in the history
Play a sound to players in a chat channel
  • Loading branch information
Foxikle authored Jun 16, 2024
2 parents 4507cb7 + d9ab82c commit 7ec66eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/net/cytonic/cytosis/messaging/RabbitMQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import net.cytonic.cytosis.logging.Logger;
import net.cytonic.cytosis.utils.OfflinePlayer;
import net.cytonic.cytosis.utils.Utils;
import net.kyori.adventure.sound.*;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.json.JSONComponentSerializer;
import net.minestom.server.entity.Player;
import net.minestom.server.sound.SoundEvent;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -189,19 +191,22 @@ public void receiveChatMessages() {
case MOD -> // send a message to all players with cytonic.chat.mod permission
Cytosis.getOnlinePlayers().forEach(player -> {
if (player.hasPermission("cytonic.chat.mod")) {
player.playSound(Sound.sound(SoundEvent.ENTITY_EXPERIENCE_ORB_PICKUP,Sound.Source.PLAYER, .7f, 1.0F));
player.sendMessage(chatMessage);
}
});

case STAFF -> // send a message to all players with cytonic.chat.staff permission
Cytosis.getOnlinePlayers().forEach(player -> {
if (player.hasPermission("cytonic.chat.staff")) {
player.playSound(Sound.sound(SoundEvent.ENTITY_EXPERIENCE_ORB_PICKUP,Sound.Source.PLAYER, .7f, 1.0F));
player.sendMessage(chatMessage);
}
});
case ADMIN -> // send a message to all players with cytonic.chat.admin permission
Cytosis.getOnlinePlayers().forEach(player -> {
if (player.hasPermission("cytonic.chat.admin")) {
player.playSound(Sound.sound(SoundEvent.ENTITY_EXPERIENCE_ORB_PICKUP,Sound.Source.PLAYER, .7f, 1.0F));
player.sendMessage(chatMessage);
}
});
Expand Down

0 comments on commit 7ec66eb

Please sign in to comment.