Connections #10
@@ -13,13 +13,16 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
|||||||
import netwerkprog.game.client.game.characters.Hacker;
|
import netwerkprog.game.client.game.characters.Hacker;
|
||||||
import netwerkprog.game.client.game.characters.Team;
|
import netwerkprog.game.client.game.characters.Team;
|
||||||
import netwerkprog.game.client.game.characters.abilities.BodySwap;
|
import netwerkprog.game.client.game.characters.abilities.BodySwap;
|
||||||
|
import netwerkprog.game.client.game.connections.Client;
|
||||||
import netwerkprog.game.client.game.map.Map;
|
import netwerkprog.game.client.game.map.Map;
|
||||||
import netwerkprog.game.client.game.map.MapRenderer;
|
import netwerkprog.game.client.game.map.MapRenderer;
|
||||||
import netwerkprog.game.client.game.map.GameInputProcessor;
|
import netwerkprog.game.client.game.map.GameInputProcessor;
|
||||||
|
import netwerkprog.game.util.data.Data;
|
||||||
|
import netwerkprog.game.util.data.DataCallback;
|
||||||
import netwerkprog.game.util.game.GameCharacter;
|
import netwerkprog.game.util.game.GameCharacter;
|
||||||
import netwerkprog.game.util.graphics.FrameRate;
|
import netwerkprog.game.util.graphics.FrameRate;
|
||||||
|
|
||||||
public class MainGame extends ApplicationAdapter {
|
public class MainGame extends ApplicationAdapter implements DataCallback {
|
||||||
SpriteBatch batch;
|
SpriteBatch batch;
|
||||||
float screenWidth;
|
float screenWidth;
|
||||||
float screenHeight;
|
float screenHeight;
|
||||||
@@ -116,7 +119,7 @@ public class MainGame extends ApplicationAdapter {
|
|||||||
|
|
||||||
|
|
||||||
private void connectToServer() {
|
private void connectToServer() {
|
||||||
client = new Thread(new Client("localhost"));
|
client = new Thread(new Client("localhost", this));
|
||||||
try {
|
try {
|
||||||
client.start();
|
client.start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -197,4 +200,9 @@ public class MainGame extends ApplicationAdapter {
|
|||||||
public Team getTeam() {
|
public Team getTeam() {
|
||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataReceived(Data data) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package netwerkprog.game.client;
|
|
||||||
|
|
||||||
import netwerkprog.game.util.data.ParserCallback;
|
|
||||||
|
|
||||||
public class Parser {
|
|
||||||
private final ParserCallback callback;
|
|
||||||
|
|
||||||
public Parser(ParserCallback callback) {
|
|
||||||
this.callback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void parse(String data) {
|
|
||||||
callback.onDataReceived(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +1,26 @@
|
|||||||
package netwerkprog.game.client;
|
package netwerkprog.game.client.game.connections;
|
||||||
|
|
||||||
import netwerkprog.game.util.application.Controller;
|
import netwerkprog.game.util.application.Controller;
|
||||||
import netwerkprog.game.util.data.Data;
|
import netwerkprog.game.util.data.Data;
|
||||||
import netwerkprog.game.util.data.ParserCallback;
|
import netwerkprog.game.util.data.DataCallback;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.*;
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class Client extends Controller implements ParserCallback {
|
public class Client extends Controller {
|
||||||
private final int port;
|
private final int port;
|
||||||
private final String hostname;
|
private final String hostname;
|
||||||
private final Parser parser;
|
|
||||||
private boolean isConnected = true;
|
private boolean isConnected = true;
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
private Thread receiveThread;
|
private Thread receiveThread;
|
||||||
private DataOutputStream outputStream;
|
private DataCallback callback;
|
||||||
|
private ObjectOutputStream outputStream;
|
||||||
|
|
||||||
public Client(String hostname) {
|
public Client(String hostname, DataCallback callback) {
|
||||||
this.port = Data.port();
|
this.port = Data.port();
|
||||||
this.hostname = hostname;
|
this.hostname = hostname;
|
||||||
this.parser = new Parser(this);
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,8 +39,8 @@ public class Client extends Controller implements ParserCallback {
|
|||||||
System.out.println("[CLIENT] connecting to server on port " + this.port);
|
System.out.println("[CLIENT] connecting to server on port " + this.port);
|
||||||
try {
|
try {
|
||||||
this.socket = new Socket(this.hostname, this.port);
|
this.socket = new Socket(this.hostname, this.port);
|
||||||
DataInputStream in = new DataInputStream(socket.getInputStream());
|
ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
|
||||||
this.outputStream = new DataOutputStream(socket.getOutputStream());
|
this.outputStream = new ObjectOutputStream(socket.getOutputStream());
|
||||||
|
|
||||||
this.receiveThread = new Thread( () -> receive(in));
|
this.receiveThread = new Thread( () -> receive(in));
|
||||||
|
|
||||||
@@ -56,11 +54,11 @@ public class Client extends Controller implements ParserCallback {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a message to the server.
|
* Sends a message to the server.
|
||||||
* @param message The message to send.
|
* @param data The message to send.
|
||||||
*/
|
*/
|
||||||
public void send(String message) {
|
public void send(Data data) {
|
||||||
try {
|
try {
|
||||||
this.outputStream.writeUTF(message);
|
this.outputStream.writeObject(data);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -70,11 +68,14 @@ public class Client extends Controller implements ParserCallback {
|
|||||||
* Receives a message from the server.
|
* Receives a message from the server.
|
||||||
* @param in The inputStream
|
* @param in The inputStream
|
||||||
*/
|
*/
|
||||||
public void receive(DataInputStream in) {
|
public void receive(ObjectInputStream in) {
|
||||||
while (isConnected) {
|
while (isConnected) {
|
||||||
try {
|
try {
|
||||||
this.parser.parse(in.readUTF());
|
Object object = in.readObject();
|
||||||
} catch (IOException e) {
|
if (object instanceof Data) {
|
||||||
|
callback.onDataReceived((Data) object);
|
||||||
|
}
|
||||||
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ public class Client extends Controller implements ParserCallback {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
send("Disconnect");
|
//send("Disconnect");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
@@ -96,9 +97,4 @@ public class Client extends Controller implements ParserCallback {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDataReceived(String data) {
|
|
||||||
System.out.println(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package netwerkprog.game.server;
|
|
||||||
|
|
||||||
import netwerkprog.game.client.game.characters.DevTest1;
|
|
||||||
import netwerkprog.game.client.game.characters.DevTest2;
|
|
||||||
import netwerkprog.game.client.game.characters.DevTest3;
|
|
||||||
import netwerkprog.game.server.controllers.DataController;
|
|
||||||
import netwerkprog.game.util.data.ParserCallback;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
public class Parser {
|
|
||||||
private final ParserCallback callback;
|
|
||||||
private Scanner scanner;
|
|
||||||
|
|
||||||
private final DataController dataController;
|
|
||||||
|
|
||||||
public Parser(ParserCallback callback) {
|
|
||||||
this.callback = callback;
|
|
||||||
this.dataController = new DataController();
|
|
||||||
|
|
||||||
this.dataController.addAllCharacters(new DevTest1(), new DevTest2(), new DevTest3());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void parse(String request) {
|
|
||||||
String data = "";
|
|
||||||
this.scanner = new Scanner(request);
|
|
||||||
scanner.useDelimiter("~");
|
|
||||||
String type = scanner.next();
|
|
||||||
String name = scanner.next();
|
|
||||||
|
|
||||||
if (type.equals("character")) {
|
|
||||||
try {
|
|
||||||
data = dataController.getCharacter(name).toString();
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
data = ex.getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
callback.onDataReceived(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
package netwerkprog.game.server;
|
package netwerkprog.game.server;
|
||||||
|
|
||||||
|
import netwerkprog.game.server.controllers.DataController;
|
||||||
import netwerkprog.game.server.controllers.SessionController;
|
import netwerkprog.game.server.controllers.SessionController;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class Server {
|
public class Server {
|
||||||
private SessionController sessionController;
|
private SessionController sessionController;
|
||||||
|
private DataController dataController;
|
||||||
private Thread sessionThread;
|
private Thread sessionThread;
|
||||||
private HashMap<String, Thread> gameThreads;
|
private HashMap<String, Thread> gameThreads;
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
this.sessionController = new SessionController();
|
this.sessionController = new SessionController(this);
|
||||||
|
this.dataController = new DataController();
|
||||||
|
|
||||||
this.gameThreads = new HashMap<>();
|
this.gameThreads = new HashMap<>();
|
||||||
this.sessionThread = new Thread(sessionController);
|
this.sessionThread = new Thread(sessionController);
|
||||||
|
|||||||
@@ -1,28 +1,30 @@
|
|||||||
package netwerkprog.game.server;
|
package netwerkprog.game.server;
|
||||||
|
|
||||||
|
import netwerkprog.game.server.controllers.DataController;
|
||||||
import netwerkprog.game.server.controllers.SessionController;
|
import netwerkprog.game.server.controllers.SessionController;
|
||||||
import netwerkprog.game.util.data.ParserCallback;
|
import netwerkprog.game.util.data.Data;
|
||||||
|
import netwerkprog.game.util.data.DataCallback;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
public class ServerClient implements Runnable, ParserCallback {
|
public class ServerClient implements Runnable {
|
||||||
private DataInputStream in;
|
private ObjectInputStream in;
|
||||||
private DataOutputStream out;
|
private ObjectOutputStream out;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final SessionController server;
|
private final SessionController server;
|
||||||
private final Parser parser;
|
private final DataCallback callback;
|
||||||
private boolean isConnected;
|
private boolean isConnected;
|
||||||
|
|
||||||
public ServerClient(String name, Socket socket, SessionController server) {
|
public ServerClient(String name, Socket socket, SessionController server, DataController dataController) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.parser = new Parser(this);
|
this.callback = dataController;
|
||||||
try {
|
try {
|
||||||
this.in = new DataInputStream(socket.getInputStream());
|
this.in = new ObjectInputStream(socket.getInputStream());
|
||||||
this.out = new DataOutputStream(socket.getOutputStream());
|
this.out = new ObjectOutputStream(socket.getOutputStream());
|
||||||
this.isConnected = true;
|
this.isConnected = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
this.isConnected = false;
|
this.isConnected = false;
|
||||||
@@ -30,9 +32,9 @@ public class ServerClient implements Runnable, ParserCallback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUTF(String text) {
|
public void writeData(Data data) {
|
||||||
try {
|
try {
|
||||||
this.out.writeUTF(text);
|
this.out.writeObject(data);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -42,14 +44,14 @@ public class ServerClient implements Runnable, ParserCallback {
|
|||||||
public void run() {
|
public void run() {
|
||||||
while (this.isConnected) {
|
while (this.isConnected) {
|
||||||
try {
|
try {
|
||||||
String received = this.in.readUTF();
|
callback.onDataReceived((Data) this.in.readObject());
|
||||||
this.parser.parse(received);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("[SERVERCLIENT] caught exception - " + e.getMessage());
|
System.out.println("[SERVERCLIENT] caught exception - " + e.getMessage());
|
||||||
System.out.println("[SERVERCLIENT] terminating failing connection...");
|
System.out.println("[SERVERCLIENT] terminating failing connection...");
|
||||||
this.isConnected = false;
|
this.isConnected = false;
|
||||||
System.out.println("[SERVERCLIENT] done!");
|
System.out.println("[SERVERCLIENT] done!");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,9 +59,4 @@ public class ServerClient implements Runnable, ParserCallback {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDataReceived(String data) {
|
|
||||||
writeUTF(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package netwerkprog.game.server.controllers;
|
package netwerkprog.game.server.controllers;
|
||||||
|
|
||||||
|
import netwerkprog.game.util.data.CharacterData;
|
||||||
|
import netwerkprog.game.util.data.Data;
|
||||||
|
import netwerkprog.game.util.data.DataCallback;
|
||||||
import netwerkprog.game.util.game.GameCharacter;
|
import netwerkprog.game.util.game.GameCharacter;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class DataController {
|
public class DataController implements DataCallback {
|
||||||
private final HashSet<GameCharacter> gameCharacters;
|
private final HashSet<GameCharacter> gameCharacters;
|
||||||
|
|
||||||
public DataController() {
|
public DataController() {
|
||||||
@@ -44,4 +47,15 @@ public class DataController {
|
|||||||
}
|
}
|
||||||
throw new IllegalArgumentException("The character does not exist.");
|
throw new IllegalArgumentException("The character does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataReceived(Data data) {
|
||||||
|
switch (data.getType()) {
|
||||||
|
case "Character" :
|
||||||
|
if (data.getPayload() instanceof CharacterData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package netwerkprog.game.server.controllers;
|
package netwerkprog.game.server.controllers;
|
||||||
|
|
||||||
|
import netwerkprog.game.server.Server;
|
||||||
import netwerkprog.game.server.ServerClient;
|
import netwerkprog.game.server.ServerClient;
|
||||||
import netwerkprog.game.util.application.Controller;
|
import netwerkprog.game.util.application.Controller;
|
||||||
import netwerkprog.game.util.data.Data;
|
import netwerkprog.game.util.data.Data;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -17,12 +16,14 @@ import java.util.Set;
|
|||||||
* The sessionController manages any connections from new clients and assigns individual threads to said clients.
|
* The sessionController manages any connections from new clients and assigns individual threads to said clients.
|
||||||
*/
|
*/
|
||||||
public class SessionController extends Controller {
|
public class SessionController extends Controller {
|
||||||
|
private Server server;
|
||||||
private ServerSocket serverSocket;
|
private ServerSocket serverSocket;
|
||||||
private final ArrayList<ServerClient> clients = new ArrayList<>();
|
private final ArrayList<ServerClient> clients = new ArrayList<>();
|
||||||
private final HashMap<String, Thread> clientThreads = new HashMap<>();
|
private final HashMap<String, Thread> clientThreads = new HashMap<>();
|
||||||
private boolean listening;
|
private boolean listening;
|
||||||
|
|
||||||
public SessionController() {
|
public SessionController(Server server) {
|
||||||
|
this.server = server;
|
||||||
this.listening = true;
|
this.listening = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,46 +57,46 @@ public class SessionController extends Controller {
|
|||||||
* @param socket The socket used for the client connections.
|
* @param socket The socket used for the client connections.
|
||||||
*/
|
*/
|
||||||
public void registerClient(Socket socket) {
|
public void registerClient(Socket socket) {
|
||||||
try {
|
// try {
|
||||||
System.out.println("[SERVER] got new client on " + socket.getInetAddress().getHostAddress());
|
// System.out.println("[SERVER] got new client on " + socket.getInetAddress().getHostAddress());
|
||||||
ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
|
// ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
|
||||||
DataInputStream inputStream = new DataInputStream(socket.getInputStream());
|
// DataInputStream inputStream = new DataInputStream(socket.getInputStream());
|
||||||
|
//
|
||||||
outputStream.writeUTF("Enter username: ");
|
// outputStream.writeUTF("Enter username: ");
|
||||||
String username = inputStream.readUTF();
|
// String username = inputStream.readUTF();
|
||||||
|
//
|
||||||
System.out.println("[SERVER] got username " + username);
|
// System.out.println("[SERVER] got username " + username);
|
||||||
ServerClient serverClient = new ServerClient(username, socket, this);
|
// ServerClient serverClient = new ServerClient(username, socket, this);
|
||||||
|
//
|
||||||
Thread t = new Thread(serverClient);
|
// Thread t = new Thread(serverClient);
|
||||||
t.start();
|
// t.start();
|
||||||
|
//
|
||||||
this.clientThreads.put(username,t);
|
// this.clientThreads.put(username,t);
|
||||||
this.clients.add(serverClient);
|
// this.clients.add(serverClient);
|
||||||
} catch (IOException ex) {
|
// } catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
// ex.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a server message to all connected clients.
|
* Sends a server message to all connected clients.
|
||||||
* @param text message.
|
* @param data message.
|
||||||
*/
|
*/
|
||||||
public void serverMessage(String text) {
|
public void serverMessage(Data data) {
|
||||||
for (ServerClient serverClient : clients) {
|
for (ServerClient serverClient : clients) {
|
||||||
serverClient.writeUTF(text);
|
serverClient.writeData(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a message to a specific user.
|
* Sends a message to a specific user.
|
||||||
* @param name user.
|
* @param name user.
|
||||||
* @param text message.
|
* @param data message.
|
||||||
*/
|
*/
|
||||||
public void personalMessage(String name, String text) {
|
public void personalMessage(String name, Data data) {
|
||||||
for (ServerClient serverClient : clients) {
|
for (ServerClient serverClient : clients) {
|
||||||
if (serverClient.getName().equals(name)) {
|
if (serverClient.getName().equals(name)) {
|
||||||
serverClient.writeUTF(text);
|
serverClient.writeData(data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,7 +114,7 @@ public class SessionController extends Controller {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.clientThreads.remove(serverClient.getName());
|
this.clientThreads.remove(serverClient.getName());
|
||||||
this.serverMessage(serverClient.getName() + " left!");
|
//this.serverMessage(serverClient.getName() + " left!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
15
core/src/netwerkprog/game/util/data/CharacterData.java
Normal file
15
core/src/netwerkprog/game/util/data/CharacterData.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package netwerkprog.game.util.data;
|
||||||
|
|
||||||
|
import netwerkprog.game.util.game.GameCharacter;
|
||||||
|
|
||||||
|
public class CharacterData extends Data {
|
||||||
|
private final String name;
|
||||||
|
private final GameCharacter character;
|
||||||
|
|
||||||
|
public CharacterData(String name, GameCharacter character) {
|
||||||
|
super("Character");
|
||||||
|
super.setPayload(this);
|
||||||
|
this.name = name;
|
||||||
|
this.character = character;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,4 +4,27 @@ public class Data {
|
|||||||
public static int port() {
|
public static int port() {
|
||||||
return 8000;
|
return 8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String objectType;
|
||||||
|
private Data payload;
|
||||||
|
|
||||||
|
public Data(String type) {
|
||||||
|
this.objectType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjectType(String objectType) {
|
||||||
|
this.objectType = objectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPayload(Data payload) {
|
||||||
|
this.payload = payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return objectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Data getPayload() {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
core/src/netwerkprog/game/util/data/DataCallback.java
Normal file
5
core/src/netwerkprog/game/util/data/DataCallback.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package netwerkprog.game.util.data;
|
||||||
|
|
||||||
|
public interface DataCallback {
|
||||||
|
void onDataReceived(Data data);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user