Skip to content

Commit df2a0df

Browse files
committed
Fixed the firstStart message to actually work
Moved the first start configuration check and operator notification logic from the loop start handler to the player join event. This ensures the messaging is triggered appropriately when a new operator joins the server.
1 parent c22b27a commit df2a0df

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

src/main/java/com/vltno/timeloop/TimeLoop.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,6 @@ public void onInitialize() {
120120
executeCommand(String.format("mocap playback start .%s", sceneName));
121121
startLoop();
122122
}
123-
if (config.firstStart) {
124-
config.firstStart = false;
125-
config.save();
126-
127-
// Send message to all ops
128-
for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) {
129-
LOOP_LOGGER.info("GRRRRRRRRRRRRRRRRRRRRRRRRRRR");
130-
if (server.getPlayerManager().isOperator(player.getGameProfile())) {
131-
player.sendMessage(Text.literal(("Use '/loop start' to start the Time loop!")));
132-
}
133-
}
134-
}
135123
});
136124

137125
ServerLifecycleEvents.SERVER_STOPPING.register(server -> {
@@ -145,6 +133,17 @@ public void onInitialize() {
145133
ServerPlayerEntity player = handler.getPlayer();
146134
String playerName = player.getName().getString();
147135

136+
if (config.firstStart) {
137+
config.firstStart = false;
138+
config.save();
139+
140+
LOOP_LOGGER.info("First start detected, sending message to ops.");
141+
142+
if (server.getPlayerManager().isOperator(player.getGameProfile())) {
143+
player.sendMessage(Text.literal(("Use '/loop start' to start the time loop!")));
144+
}
145+
}
146+
148147
recordingPlayers.add(playerName); // Add to recording list
149148
loopBossBar.addPlayer(player);
150149
if (isLooping) {

0 commit comments

Comments
 (0)