Added REQUEST_RECEIVED and DECLINED to ConnnectionStateEnum.
#story[1095]
This commit is contained in:
@@ -19,8 +19,10 @@ import javax.xml.transform.TransformerException;
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -70,7 +72,7 @@ public class Event {
|
||||
*/
|
||||
public Event(boolean singlePlayer) throws EventConstructionException {
|
||||
|
||||
singlePlayer = false;
|
||||
singlePlayer = false;//TEMP
|
||||
|
||||
String raceXMLFile = "mock/mockXML/raceTest.xml";
|
||||
String boatsXMLFile = "mock/mockXML/boatTest.xml";
|
||||
@@ -154,14 +156,6 @@ public class Event {
|
||||
|
||||
|
||||
|
||||
public String getAddress() throws UnknownHostException {
|
||||
return connectionAcceptor.getAddress();
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return connectionAcceptor.getServerPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the initial race data and then begins race simulation.
|
||||
*/
|
||||
@@ -190,7 +184,7 @@ public class Event {
|
||||
private String getRaceXMLAtCurrentTime(String raceXML) {
|
||||
|
||||
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + (1 * 60 * 1000);
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + Duration.ofMinutes(1).toMillis();
|
||||
long secondsToAdd = millisecondsToAdd / 1000;
|
||||
//Scale the time using our time scalar.
|
||||
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
|
||||
|
||||
@@ -16,14 +16,25 @@ public enum ConnectionStateEnum {
|
||||
WAITING_FOR_HANDSHAKE(1),
|
||||
|
||||
/**
|
||||
* The client has completed the handshake, and is connected.
|
||||
* The server has receved a {@link network.Messages.RequestToJoin} from the client.
|
||||
*/
|
||||
CONNECTED(2),
|
||||
REQUEST_RECEIVED(2),
|
||||
|
||||
/**
|
||||
* The client has completed the handshake, and is connected.
|
||||
* That is, the client sent a {@link network.Messages.RequestToJoin}, which was successful, and the server responded with a {@link network.Messages.JoinAcceptance}.
|
||||
*/
|
||||
CONNECTED(3),
|
||||
|
||||
/**
|
||||
* The client has timed out.
|
||||
*/
|
||||
TIMED_OUT(3);
|
||||
TIMED_OUT(4),
|
||||
|
||||
/**
|
||||
* The client's connection has been declined.
|
||||
*/
|
||||
DECLINED(5);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user