Made staff chat messages more intuitive.

This commit is contained in:
Brianna 2020-06-04 12:06:28 -05:00
parent 8db3c9070c
commit 0346950407
2 changed files with 8 additions and 3 deletions

View File

@ -38,7 +38,7 @@ public class CommandStaffChat extends AbstractCommand {
return ReturnType.FAILURE;
}
instance.getLocale().getMessage("event.staffchat.leave")
instance.getLocale().getMessage("event.staffchat.join")
.processPlaceholder("channel", channelName).sendPrefixedMessage(player);
instance.getStaffChatManager().getChat(channelName).addMember(player);
return ReturnType.SUCCESS;

View File

@ -30,7 +30,7 @@ public class StaffChannel {
if (members.contains(player.getUniqueId())) return;
messageAll(UltimateModeration.getInstance().getLocale()
.getMessage("event.staffchat.alljoin")
.processPlaceholder("player", player.getName()).getMessage());
.processPlaceholder("player", player.getName()).getMessage(), player);
UltimateModeration.getInstance().getStaffChatManager().getChats().values().stream().forEach(members1 -> {
if (members1.listMembers().contains(player.getUniqueId())) {
@ -47,7 +47,7 @@ public class StaffChannel {
members.remove(player.getUniqueId());
messageAll(UltimateModeration.getInstance().getLocale()
.getMessage("event.staffchat.allleave")
.processPlaceholder("player", player.getName()).getMessage());
.processPlaceholder("player", player.getName()).getMessage(), player);
}
public void processMessage(String message, Player player) {
@ -60,8 +60,13 @@ public class StaffChannel {
}
public void messageAll(String message) {
messageAll(message, null);
}
public void messageAll(String message, Player exempt) {
chatLog.add(message);
for (Player player : Bukkit.getOnlinePlayers()) {
if (exempt != null && player == exempt) continue;
if (!members.contains(player.getUniqueId()) && !player.hasPermission("um.staffchat.spy")) continue;
player.sendMessage(Methods.formatText(message));
}