Updates NTtBCommands, that defines the NTtB Protocol, to include which commands mean what. Added Ping/pong classes where Pinging and Ping-Handling could be implemented. Tried to define useful interfaces. Added Some Command Classes, unsure if they will be needed.

This commit is contained in:
Sebastian Lenzlinger 2022-03-24 12:53:30 +01:00
parent 3e9888e662
commit 532159d466
12 changed files with 83 additions and 6 deletions

View File

@ -1,5 +1,19 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.Protocol;
public enum NTtBCommands {
CRTGM, CHATL, CHATG, CHATP, LEAVG, JOING, VOTEE,
/**
* CRTGM: Create a new game
* CHATA: chat to all
* CHATW: whisper chat
* CHATG: ghost chat
* LEAVG: leave a game
* JOING: join a game
* VOTEG: ghost voting who to infect
* VOTEH: humans voting whos the ghost
* QUITS: quit server/ leave servr
* LISTP: list players/clients in session with the Server
*/
CRTGM, CHATA, CHATW, CHATG, LEAVG, JOING, VOTEG, QUITS, LISTP
}

View File

@ -0,0 +1,5 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.Protocol;
public interface ProtocolDecoder {
}

View File

@ -4,5 +4,5 @@ import ch.unibas.dmi.dbis.cs108.Multiplayer.Protocol.NTtBFormatMsg;
public interface ProtocolParser {
public NTtBFormatMsg parseMsg(String msg);
ProtocolMessage parseMsg(String msg);
}

View File

@ -0,0 +1,4 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.Protocol.methods;
public class Chat {
}

View File

@ -0,0 +1,4 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.Protocol.methods;
public class NewGame {
}

View File

@ -0,0 +1,4 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.Protocol.methods;
public class QUITS {
}

View File

@ -0,0 +1,4 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.Protocol.methods;
public class VOTEG {
}

View File

@ -1,4 +0,0 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.Server;
public class Chat {
}

View File

@ -0,0 +1,8 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.helpers;
public class PingListener implements Runnable {
@Override
public void run() {
}
}

View File

@ -0,0 +1,24 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.helpers;
/**
* PingPong offers services to for listening and sending
* Pings to a communication partner.
* Runs on a Thread as not to disturb other communication channels.(Is this necessary?)
*/
public class PingPong implements PingPongInterface {
@Override
public void pingListener(String ping) {
}
@Override
public String pongSender() {
return null;
}
@Override
public void run() {
}
//TODO: Impl
}

View File

@ -0,0 +1,6 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.helpers;
public interface PingPongInterface extends Runnable{
void pingListener(String ping);
String pongSender();
}

View File

@ -0,0 +1,8 @@
package ch.unibas.dmi.dbis.cs108.Multiplayer.helpers;
public class PongSender implements Runnable{
@Override
public void run() {
}
}