Skip to content

Commit

Permalink
Fix compilation issues and minor changes to status listener
Browse files Browse the repository at this point in the history
  • Loading branch information
BomBardyGamer committed Jan 6, 2024
1 parent 7be8f79 commit e1a70a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import net.minestom.server.network.ConnectionManager;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ private void initProductionMode() {
@NotNull Game createGame(@NotNull GameCreationInfo creationInfo) {
Game game = this.config.gameCreator().createGame(creationInfo);
this.registerGame(game);
Thread.startVirtualThread(() -> {
for (GameStatusListener listener : this.statusListeners) {
listener.onGameAdded(game);
}
});
for (GameStatusListener listener : this.statusListeners) {
listener.onGameAdded(game);
}
return game;
}

Expand Down Expand Up @@ -108,11 +106,9 @@ private void cleanUpGame(@NotNull Game game) {

// We call this here to ensure all the game's players are disconnected and the game is unregistered, so the check for the
// player count will actually see the new player count after the players are disconnected.
Thread.startVirtualThread(() -> {
for (GameStatusListener listener : this.statusListeners) {
listener.onGameRemoved(game);
}
});
for (GameStatusListener listener : this.statusListeners) {
listener.onGameRemoved(game);
}
}

private void kickAllRemainingPlayers(@NotNull Game game) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void updateShouldAllocate(int gameCount) {
.setKey("should-allocate")
.setValue(String.valueOf(allocate))
.build();
this.sdk.setLabel(keyValue, new IgnoredStreamObserver<>());
Thread.startVirtualThread(() -> this.sdk.setLabel(keyValue, new IgnoredStreamObserver<>()));
}

private void updateReadyIfEmpty(int gameCount) {
Expand All @@ -66,6 +66,6 @@ private void updateReadyIfEmpty(int gameCount) {
}

LOGGER.info("Marking server as ready as no players are online.");
this.sdk.ready(AgonesSDKProto.Empty.getDefaultInstance(), new IgnoredStreamObserver<>());
Thread.startVirtualThread(() -> this.sdk.ready(AgonesSDKProto.Empty.getDefaultInstance(), new IgnoredStreamObserver<>()));
}
}

0 comments on commit e1a70a8

Please sign in to comment.