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.getInventory().setItemStack(0, ItemStack.builder(Material.BIRCH_BUTTON).customName(Component.text("Controller")).build());
|
||||||
p.setSprinting(false);
|
p.setSprinting(false);
|
||||||
|
|
||||||
this.tetrisGames.computeIfAbsent(p, player -> {
|
if(this.tetrisGames.get(p) == null) {
|
||||||
TetrisGame newTetrisGame = new TetrisGame(
|
this.tetrisGames.put(p, new TetrisGame(
|
||||||
this,
|
this,
|
||||||
getSpawn().sub(6, 8, 15).add(this.tetrisGames.size()*30, 0, 0),
|
getSpawn().sub(6, 8, 15).add(this.tetrisGames.size()*30, 0, 0),
|
||||||
Tetromino.Shape.J,
|
Tetromino.Shape.J,
|
||||||
this.nextTetrominoesCount,
|
this.nextTetrominoesCount,
|
||||||
this.isFast,
|
this.isFast,
|
||||||
this.hasCombat,
|
this.hasCombat,
|
||||||
this.randomSeed
|
this.randomSeed
|
||||||
);
|
));
|
||||||
newTetrisGame.generate();
|
this.tetrisGames.get(p).generate();
|
||||||
List<TetrisGame> games = new ArrayList<>(this.tetrisGames.values());
|
this.tetrisGames.values().forEach(tetrisGame -> tetrisGame.updateOtherTetrisGames(this.tetrisGames.values()));
|
||||||
games.add(newTetrisGame);
|
}
|
||||||
this.tetrisGames.values().forEach(tetrisGame -> tetrisGame.updateOtherTetrisGames(games));
|
|
||||||
return newTetrisGame;
|
|
||||||
});
|
|
||||||
|
|
||||||
TetrisGame tetrisGame = this.tetrisGames.get(p);
|
TetrisGame tetrisGame = this.tetrisGames.get(p);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user