mirror of
				https://github.com/Aust1n46/VentureChat.git
				synced 2025-10-31 06:02:23 +00:00 
			
		
		
		
	Fixed issue with sync system not working for autojoin: false channels.
This commit is contained in:
		
							parent
							
								
									9b04925c35
								
							
						
					
					
						commit
						22662a6872
					
				| @ -788,12 +788,11 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener { | |||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				int size = msgin.read(); | 				int size = msgin.read(); | ||||||
| 				// System.out.println(size); |  | ||||||
| 				for(int a = 0; a < size; a++) { | 				for(int a = 0; a < size; a++) { | ||||||
| 					String ch = msgin.readUTF(); | 					String ch = msgin.readUTF(); | ||||||
| 					if(ChatChannel.isChannel(ch)) { | 					if(ChatChannel.isChannel(ch)) { | ||||||
| 						ChatChannel cha = ChatChannel.getChannel(ch); | 						ChatChannel cha = ChatChannel.getChannel(ch); | ||||||
| 						if(cha.hasPermission() && p.getPlayer().hasPermission(cha.getPermission())) { | 						if(!cha.hasPermission() || p.getPlayer().hasPermission(cha.getPermission())) { | ||||||
| 							p.addListening(ch); | 							p.addListening(ch); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| @ -828,20 +827,22 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener { | |||||||
| 					p.addIgnore(UUID.fromString(i)); | 					p.addIgnore(UUID.fromString(i)); | ||||||
| 				} | 				} | ||||||
| 				if(!p.hasPlayed()) { | 				if(!p.hasPlayed()) { | ||||||
|  | 					boolean isThereABungeeChannel = false; | ||||||
| 					for(ChatChannel ch : ChatChannel.getAutojoinList()) { | 					for(ChatChannel ch : ChatChannel.getAutojoinList()) { | ||||||
| 						if(ch.hasPermission()) { | 						if(!ch.hasPermission() || p.getPlayer().hasPermission(ch.getPermission())) {	 | ||||||
| 							if(p.getPlayer().hasPermission(ch.getPermission())) { |  | ||||||
| 							p.addListening(ch.getName());	 | 							p.addListening(ch.getName());	 | ||||||
|  | 							if(ch.getBungee()) { | ||||||
|  | 								isThereABungeeChannel = true; | ||||||
| 							} | 							} | ||||||
| 						} | 						} | ||||||
| 						else { |  | ||||||
| 							p.addListening(ch.getName()); |  | ||||||
| 						} |  | ||||||
| 					} | 					} | ||||||
| 					p.setHasPlayed(true); | 					p.setHasPlayed(true); | ||||||
|  | 					// Only run a sync update if the player joined a BungeeCord channel | ||||||
|  | 					if(isThereABungeeChannel) { | ||||||
| 						this.synchronize(p, true); | 						this.synchronize(p, true); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
| 			if(subchannel.equals("Ignore")) { | 			if(subchannel.equals("Ignore")) { | ||||||
| 				String identifier = msgin.readUTF(); | 				String identifier = msgin.readUTF(); | ||||||
| 				if(identifier.equals("Send")) { | 				if(identifier.equals("Send")) { | ||||||
|  | |||||||
| @ -173,12 +173,18 @@ public class CommandListener implements CommandExecutor, Listener { | |||||||
| 						} | 						} | ||||||
| 						mcp.addListening(channel.getName()); | 						mcp.addListening(channel.getName()); | ||||||
| 						mcp.setCurrentChannel(channel); | 						mcp.setCurrentChannel(channel); | ||||||
|  | 						if(channel.getBungee()) { | ||||||
|  | 							MineverseChat.getInstance().synchronize(mcp, true); | ||||||
|  | 						} | ||||||
| 						event.setCancelled(true); | 						event.setCancelled(true); | ||||||
| 						return; | 						return; | ||||||
| 					} | 					} | ||||||
| 					if(message.toLowerCase().startsWith("/" + channel.getAlias() + " ")) { | 					if(message.toLowerCase().startsWith("/" + channel.getAlias() + " ")) { | ||||||
| 						message = message.substring(channel.getAlias().length() + 1); | 						message = message.substring(channel.getAlias().length() + 1); | ||||||
| 						mcp.addListening(channel.getName()); | 						mcp.addListening(channel.getName()); | ||||||
|  | 						if(channel.getBungee()) { | ||||||
|  | 							MineverseChat.getInstance().synchronize(mcp, true); | ||||||
|  | 						} | ||||||
| 						mcp.setQuickChannel(channel); | 						mcp.setQuickChannel(channel); | ||||||
| 						/*String format = ""; | 						/*String format = ""; | ||||||
| 						if(plugin.getConfig().getConfigurationSection("channels." + channel.getName()).getString("format").equalsIgnoreCase("Default")) { | 						if(plugin.getConfig().getConfigurationSection("channels." + channel.getName()).getString("format").equalsIgnoreCase("Default")) { | ||||||
| @ -211,6 +217,9 @@ public class CommandListener implements CommandExecutor, Listener { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * Unused | ||||||
|  | 	 */ | ||||||
| 	@Override | 	@Override | ||||||
| 	public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | 	public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||||||
| 		if(!(sender instanceof Player)) { | 		if(!(sender instanceof Player)) { | ||||||
| @ -227,6 +236,9 @@ public class CommandListener implements CommandExecutor, Listener { | |||||||
| 				mcp.setQuickChat(true); | 				mcp.setQuickChat(true); | ||||||
| 				mcp.setQuickChannel(channel); | 				mcp.setQuickChannel(channel); | ||||||
| 				mcp.addListening(channel.getName()); | 				mcp.addListening(channel.getName()); | ||||||
|  | 				if(channel.getBungee()) { | ||||||
|  | 					MineverseChat.getInstance().synchronize(mcp, true); | ||||||
|  | 				} | ||||||
| 				String msg = ""; | 				String msg = ""; | ||||||
| 				for(int x = 0; x < args.length; x++) { | 				for(int x = 0; x < args.length; x++) { | ||||||
| 					if(args[x].length() > 0) msg += " " + args[x]; | 					if(args[x].length() > 0) msg += " " + args[x]; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Aust1n46
						Aust1n46