mirror of
				https://github.com/Aust1n46/VentureChat.git
				synced 2025-10-30 21:52:23 +00:00 
			
		
		
		
	Add reason for /muteall.
This commit is contained in:
		
							parent
							
								
									c12c00b784
								
							
						
					
					
						commit
						44c2363db3
					
				| @ -54,7 +54,9 @@ MessageToggleOff: '&6You are now blocking messages.' | |||||||
| MessageToggleOn: '&6You are now receiving messages.' | MessageToggleOn: '&6You are now receiving messages.' | ||||||
| MustListenOneChannel: '&cYou need to be listening on at least one channel, setting you into the default channel.' | 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.' | 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.' | 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}' | 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}' | 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}' | MutePlayerPlayerTime: '&cYou have just been muted in: {channel_color}{channel_name} &cfor {time}' | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ public class Muteall extends MineverseCommand { | |||||||
| 			if(args.length < 1) { | 			if(args.length < 1) { | ||||||
| 				sender.sendMessage(LocalizedMessage.COMMAND_INVALID_ARGUMENTS.toString() | 				sender.sendMessage(LocalizedMessage.COMMAND_INVALID_ARGUMENTS.toString() | ||||||
| 						.replace("{command}", "/muteall") | 						.replace("{command}", "/muteall") | ||||||
| 						.replace("{args}", "[player]")); | 						.replace("{args}", "[player] {reason}")); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			MineverseChatPlayer player = MineverseChatAPI.getMineverseChatPlayer(args[0]); | 			MineverseChatPlayer player = MineverseChatAPI.getMineverseChatPlayer(args[0]); | ||||||
| @ -30,6 +30,15 @@ public class Muteall extends MineverseCommand { | |||||||
| 						.replace("{args}", args[0])); | 						.replace("{args}", args[0])); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  | 			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; | 				boolean bungee = false; | ||||||
| 				for(ChatChannel channel : ChatChannel.getChatChannels()) { | 				for(ChatChannel channel : ChatChannel.getChatChannels()) { | ||||||
| 					if(channel.isMutable()) { | 					if(channel.isMutable()) { | ||||||
| @ -51,6 +60,31 @@ public class Muteall extends MineverseCommand { | |||||||
| 					player.setModified(true); | 					player.setModified(true); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  | 			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; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 		else { | 		else { | ||||||
| 			sender.sendMessage(LocalizedMessage.COMMAND_NO_PERMISSION.toString()); | 			sender.sendMessage(LocalizedMessage.COMMAND_NO_PERMISSION.toString()); | ||||||
| 			return; | 			return; | ||||||
|  | |||||||
| @ -61,7 +61,9 @@ public enum LocalizedMessage { | |||||||
| 	MESSAGE_TOGGLE_ON("MessageToggleOn"), | 	MESSAGE_TOGGLE_ON("MessageToggleOn"), | ||||||
| 	MUST_LISTEN_ONE_CHANNEL("MustListenOneChannel"), | 	MUST_LISTEN_ONE_CHANNEL("MustListenOneChannel"), | ||||||
| 	MUTE_PLAYER_ALL_PLAYER("MutePlayerAllPlayer"), | 	MUTE_PLAYER_ALL_PLAYER("MutePlayerAllPlayer"), | ||||||
|  | 	MUTE_PLAYER_ALL_PLAYER_REASON("MutePlayerAllPlayerReason"), | ||||||
| 	MUTE_PLAYER_ALL_SENDER("MutePlayerAllSender"), | 	MUTE_PLAYER_ALL_SENDER("MutePlayerAllSender"), | ||||||
|  | 	MUTE_PLAYER_ALL_SENDER_REASON("MutePlayerAllSenderReason"), | ||||||
| 	MUTE_PLAYER_PLAYER("MutePlayerPlayer"), | 	MUTE_PLAYER_PLAYER("MutePlayerPlayer"), | ||||||
| 	MUTE_PLAYER_PLAYER_TIME("MutePlayerPlayerTime"), | 	MUTE_PLAYER_PLAYER_TIME("MutePlayerPlayerTime"), | ||||||
| 	MUTE_PLAYER_PLAYER_TIME_REASON("MutePlayerPlayerTimeReason"), | 	MUTE_PLAYER_PLAYER_TIME_REASON("MutePlayerPlayerTimeReason"), | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Aust1n46
						Aust1n46