@@ -133,7 +133,6 @@ public void onDisconnect(PlayerDisconnectEvent event) {
133
133
UUID uuid = event .getPlayer ().getUniqueId ();
134
134
135
135
for (QueueType type : QueueType .values ()) {
136
- type .getQueueMap ().remove (uuid );
137
136
type .getPositionCache ().remove (uuid );
138
137
}
139
138
}
@@ -187,44 +186,42 @@ private void moveVeteran(boolean canMoveRegular) {
187
186
}
188
187
189
188
private void connectPlayer (QueueType type ) {
190
- Optional <Entry <UUID , String >> optional = type .getQueueMap ().entrySet ().stream ().findFirst ();
191
- if (!optional .isPresent ())
192
- return ;
189
+ for (Entry <UUID , String > entry : type .getQueueMap ().entrySet ()) {
190
+ ProxiedPlayer player = plugin .getProxy ().getPlayer (entry .getKey ());
191
+ if (player == null || !player .isConnected ()) {
192
+ continue ;
193
+ }
193
194
194
- Entry <UUID , String > entry = optional .get ();
195
- ProxiedPlayer player = plugin .getProxy ().getPlayer (entry .getKey ());
195
+ type .getQueueMap ().remove (entry .getKey ());
196
196
197
- type .getQueueMap ().remove (entry .getKey ());
198
- if (player == null || !player .isConnected ())
199
- return ;
197
+ player .sendMessage (ChatMessageType .CHAT , ChatUtils .parseToComponent (Config .JOININGMAINSERVER .replace ("%server%" , entry .getValue ())));
198
+ player .resetTabHeader ();
200
199
201
- player .sendMessage (ChatMessageType .CHAT , ChatUtils .parseToComponent (Config .JOININGMAINSERVER .replace ("%server%" , entry .getValue ())));
202
- player .resetTabHeader ();
200
+ if (StorageTool .isShadowBanned (player )
201
+ && (plugin .getBanType () == BanType .LOOP
202
+ || (plugin .getBanType () == BanType .TENPERCENT && new Random ().nextInt (100 ) >= 10 ))) {
203
+ player .sendMessage (ChatMessageType .CHAT , ChatUtils .parseToComponent (Config .SHADOWBANMESSAGE ));
203
204
204
- if (StorageTool .isShadowBanned (player )
205
- && (plugin .getBanType () == BanType .LOOP
206
- || (plugin .getBanType () == BanType .TENPERCENT && new Random ().nextInt (100 ) >= 10 ))) {
207
- player .sendMessage (ChatMessageType .CHAT , ChatUtils .parseToComponent (Config .SHADOWBANMESSAGE ));
205
+ type .getQueueMap ().put (entry .getKey (), entry .getValue ());
208
206
209
- type .getQueueMap ().put (entry .getKey (), entry .getValue ());
207
+ return ;
208
+ }
210
209
211
- return ;
212
- }
210
+ indexPositionTime ();
213
211
214
- indexPositionTime ( );
212
+ List < Pair < Integer , Instant >> cache = type . getPositionCache (). get ( entry . getKey () );
215
213
216
- List <Pair <Integer , Instant >> cache = type .getPositionCache ().get (entry .getKey ());
214
+ if (cache != null ) {
215
+ cache .forEach (pair -> type .getDurationToPosition ().put (pair .getLeft (), Duration .between (pair .getRight (), Instant .now ())));
216
+ }
217
217
218
- if (cache != null ) {
219
- cache .forEach (pair -> type .getDurationToPosition ().put (pair .getLeft (), Duration .between (pair .getRight (), Instant .now ())));
218
+ player .connect (plugin .getProxy ().getServerInfo (entry .getValue ()), (result , error ) -> {
219
+ if (Config .RECOVERY && !Boolean .TRUE .equals (result )) {
220
+ player .sendMessage (ChatMessageType .CHAT , ChatUtils .parseToComponent (Config .RECOVERYMESSAGE ));
221
+ type .getQueueMap ().put (entry .getKey (), entry .getValue ());
222
+ }
223
+ });
220
224
}
221
-
222
- player .connect (plugin .getProxy ().getServerInfo (entry .getValue ()), (result , error ) -> {
223
- if (Config .RECOVERY && !Boolean .TRUE .equals (result )) {
224
- player .sendMessage (ChatMessageType .CHAT , ChatUtils .parseToComponent (Config .RECOVERYMESSAGE ));
225
- type .getQueueMap ().put (entry .getKey (), entry .getValue ());
226
- }
227
- });
228
225
}
229
226
230
227
private void putQueueAuthFirst (ProxiedPlayer player , List <String > header , List <String > footer , Map <UUID , String > queueMap ) {
0 commit comments