Clean some formatting etc
This commit is contained in:
		| @@ -26,7 +26,7 @@ import net.md_5.bungee.packet.DefinedPacket; | ||||
| import net.md_5.bungee.plugin.JavaPluginManager; | ||||
| import net.md_5.bungee.tablist.GlobalPingTabList; | ||||
| import net.md_5.bungee.tablist.GlobalTabList; | ||||
| import net.md_5.bungee.tablist.ServerUnqiueTabList; | ||||
| import net.md_5.bungee.tablist.ServerUniqueTabList; | ||||
| import net.md_5.bungee.tablist.TabListHandler; | ||||
|  | ||||
| /** | ||||
| @@ -165,14 +165,15 @@ public class BungeeCord | ||||
|  | ||||
|         switch (config.tabList) | ||||
|         { | ||||
|             default: case 1: | ||||
|             default: | ||||
|             case 1: | ||||
|                 tabListHandler = new GlobalPingTabList(); | ||||
|                 break; | ||||
|             case 2: | ||||
|                 tabListHandler = new GlobalTabList(); | ||||
|                 break; | ||||
|             case 3: | ||||
|                 tabListHandler = new ServerUnqiueTabList(); | ||||
|                 tabListHandler = new ServerUniqueTabList(); | ||||
|                 break; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -72,9 +72,9 @@ public class Configuration | ||||
|     public int maxPlayers = 1; | ||||
|     /** | ||||
|      * Tab list 1: For a tab list that is global over all server (using their | ||||
|      * minecraft name) and updating their ping frequently 2: Same as 1 but does | ||||
|      * not update their ping frequently, just once. 3: Makes the individual | ||||
|      * servers handle the tab list (server unique) | ||||
|      * Minecraft name) and updating their ping frequently 2: Same as 1 but does | ||||
|      * not update their ping frequently, just once, 3: Makes the individual | ||||
|      * servers handle the tab list (server unique). | ||||
|      */ | ||||
|     public int tabList = 1; | ||||
|     /** | ||||
|   | ||||
| @@ -12,8 +12,7 @@ public class GlobalPingTabList extends GlobalTabList | ||||
| { | ||||
|  | ||||
|     public static final int PING_THRESHOLD = 20; | ||||
|     private Map<UserConnection, Integer> lastPings = | ||||
|             Collections.synchronizedMap(new WeakHashMap<UserConnection, Integer>()); | ||||
|     private Map<UserConnection, Integer> lastPings = Collections.synchronizedMap(new WeakHashMap<UserConnection, Integer>()); | ||||
|  | ||||
|     @Override | ||||
|     public void onPingChange(final UserConnection con, final int ping) | ||||
|   | ||||
| @@ -16,9 +16,9 @@ public class GlobalTabList implements TabListHandler | ||||
|     @Override | ||||
|     public void onJoin(UserConnection con) | ||||
|     { | ||||
|         for (UserConnection con2 : BungeeCord.instance.connections.values()) | ||||
|         for (UserConnection c : BungeeCord.instance.connections.values()) | ||||
|         { | ||||
|             con.packetQueue.add(new PacketC9PlayerListItem(con2.username, true, con2.getPing())); | ||||
|             con.packetQueue.add(new PacketC9PlayerListItem(c.username, true, c.getPing())); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -9,11 +9,10 @@ import java.util.WeakHashMap; | ||||
| import net.md_5.bungee.UserConnection; | ||||
| import net.md_5.bungee.packet.PacketC9PlayerListItem; | ||||
| 
 | ||||
| public class ServerUnqiueTabList implements TabListHandler | ||||
| public class ServerUniqueTabList implements TabListHandler | ||||
| { | ||||
| 
 | ||||
|     private Map<UserConnection, Set<String>> sentUsernames = | ||||
|             Collections.synchronizedMap(new WeakHashMap<UserConnection, Set<String>>()); | ||||
|     private Map<UserConnection, Set<String>> sentUsernames = Collections.synchronizedMap(new WeakHashMap<UserConnection, Set<String>>()); | ||||
| 
 | ||||
|     @Override | ||||
|     public void onJoin(UserConnection con) | ||||
| @@ -26,14 +25,14 @@ public class ServerUnqiueTabList implements TabListHandler | ||||
|         Set<String> usernames = sentUsernames.get(con); | ||||
|         if (usernames != null) | ||||
|         { | ||||
| 	        synchronized (usernames) | ||||
| 	        { | ||||
| 	            for (String username : usernames) | ||||
| 	            { | ||||
| 	                con.packetQueue.add(new PacketC9PlayerListItem(username, false, 9999)); | ||||
| 	            } | ||||
| 	            usernames.clear(); | ||||
| 	        } | ||||
|             synchronized (usernames) | ||||
|             { | ||||
|                 for (String username : usernames) | ||||
|                 { | ||||
|                     con.packetQueue.add(new PacketC9PlayerListItem(username, false, 9999)); | ||||
|                 } | ||||
|                 usernames.clear(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
		Reference in New Issue
	
	Block a user
	 md_5
					md_5