1
mirror of https://github.com/Shiewk/SModeration.git synced 2026-04-29 06:34:17 +02:00

Broadcast cancellation

This commit is contained in:
Shy
2024-06-08 17:48:55 +02:00
parent cd5777a0ee
commit d0de45ea84
2 changed files with 22 additions and 6 deletions
@@ -86,6 +86,27 @@ public class Punishment {
return buffer.array();
}
private Component cancellationMessage(){
String msg = "";
switch (type){
case MUTE -> msg = "unmuted";
case KICK -> msg = "unkicked??";
case BAN -> msg = "unbanned";
}
return Component.text(PlayerUtil.offlinePlayerName(to)).color(SECONDARY_COLOR)
.append(Component.text(" was ").color(PRIMARY_COLOR))
.append(Component.text(msg))
.append(Component.text(" by ").color(PRIMARY_COLOR))
.append(Component.text(PlayerUtil.offlinePlayerName(cancelledBy)))
.append(Component.text(".").color(PRIMARY_COLOR));
}
public void broadcastCancellation(PunishmentContainer container){
for (CommandSender sender : container.collectBroadcastTargets()) {
sender.sendMessage(cancellationMessage());
}
}
/**
* @deprecated behaves weirdly, does not support punishment reasons
*/