This commit is contained in:
Johannes Schmelz
2024-12-06 16:21:12 +01:00
parent b50b5e64d1
commit aca92cd7f1
31 changed files with 21 additions and 361 deletions

View File

@@ -246,7 +246,7 @@ public class Player implements FieldVisitor<Void>{
*/
public void sellProperty(PropertyField property) {
if (property.getOwner() == this) {
properties.remove(property);
properties.remove(property.getId());
property.setOwner(null);
}
}

View File

@@ -4,9 +4,7 @@ import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import pp.monopoly.MonopolyConfig;
@@ -212,7 +210,6 @@ public class ServerGameLogic implements ClientInterpreter {
String truc = name.length() > 10 ? name.substring(0, 15) : name;
player.setName(truc);
player.setFigure(new Figure(1, -10, -10, Rotation.LEFT, msg.getFigure()));
//TODO add figure to the map
playerHandler.setPlayerReady(player, true);
LOGGER.log(Level.DEBUG, "Player {0} is ready", player.getName());
}
@@ -427,15 +424,14 @@ public class ServerGameLogic implements ClientInterpreter {
@Override
public void received(NotificationAnswer msg, int from) {
if(msg.getA().equals("UseJailCard")) {
if(msg.getKeyword().equals("UseJailCard")) {
playerHandler.getPlayerById(from).useJailCard();
} else if (msg.getA().equals("PayJail")) {
} else if (msg.getKeyword().equals("PayJail")) {
playerHandler.getPlayerById(from).payBail();
} else if(msg.getA().equals("hack")) {
// for (BuildingProperty bp : boardManager.getPropertyFields( List.of(1,3)).stream().filter(p -> p instanceof BuildingProperty).map(p -> (BuildingProperty) p).collect(Collectors.toList())) {
// bp.setOwner(playerHandler.getPlayerById(0));
// playerHandler.getPlayerById(0).addProperty(bp.getId());
// }
} else if(msg.getKeyword().equals("hack")) {
for (BuildingProperty bp : boardManager.getPropertyFields( List.of(1,3)).stream().filter(p -> p instanceof BuildingProperty).map(p -> (BuildingProperty) p).collect(Collectors.toList())) {
bp.build();
}
for(PropertyField field : boardManager.getBoard().stream().filter(p -> p instanceof PropertyField).map(p -> (PropertyField) p).collect(Collectors.toList())) {
field.setOwner(playerHandler.getPlayerById(0));
playerHandler.getPlayerById(0).addProperty(field.getId());

View File

@@ -5,16 +5,16 @@ import com.jme3.network.serializing.Serializable;
@Serializable
public class NotificationAnswer extends ClientMessage{
private String A;
private String keyword;
private NotificationAnswer() {}
public NotificationAnswer(String A) {
this.A = A;
public NotificationAnswer(String keyword) {
this.keyword = keyword;
}
public String getA() {
return A;
public String getKeyword() {
return keyword;
}
@Override

View File

@@ -11,11 +11,4 @@ public class BuyPropertyRequest extends ServerMessage{
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -32,12 +32,6 @@ public class DiceResult extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
public boolean isDoublets() {
return a == b;
}

View File

@@ -20,12 +20,6 @@ public class EventDrawCard extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
public String getCardDescription() {
return cardDescription;
}

View File

@@ -24,10 +24,4 @@ public class GameOver extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -27,10 +27,4 @@ public class GameStart extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -25,10 +25,4 @@ public class JailEvent extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -15,10 +15,5 @@ public class NextPlayerTurn extends ServerMessage{
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -41,10 +41,4 @@ public class NotificationMessage extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -27,10 +27,4 @@ public class PlayerStatusUpdate extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -28,12 +28,4 @@ public abstract class ServerMessage extends AbstractMessage {
* @param interpreter the visitor to be used for processing
*/
public abstract void accept(ServerInterpreter interpreter);
/**
* Gets the bundle key of the informational text to be shown at the client.
* This key is used to retrieve the appropriate localized text for display.
*
* @return the bundle key of the informational text
*/
public abstract String getInfoTextKey();
}

View File

@@ -25,10 +25,4 @@ public class TimeOutWarning extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -38,10 +38,4 @@ public class TradeReply extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -34,10 +34,4 @@ public class TradeRequest extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
}

View File

@@ -32,13 +32,8 @@ public class ViewAssetsResponse extends ServerMessage{
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
public BoardManager getboard() {
return board;
}
}

View File

@@ -7,11 +7,11 @@
package pp.monopoly.model;
import java.io.Serializable;
/**
* Represents the rotation of a Item and provides functionality related to rotation.
*/
import java.io.Serializable;
public enum Rotation implements Serializable {
/**
* Represents the item facing upwards.