- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameMessage.java
More file actions
Latest commit
73 lines (65 loc) · 1.57 KB
/
Copy pathGameMessage.java
File metadata and controls
73 lines (65 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
importjava.io.Serializable;
/**
* This class is used to model the message for a network game.
* @author Kenneth Wong
*
*/
publicclassGameMessageimplementsSerializable {
privatestaticfinallongserialVersionUID = -9138385504565085818L;
privateinttype;
privateintplayerID;
privateObjectdata;
/**
* Creates and returns an instance of the GameMessage class.
* @param type the type of this message
* @param playerID the playerID of this message
* @param data the data of this message
*/
publicGameMessage(inttype, intplayerID, Objectdata) {
this.type = type;
this.playerID = playerID;
this.data = data;
}
/**
* Returns the type of this message.
* @return the type of this message
*/
publicintgetType() {
returnthis.type;
}
/**
* Sets the type of this message.
* @param type the type of this message
*/
publicvoidsetType(inttype) {
this.type = type;
}
/**
* Returns the playerID of this message.
* @return the playerID of this message
*/
publicintgetPlayerID() {
returnthis.playerID;
}
/**
* Sets the playerID of this message.
* @param playerID the playerID of this message
*/
publicvoidsetPlayerID(intplayerID) {
this.playerID = playerID;
}
/**
* Returns the data of this message.
* @return the data of this message
*/
publicObjectgetData() {
returnthis.data;
}
/**
* Sets the data of this message.
* @param data the data of this message
*/
publicvoidsetData(Objectdata) {
this.data = data;
}
}