Added party spy

This commit is contained in:
2021-08-08 18:27:30 +02:00
parent 18c3c4c6f4
commit c701621e42
3 changed files with 17 additions and 4 deletions
@@ -181,12 +181,21 @@ public class ChatHandler {
List<Template> templates = new ArrayList<>(List.of(
Template.of("sender", senderName),
Template.of("sendername", senderName),
Template.of("partyname", party.getPartyName()),
Template.of("message", updatedMessage),
Template.of("server", Bukkit.getServerName()),
Template.of("[i]", itemComponent(player.getInventory().getItemInMainHand()))));
Component component = miniMessage.parse(Config.PARTY_FORMAT, templates);
sendPartyMessage(player, party.getPartyId(), component);
Component spyMessage = miniMessage.parse(Config.PARTY_SPY, templates);
for(Player pl : Bukkit.getOnlinePlayers()) {
if(pl.hasPermission(Config.SPYPERMISSION) && !party.getPartyUsers().containsKey(pl.getUniqueId())) { // todo add a toggle for social spy
pl.sendMessage(spyMessage);
}
}
}
private void sendChatChannelMessage(CustomChannel chatChannel, UUID uuid, Component component) {