-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameMessage.java
73 lines (65 loc) · 1.57 KB
/
GameMessage.java
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
import java.io.Serializable;
/**
* This class is used to model the message for a network game.
* @author Kenneth Wong
*
*/
public class GameMessage implements Serializable {
private static final long serialVersionUID = -9138385504565085818L;
private int type;
private int playerID;
private Object data;
/**
* 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
*/
public GameMessage(int type, int playerID, Object data) {
this.type = type;
this.playerID = playerID;
this.data = data;
}
/**
* Returns the type of this message.
* @return the type of this message
*/
public int getType() {
return this.type;
}
/**
* Sets the type of this message.
* @param type the type of this message
*/
public void setType(int type) {
this.type = type;
}
/**
* Returns the playerID of this message.
* @return the playerID of this message
*/
public int getPlayerID() {
return this.playerID;
}
/**
* Sets the playerID of this message.
* @param playerID the playerID of this message
*/
public void setPlayerID(int playerID) {
this.playerID = playerID;
}
/**
* Returns the data of this message.
* @return the data of this message
*/
public Object getData() {
return this.data;
}
/**
* Sets the data of this message.
* @param data the data of this message
*/
public void setData(Object data) {
this.data = data;
}
}