changed computeIfAbsent back to if statement
This commit is contained in:
parent
bc27c35f1a
commit
378d872283
@ -156,22 +156,19 @@ class Tetris extends StatelessGame {
|
||||
p.getInventory().setItemStack(0, ItemStack.builder(Material.BIRCH_BUTTON).customName(Component.text("Controller")).build());
|
||||
p.setSprinting(false);
|
||||
|
||||
this.tetrisGames.computeIfAbsent(p, player -> {
|
||||
TetrisGame newTetrisGame = new TetrisGame(
|
||||
this,
|
||||
getSpawn().sub(6, 8, 15).add(this.tetrisGames.size()*30, 0, 0),
|
||||
Tetromino.Shape.J,
|
||||
this.nextTetrominoesCount,
|
||||
this.isFast,
|
||||
this.hasCombat,
|
||||
this.randomSeed
|
||||
);
|
||||
newTetrisGame.generate();
|
||||
List<TetrisGame> games = new ArrayList<>(this.tetrisGames.values());
|
||||
games.add(newTetrisGame);
|
||||
this.tetrisGames.values().forEach(tetrisGame -> tetrisGame.updateOtherTetrisGames(games));
|
||||
return newTetrisGame;
|
||||
});
|
||||
if(this.tetrisGames.get(p) == null) {
|
||||
this.tetrisGames.put(p, new TetrisGame(
|
||||
this,
|
||||
getSpawn().sub(6, 8, 15).add(this.tetrisGames.size()*30, 0, 0),
|
||||
Tetromino.Shape.J,
|
||||
this.nextTetrominoesCount,
|
||||
this.isFast,
|
||||
this.hasCombat,
|
||||
this.randomSeed
|
||||
));
|
||||
this.tetrisGames.get(p).generate();
|
||||
this.tetrisGames.values().forEach(tetrisGame -> tetrisGame.updateOtherTetrisGames(this.tetrisGames.values()));
|
||||
}
|
||||
|
||||
TetrisGame tetrisGame = this.tetrisGames.get(p);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user