small adjustments & comments to passenger & subclasses

This commit is contained in:
Jonas 2022-03-17 14:56:29 +01:00
parent f2c1cbc17c
commit 166dc5151b
3 changed files with 11 additions and 6 deletions

View File

@ -13,7 +13,7 @@ public class GhostNPC extends Ghost{
this.position = position; this.position = position;
this.sock = null; this.sock = null;
isGhost = true; isGhost = true;
isPlayerCharacter = false; isPlayer = false;
kickedOff = false; kickedOff = false;
if (name == null) { if (name == null) {
this.name = "Robot Nr. " + position; this.name = "Robot Nr. " + position;

View File

@ -16,10 +16,14 @@ public class GhostPlayer extends Ghost{
this.sock = sock; this.sock = sock;
this.isOG = isOG; this.isOG = isOG;
isGhost = true; isGhost = true;
isPlayerCharacter = true; isPlayer = true;
kickedOff = false; kickedOff = false;
if (name == null) { if (name == null) {
this.name = "Human Nr. " + position; this.name = "Human Nr. " + position;
} else this.name = name; } else this.name = name;
} }
public void send(String msg) {
//todo: pass message along to client.
}
} }

View File

@ -6,9 +6,10 @@ public class Passenger {
protected int position; //the player's Cabin number (1 to 6) protected int position; //the player's Cabin number (1 to 6)
protected String name; //the player's Name protected String name; //the player's Name
protected Boolean isGhost; //boolean regarding if the player is a ghost. Could probably be removed since ghost is a subclass but I'm keeping it in. protected Boolean isGhost; //boolean regarding if the player is a ghost. Could probably be removed since ghost is a subclass but I'm keeping it in.
protected Boolean isPlayerCharacter; //same here protected Boolean isPlayer; //same here
protected Boolean kickedOff; //true if the player has been voted off. protected Boolean kickedOff; //true if the player has been voted off.
protected Socket sock; //the socket for the client associated with this Passenger, for NPCs, this can be null. protected Socket sock; //the socket for the client associated with this Passenger, for NPCs, this can be null.
//todo: maybe this should be a thread or some class instead of a socket? depends on client-server structure...
/** /**
@ -16,7 +17,7 @@ public class Passenger {
* @param msg the message that is sent to this player. * @param msg the message that is sent to this player.
**/ **/
public void send(String msg) { public void send(String msg) {
//todo: send protocol message to the respective client //todo: send protocol message to the respective client OR process messages for NPCS
} }
/** /**
@ -51,7 +52,7 @@ public class Passenger {
return kickedOff; return kickedOff;
} }
public Boolean getPlayerCharacter() { public Boolean getIsPlayer() {
return isPlayerCharacter; return isPlayer;
} }
} }