This commit is contained in:
Johannes Schmelz 2024-11-26 21:31:21 +01:00
parent 89587a4c78
commit 156e76fe0a
9 changed files with 12 additions and 30 deletions

View File

@ -205,7 +205,6 @@ public class ChoosePartner extends Dialog {
public void update(float tpf) {
if (selectionRef.update()) {
String selected = selectionRef.get().toString();
System.out.println(selected);
listener.onSelectionChanged(selected);
}
}
@ -235,7 +234,6 @@ public class ChoosePartner extends Dialog {
* Callback for when the dropdown selection changes.
*/
private void onDropdownSelectionChanged(String selected) {
System.out.println("Selected: " + selected);
app.getGameLogic().playSound(Sound.BUTTON);
int idStart = selected.indexOf("(ID: ") + 5; // Find start of the ID
int idEnd = selected.indexOf(")", idStart); // Find end of the ID
@ -247,9 +245,6 @@ public class ChoosePartner extends Dialog {
if (selectedPlayer != null) {
tradeHandler.setReceiver(selectedPlayer); // Set the receiver in TradeHandler
System.out.println("Receiver set to: " + selectedPlayer.getName() + " (ID: " + selectedPlayer.getId() + ")");
} else {
System.err.println("Player with ID " + playerId + " not found.");
}
}

View File

@ -241,7 +241,6 @@ public class LobbyMenu extends Dialog {
public void update(float tpf) {
if (selectionRef.update()) {
String selected = selectionRef.get().toString();
System.out.println(selected);
listener.onSelectionChanged(selected);
}
}
@ -270,7 +269,6 @@ public class LobbyMenu extends Dialog {
* Callback for when the dropdown selection changes.
*/
private void onDropdownSelectionChanged(String selected) {
System.out.println("Selected: " + selected);
app.getGameLogic().playSound(Sound.BUTTON);
switch (selected) {
case "[0]":

View File

@ -223,7 +223,6 @@ public class Toolbar extends Dialog implements GameEventListener{
}
}
overviewContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
System.out.println("pdate");
}
@ -236,7 +235,6 @@ public class Toolbar extends Dialog implements GameEventListener{
icon2.setIconSize(new Vector2f(100, 100));
imageLabel.setIcon(icon1);
imageLabel2.setIcon(icon2);
System.out.println("Dice images set");
}
private String diceToString(int i) {

View File

@ -146,7 +146,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
LOGGER.log(Level.ERROR, "trying to send {0} with sender==null", msg); //NON-NLS
} else {
clientSender.send(msg);
System.out.println("Message gesendet");
}
}
@ -216,7 +215,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override
public void received(DiceResult msg) {
playSound(Sound.DICE_ROLL);
System.out.println("Message kam an");
notifyListeners(new DiceRollEvent(msg.getRollResult().get(0), msg.getRollResult().get(1)));
}
@ -344,7 +342,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override
public void received(NextPlayerTurn msg) {
System.out.println("Du bsit am zug message empfangen");
setState(new ActiveState(this));
}
}

View File

@ -395,7 +395,6 @@ public class Player implements FieldVisitor<Void>{
* @return the result of a dice roll (1 to 6)
*/
private static int rollDice() {
System.out.println("Gewuerfelt");
return random.nextInt(6) + 1;
}
}

View File

@ -156,7 +156,6 @@ public class PlayerHandler {
public Player getPlayerById(int id) {
for (Player player : players) {
if (player.getId() == id) return player;
System.out.println(player.getId());
}
throw new NoSuchElementException("Player mit id "+id+" existiert nicht");
}

View File

@ -132,7 +132,6 @@ public class ServerGameLogic implements ClientInterpreter {
playerHandler.addPlayer(player);
LOGGER.log(Level.DEBUG, "Player added: {0}", player.getId());
System.out.println("Anzahl Spieler verbunden:"+ playerHandler.getPlayerCount());
return player;
}
@ -221,7 +220,6 @@ public class ServerGameLogic implements ClientInterpreter {
public void received(RollDice msg, int from) {
Player player = playerHandler.getPlayerById(from);
if (player != null) {
System.out.println("Ergebniss gesendet");
send(player, player.rollDice());
}
}

View File

@ -104,10 +104,10 @@ public class TradeHandler {
*/
public boolean initiateTrade() {
if (!validateTrade()) {
System.out.println("Trade offer is invalid.");
return false;
}
System.out.println("Trade initiated by " + sender.getName() + " to " + receiver.getName());
return true;
}
@ -138,14 +138,14 @@ public class TradeHandler {
transferJailCards(sender, receiver, offeredJailCards);
transferJailCards(receiver, sender, requestedJailCards);
System.out.println("Trade completed between " + sender.getName() + " and " + receiver.getName());
}
/**
* Rejects the trade.
*/
public void rejectTrade() {
System.out.println(receiver.getName() + " rejected the trade.");
}
/**
@ -156,13 +156,13 @@ public class TradeHandler {
private boolean validateTrade() {
// Validate sender's ability to offer money
if (sender.getAccountBalance() < offeredAmount) {
System.out.println("Sender does not have enough money to offer.");
return false;
}
// Validate receiver's ability to fulfill the requested amount
if (receiver.getAccountBalance() < requestedAmount) {
System.out.println("Receiver does not have enough money to fulfill the request.");
return false;
}
@ -170,7 +170,7 @@ public class TradeHandler {
if (offeredProperties != null) {
for (PropertyField property : offeredProperties) {
if (!sender.getProperties().contains(property)) {
System.out.println("Sender does not own property: " + property.getName());
return false;
}
}
@ -178,7 +178,7 @@ public class TradeHandler {
if (requestedProperties != null) {
for (PropertyField property : requestedProperties) {
if (!receiver.getProperties().contains(property)) {
System.out.println("Receiver does not own property: " + property.getName());
return false;
}
}
@ -186,11 +186,11 @@ public class TradeHandler {
// Validate jail cards
if (sender.getNumJailCard() < offeredJailCards) {
System.out.println("Sender does not have enough jail cards to offer.");
return false;
}
if (receiver.getNumJailCard() < requestedJailCards) {
System.out.println("Receiver does not have enough jail cards to fulfill the request.");
return false;
}
@ -208,7 +208,7 @@ public class TradeHandler {
from.sellProperty(property);
to.buyProperty(property);
property.setOwner(to);
System.out.println("Property " + property.getName() + " transferred from " + from.getName() + " to " + to.getName());
}
/**
@ -223,7 +223,7 @@ public class TradeHandler {
from.removeJailCard();
to.addJailCard();
}
System.out.println(numCards + " jail card(s) transferred from " + from.getName() + " to " + to.getName());
}
public void setOfferedAmount(int offeredAmount) {

View File

@ -147,7 +147,6 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
@Override
public void messageReceived(HostedConnection source, Message message) {
System.out.println("Message recieved");
LOGGER.log(Level.INFO, "message received from {0}: {1}", source.getId(), message); //NON-NLS
if (message instanceof ClientMessage clientMessage)
pendingMessages.add(new ReceivedMessage(clientMessage, source.getId()));
@ -157,7 +156,6 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
public void connectionAdded(Server server, HostedConnection hostedConnection) {
LOGGER.log(Level.INFO, "New connection established: {0}", hostedConnection); //NON-NLS
logic.addPlayer(hostedConnection.getId());
System.out.println("Spieler verbunden: ID = " + hostedConnection.getId());
}
@Override