File tree Expand file tree Collapse file tree
src/main/java/net/pistonmaster/pistonqueue/shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434import java .time .Instant ;
3535import java .util .*;
3636import java .util .concurrent .ThreadLocalRandom ;
37- import java .util .concurrent .atomic .AtomicInteger ;
3837
3938@ RequiredArgsConstructor
4039public abstract class QueueListenerShared {
@@ -296,17 +295,19 @@ private void connectPlayer(QueueType type) {
296295 }
297296 }
298297
298+ @ SuppressWarnings ("UnstableApiUsage" )
299299 private void sendXPSoundToQueueType (QueueType type ) {
300- @ SuppressWarnings ("UnstableApiUsage" )
301300 ByteArrayDataOutput out = ByteStreams .newDataOutput ();
302301 out .writeUTF ("xp" );
303302
304- AtomicInteger counter = new AtomicInteger ( 0 ) ;
305- type .getQueueMap ().forEach (( uuid , server ) -> {
306- if (counter . incrementAndGet () <= 5 ) {
307- out . writeUTF ( uuid . toString ()) ;
303+ int counter = 0 ;
304+ for ( UUID uuid : type .getQueueMap ().keySet ()) {
305+ if (++ counter > 5 ) {
306+ break ;
308307 }
309- });
308+
309+ out .writeUTF (uuid .toString ());
310+ }
310311
311312 plugin .getServer (Config .QUEUE_SERVER ).ifPresent (server ->
312313 server .sendPluginMessage ("piston:queue" , out .toByteArray ()));
You can’t perform that action at this time.
0 commit comments