Various improvements to staff chat.

This commit is contained in:
Brianna 2020-05-02 14:17:28 -04:00
parent b00dc9ec69
commit 166d1c3a2c
3 changed files with 11 additions and 6 deletions

View File

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

View File

@ -28,6 +28,10 @@ public class StaffChannel {
public void addMember(Player player) {
if (members.contains(player.getUniqueId())) return;
messageAll(UltimateModeration.getInstance().getLocale()
.getMessage("event.staffchat.alljoin")
.processPlaceholder("player", player.getName()).getMessage());
UltimateModeration.getInstance().getStaffChatManager().getChats().values().stream().forEach(members1 -> {
if (members1.listMembers().contains(player.getUniqueId())) {
members1.removeMember(player);
@ -37,16 +41,13 @@ public class StaffChannel {
if (chatLog.size() > 5) {
chatLog.stream().skip(chatLog.size() - 3).forEach(message -> player.sendMessage(Methods.formatText(message)));
}
messageAll(UltimateModeration.getInstance().getLocale()
.getMessage("event.staffchat.join")
.processPlaceholder("channel", channelName).getMessage());
}
public void removeMember(Player player) {
members.remove(player.getUniqueId());
messageAll(UltimateModeration.getInstance().getLocale()
.getMessage("event.staffchat.leave")
.processPlaceholder("channel", channelName).getMessage());
.getMessage("event.staffchat.allleave")
.processPlaceholder("player", player.getName()).getMessage());
}
public void processMessage(String message, Player player) {

View File

@ -69,7 +69,9 @@ event:
message: '&7You have been warned'
staffchat:
leave: '&7You left &6%channel% &7successfully.'
leave: '&7You joined &6%channel% &7successfully.'
join: '&7You joined &6%channel% &7successfully.'
allleave: '&6%player% &7has left the channel.'
alljoin: '&6%player% has joined the channel.'
nochannels: '&cYou are not in any channels.'
format: '&%color%[%channel%] %player%&%color%: %message%'
slowmode: