Skip to content

Commit

Permalink
Fix ip and port not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Jul 2, 2024
1 parent 859aaff commit 928e2b4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ public void start() {
}
}

/**
* Stop the bot
*/
public void stop() {
// If the bot is offline, don't try and stop it
if (status == Status.OFFLINE) {
return;
}

sessionManager.shutdown();
status = Status.OFFLINE;
}

/**
* Restart the bot
*/
public void restart() {
stop();
start();
}

/**
* Update the session info based on the selected server
*/
Expand Down Expand Up @@ -143,27 +164,6 @@ public void updateFriendStats() {
friendCount = sessionManager.socialSummary().targetFollowingCount();
}

/**
* Stop the bot
*/
public void stop() {
// If the bot is offline, don't try and stop it
if (status == Status.OFFLINE) {
return;
}

sessionManager.shutdown();
status = Status.OFFLINE;
}

/**
* Restart the bot
*/
public void restart() {
stop();
start();
}

/**
* Dump the session to the current storage manager
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public void updateSessionInfo() {
sessionInfo.setProtocol(pong.getProtocolVersion());
sessionInfo.setPlayers(pong.getPlayerCount());
sessionInfo.setMaxPlayers(pong.getMaximumPlayerCount());

// We only want to change this if the ping is successful so users can still join
sessionInfo.setIp(server.hostname());
sessionInfo.setPort(server.port());
} catch (InterruptedException | ExecutionException e) {
// TODO Log this to some backend log?
// TODO Make this not show unless its the first ping or happened a few times in a row
Expand Down

0 comments on commit 928e2b4

Please sign in to comment.