diff --git a/src/Messages.yml b/src/Messages.yml index 599d2fd..8e1fb48 100644 --- a/src/Messages.yml +++ b/src/Messages.yml @@ -54,7 +54,9 @@ MessageToggleOff: '&6You are now blocking messages.' MessageToggleOn: '&6You are now receiving messages.' MustListenOneChannel: '&cYou need to be listening on at least one channel, setting you into the default channel.' MutePlayerAllPlayer: '&cYou have just been muted in all channels.' +MutePlayerAllPlayerReason: '&cYou have just been muted in all channels. &4Reason:&c {reason}' MutePlayerAllSender: '&cMuted player &6{player} &cin all channels.' +MutePlayerAllSenderReason: '&cMuted player &6{player} &cin all channels. &4Reason:&c {reason}' MutePlayerPlayer: '&cYou have just been muted in: {channel_color}{channel_name}' MutePlayerPlayerReason: '&cYou have just been muted in: {channel_color}{channel_name} &4Reason:&c {reason}' MutePlayerPlayerTime: '&cYou have just been muted in: {channel_color}{channel_name} &cfor {time}' diff --git a/src/mineverse/Aust1n46/chat/command/mute/Muteall.java b/src/mineverse/Aust1n46/chat/command/mute/Muteall.java index b759709..66b4a27 100644 --- a/src/mineverse/Aust1n46/chat/command/mute/Muteall.java +++ b/src/mineverse/Aust1n46/chat/command/mute/Muteall.java @@ -21,7 +21,7 @@ public class Muteall extends MineverseCommand { if(args.length < 1) { sender.sendMessage(LocalizedMessage.COMMAND_INVALID_ARGUMENTS.toString() .replace("{command}", "/muteall") - .replace("{args}", "[player]")); + .replace("{args}", "[player] {reason}")); return; } MineverseChatPlayer player = MineverseChatAPI.getMineverseChatPlayer(args[0]); @@ -30,30 +30,64 @@ public class Muteall extends MineverseCommand { .replace("{args}", args[0])); return; } - boolean bungee = false; - for(ChatChannel channel : ChatChannel.getChatChannels()) { - if(channel.isMutable()) { - player.addMute(channel.getName()); - if(channel.getBungee()) { - bungee = true; + String reason = ""; + if(args.length > 1) { + StringBuilder reasonBuilder = new StringBuilder(); + for(int a = 1; a < args.length; a ++) { + reasonBuilder.append(args[a]); + } + reason = reasonBuilder.toString(); + } + if(reason.isEmpty()) { + boolean bungee = false; + for(ChatChannel channel : ChatChannel.getChatChannels()) { + if(channel.isMutable()) { + player.addMute(channel.getName()); + if(channel.getBungee()) { + bungee = true; + } } } + if(bungee) { + MineverseChat.getInstance().synchronize(player, true); + } + sender.sendMessage(LocalizedMessage.MUTE_PLAYER_ALL_SENDER.toString() + .replace("{player}", player.getName())); + if(player.isOnline()) { + player.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_ALL_PLAYER.toString()); + } + else + player.setModified(true); + return; } - if(bungee) { - MineverseChat.getInstance().synchronize(player, true); + else { + boolean bungee = false; + for(ChatChannel channel : ChatChannel.getChatChannels()) { + if(channel.isMutable()) { + player.addMute(channel.getName(), reason); + if(channel.getBungee()) { + bungee = true; + } + } + } + if(bungee) { + MineverseChat.getInstance().synchronize(player, true); + } + sender.sendMessage(LocalizedMessage.MUTE_PLAYER_ALL_SENDER_REASON.toString() + .replace("{player}", player.getName()) + .replace("{reason}", reason)); + if(player.isOnline()) { + player.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_ALL_PLAYER_REASON.toString() + .replace("{reason}", reason)); + } + else + player.setModified(true); + return; } - sender.sendMessage(LocalizedMessage.MUTE_PLAYER_ALL_SENDER.toString() - .replace("{player}", player.getName())); - if(player.isOnline()) { - player.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_ALL_PLAYER.toString()); - } - else - player.setModified(true); - return; } else { sender.sendMessage(LocalizedMessage.COMMAND_NO_PERMISSION.toString()); return; } } -} \ No newline at end of file +} diff --git a/src/mineverse/Aust1n46/chat/localization/LocalizedMessage.java b/src/mineverse/Aust1n46/chat/localization/LocalizedMessage.java index f99ceb8..f13b99e 100644 --- a/src/mineverse/Aust1n46/chat/localization/LocalizedMessage.java +++ b/src/mineverse/Aust1n46/chat/localization/LocalizedMessage.java @@ -61,7 +61,9 @@ public enum LocalizedMessage { MESSAGE_TOGGLE_ON("MessageToggleOn"), MUST_LISTEN_ONE_CHANNEL("MustListenOneChannel"), MUTE_PLAYER_ALL_PLAYER("MutePlayerAllPlayer"), + MUTE_PLAYER_ALL_PLAYER_REASON("MutePlayerAllPlayerReason"), MUTE_PLAYER_ALL_SENDER("MutePlayerAllSender"), + MUTE_PLAYER_ALL_SENDER_REASON("MutePlayerAllSenderReason"), MUTE_PLAYER_PLAYER("MutePlayerPlayer"), MUTE_PLAYER_PLAYER_TIME("MutePlayerPlayerTime"), MUTE_PLAYER_PLAYER_TIME_REASON("MutePlayerPlayerTimeReason"),