Also added their message types to MessageType. issue #35 #story[1095]main
parent
1385500e68
commit
f65ed79619
@ -1,4 +1,53 @@
|
|||||||
package network.Messages;
|
package network.Messages;
|
||||||
|
|
||||||
public class JoinAcceptance {
|
import network.Messages.Enums.JoinAcceptanceEnum;
|
||||||
|
import network.Messages.Enums.MessageType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the message a server sends to a client to tell them their boat sourceID, and if they have actually managed to join the server.
|
||||||
|
*/
|
||||||
|
public class JoinAcceptance extends AC35Data {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The source ID of the boat assigned to the client.
|
||||||
|
* 0 indicates they haven't been assigned a boat.
|
||||||
|
*/
|
||||||
|
private int sourceID = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of acceptance response this is.
|
||||||
|
*/
|
||||||
|
private JoinAcceptanceEnum acceptanceType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a JoinAcceptance message of a given acceptance type.
|
||||||
|
* @param acceptanceType The type of join acceptance this is.
|
||||||
|
*/
|
||||||
|
public JoinAcceptance(JoinAcceptanceEnum acceptanceType, int sourceID){
|
||||||
|
super(MessageType.JOIN_ACCEPTANCE);
|
||||||
|
this.acceptanceType = acceptanceType;
|
||||||
|
this.sourceID = sourceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of acceptance response this is.
|
||||||
|
* @return The type of acceptance response.
|
||||||
|
*/
|
||||||
|
public JoinAcceptanceEnum getAcceptanceType() {
|
||||||
|
return acceptanceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the source ID of the boat assigned to the client.
|
||||||
|
* @return The source ID of the boat assigned to the client.
|
||||||
|
*/
|
||||||
|
public int getSourceID() {
|
||||||
|
return sourceID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,36 @@
|
|||||||
package network.Messages;
|
package network.Messages;
|
||||||
|
|
||||||
|
|
||||||
|
import network.Messages.Enums.MessageType;
|
||||||
|
import network.Messages.Enums.RequestToJoinEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the message a client sends to a server to request to join/view a race.
|
* This is the message a client sends to a server to request to join/view a race.
|
||||||
*/
|
*/
|
||||||
public class RequestToJoin {
|
public class RequestToJoin extends AC35Data {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of join request this is.
|
||||||
|
*/
|
||||||
|
private RequestToJoinEnum requestType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a RequestToJoin message of a given request type.
|
||||||
|
* @param requestType The type of join request this is.
|
||||||
|
*/
|
||||||
|
public RequestToJoin(RequestToJoinEnum requestType){
|
||||||
|
super(MessageType.REQUEST_TO_JOIN);
|
||||||
|
this.requestType = requestType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of join request this is.
|
||||||
|
* @return The type of join request.
|
||||||
|
*/
|
||||||
|
public RequestToJoinEnum getRequestType() {
|
||||||
|
return requestType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in new issue