Fix: public attribute are now private with getter/setter, useless synchronized removed
This commit is contained in:
@@ -95,11 +95,11 @@ public class ServerLauncher {
|
||||
synchronized (gameController) {
|
||||
Game game = gameController.getModel();
|
||||
miniModel = new MiniModel(
|
||||
game.getSlotMap(), game.orderLogicCard, game.getCurrentState(),
|
||||
game.getSlotMap(), game.getOrderLogicCard(), game.getCurrentState(),
|
||||
game.getPlayers(), game.getAvailableTotems(),
|
||||
game.getUpperListTribeCards(), game.getLowerListTribeCards(),
|
||||
game.getUpperListBuilding(), game.getLowerListBuilding(),
|
||||
game.disconnetedPlayers.entrySet().stream()
|
||||
game.disconnectedPlayers.entrySet().stream()
|
||||
.filter(Map.Entry::getValue)
|
||||
.map(e -> e.getKey().getUserName())
|
||||
.collect(Collectors.toCollection(ArrayList::new))
|
||||
@@ -127,16 +127,11 @@ public class ServerLauncher {
|
||||
* Runs the event-processing loop until the thread is interrupted.
|
||||
*
|
||||
* <p>A {@link ConcurrentModificationException} is caught and logged rather
|
||||
* than propagated; it is caused by an unsafe {@link ArrayList} in
|
||||
* {@code TCPServer.clientHandlers} (tracked as a separate issue) and does
|
||||
* not leave the game in an inconsistent state.
|
||||
*/
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
eventProcessor.doFirstEvent();
|
||||
} catch (ConcurrentModificationException e) {
|
||||
System.err.println("Concurrent modification in notifyAll — skipping tick");
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
break;
|
||||
@@ -167,7 +162,7 @@ public class ServerLauncher {
|
||||
Game game = saveManager.load();
|
||||
if (game == null) return;
|
||||
|
||||
long disconnectedCount = game.disconnetedPlayers.entrySet().stream()
|
||||
long disconnectedCount = game.disconnectedPlayers.entrySet().stream()
|
||||
.filter(Map.Entry::getValue).count();
|
||||
|
||||
if (disconnectedCount >= game.getNPlayers() - 1) {
|
||||
@@ -179,7 +174,7 @@ public class ServerLauncher {
|
||||
gameController.setModel(game);
|
||||
playerList.setLimit(game.getNPlayers());
|
||||
|
||||
for (Map.Entry<Player, Boolean> entry : game.disconnetedPlayers.entrySet()) {
|
||||
for (Map.Entry<Player, Boolean> entry : game.disconnectedPlayers.entrySet()) {
|
||||
if (entry.getValue()) {
|
||||
playerList.put(entry.getKey().getUserName(), false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user