Added some debug statements and registry settings to server.

This commit is contained in:
Andrew Lalis 2021-06-30 12:12:14 +02:00
parent 9c5cde199e
commit b0a289e35f
4 changed files with 49 additions and 0 deletions

View File

@ -127,6 +127,7 @@ public class ServerInfoServlet extends HttpServlet {
int rowCount = createStmt.executeUpdate();
createStmt.close();
if (rowCount != 1) throw new SQLException("Could not insert new server.");
System.out.println("Registered new server " + info.name() + " @ " + info.address());
} else {
PreparedStatement updateStmt = con.prepareStatement("""
UPDATE servers SET description = ?, location = ?, max_players = ?, current_players = ?
@ -141,6 +142,7 @@ public class ServerInfoServlet extends HttpServlet {
int rowCount = updateStmt.executeUpdate();
updateStmt.close();
if (rowCount != 1) throw new SQLException("Could not update server.");
System.out.println("Updated server information for " + info.name() + " @ " + info.address());
}
}
@ -156,5 +158,6 @@ public class ServerInfoServlet extends HttpServlet {
int rowCount = stmt.executeUpdate();
stmt.close();
if (rowCount != 1) throw new SQLException("Could not update server status.");
System.out.println("Updated server status for " + status.name() + " @ " + status.address());
}
}

View File

@ -0,0 +1,34 @@
package nl.andrewlalis.aos_server.settings;
public class RegistrySettings {
private boolean discoverable;
private String registryUri;
private String name;
private String address;
private String description;
private String location;
public boolean isDiscoverable() {
return discoverable;
}
public String getRegistryUri() {
return registryUri;
}
public String getName() {
return name;
}
public String getAddress() {
return address;
}
public String getDescription() {
return description;
}
public String getLocation() {
return location;
}
}

View File

@ -6,6 +6,8 @@ public class ServerSettings {
private int port;
private int maxPlayers;
private float ticksPerSecond;
private RegistrySettings registrySettings;
private PlayerSettings playerSettings;
private TeamSettings teamSettings;
private List<GunSettings> gunSettings;

View File

@ -2,6 +2,16 @@ port: 8035
max-players: 32
ticks-per-second: 120
# Information for the public server registry.
registry-data:
discoverable: true
registry-uri: "http://localhost:8567"
name: "Testing Server"
address: "localhost:8035"
description: "A simple testing server for development."
location: "Earth"
# Settings that control player behavior.
player-settings:
speed: 10