Skip to content

Commit

Permalink
(fix): game tracker - make mapId optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakShearman committed Jan 5, 2024
1 parent a3bc80a commit 7be8f79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
api("dev.emortal.minestom:core:13871da")
api("dev.emortal.minestom:core:055a5d8")
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,20 @@ private void maxTimeUpdate(@NotNull Game game) {

@Override
public void onGameStart(@NotNull Game game) {
GameStartMessage message = GameStartMessage.newBuilder()
GameStartMessage.Builder messageBuilder = GameStartMessage.newBuilder()
.setCommonData(this.createCommonGameData(game))
.setMapId(game.getCreationInfo().mapId())
.setStartTime(ProtoTimestampConverter.now())
.addAllContent(this.packMessages(game.createGameStartExtraData()))
.build();
.addAllContent(this.packMessages(game.createGameStartExtraData()));

if (game.getCreationInfo().mapId() != null) {
messageBuilder.setMapId(game.getCreationInfo().mapId());
}

this.gameMaxTimeUpdateTasks.put(game, SCHEDULER.schedule(() -> {
this.maxTimeUpdate(game);
}, this.config.maxTrackingInterval(), TimeUnit.MILLISECONDS));

this.kafkaProducer.produceAndForget(message);
this.kafkaProducer.produceAndForget(messageBuilder.build());
}

@Override
Expand Down

0 comments on commit 7be8f79

Please sign in to comment.