mirror of
				https://github.com/proxiodev/RedisBungee.git
				synced 2025-10-31 15:58:03 +00:00 
			
		
		
		
	Make ServerPlayers messages looking for counts be less expensive to run by skipping the UUID lookup.
This commit is contained in:
		
							parent
							
								
									66996a295c
								
							
						
					
					
						commit
						86efdeaf8e
					
				| @ -182,11 +182,24 @@ public class RedisBungeeListener implements Listener { | |||||||
|                             } catch (Exception e) {} |                             } catch (Exception e) {} | ||||||
|                             out.writeUTF("ServerPlayers"); |                             out.writeUTF("ServerPlayers"); | ||||||
|                             Multimap<String, UUID> multimap = RedisBungee.getApi().getServerToPlayers(); |                             Multimap<String, UUID> multimap = RedisBungee.getApi().getServerToPlayers(); | ||||||
|                             Multimap<String, String> human = HashMultimap.create(); | 
 | ||||||
|                             for (Map.Entry<String, UUID> entry : multimap.entries()) { |                             boolean includesUsers = type1.equals("PLAYERS"); | ||||||
|                                 human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false)); | 
 | ||||||
|  |                             if (includesUsers) { | ||||||
|  |                                 Multimap<String, String> human = HashMultimap.create(); | ||||||
|  |                                 for (Map.Entry<String, UUID> entry : multimap.entries()) { | ||||||
|  |                                     human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false)); | ||||||
|  |                                 } | ||||||
|  |                                 serializeMultimap(human, true, out); | ||||||
|  |                             } else { | ||||||
|  |                                 // Due to Java generics, we are forced to coerce UUIDs into strings. This is less | ||||||
|  |                                 // expensive than looking up names, since we just want counts. | ||||||
|  |                                 Multimap<String, String> flunk = HashMultimap.create(); | ||||||
|  |                                 for (Map.Entry<String, UUID> entry : multimap.entries()) { | ||||||
|  |                                     flunk.put(entry.getKey(), entry.getValue().toString()); | ||||||
|  |                                 } | ||||||
|  |                                 serializeMultimap(flunk, false, out); | ||||||
|                             } |                             } | ||||||
|                             serializeMultimap(human, type1.equals("PLAYERS"), out); |  | ||||||
|                             break; |                             break; | ||||||
|                         case "Proxy": |                         case "Proxy": | ||||||
|                             out.writeUTF("Proxy"); |                             out.writeUTF("Proxy"); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Tux
						Tux