added pillars and block battle #10

Merged
jannis merged 7 commits from develop-pillars into develop 2026-02-02 19:09:44 +00:00
Collaborator
No description provided.
jannis added 2 commits 2026-02-01 13:22:34 +00:00
jannis added 1 commit 2026-02-01 16:37:43 +00:00
jannis added 1 commit 2026-02-01 17:24:41 +00:00
Pupsi reviewed 2026-02-01 21:09:47 +00:00
@@ -0,0 +49,4 @@
@Override
protected void onLoad(@NotNull CompletableFuture<Void> callback) {
this.generateWorld();
Collaborator

generateWorld wird nur hier aufgerufen, der code von generateWorld kann also direkt hier in onLoad, ohne extra Methode.

generateWorld wird nur hier aufgerufen, der code von generateWorld kann also direkt hier in onLoad, ohne extra Methode.
jannis marked this conversation as resolved
@@ -0,0 +126,4 @@
@Override
protected void onStart() {
this.setTeams();
this.getPlayers().forEach(player -> {
Collaborator

Kann als lambda expression geschrieben werden. Schlägt IntelliJ meistens schon vor.

Kann als lambda expression geschrieben werden. Schlägt IntelliJ meistens schon vor.
jannis marked this conversation as resolved
@@ -0,0 +148,4 @@
}
}
private void generateWorld() {
Collaborator

Kann direkt in onLoad rein.

Kann direkt in onLoad rein.
jannis marked this conversation as resolved
@@ -0,0 +156,4 @@
this.generatePlatform(new Pos(-5, 101, -14), Block.RED_STAINED_GLASS, Block.AIR);
this.generatePlatform(new Pos(5, 101, 14), Block.BLUE_STAINED_GLASS, Block.AIR);
this.setBlock(new Pos(2, 102, -9), Block.RED_STAINED_GLASS);
Collaborator

Lieber ein Array pro Block mit Positionen und dann alle durchgehen. So wird "Block.RED_STAINED_GLASS" nicht wiederholt.

Lieber ein Array pro Block mit Positionen und dann alle durchgehen. So wird "Block.RED_STAINED_GLASS" nicht wiederholt.
jannis marked this conversation as resolved
@@ -0,0 +164,4 @@
this.setBlock(new Pos(3, 102, -12), Block.RED_STAINED_GLASS);
this.setBlock(new Pos(5, 101, -15), Block.RED_STAINED_GLASS);
this.setBlock(new Pos(-5, 101, 15), Block.BLUE_STAINED_GLASS);
Collaborator

... hier das gleiche.

... hier das gleiche.
jannis marked this conversation as resolved
@@ -0,0 +170,4 @@
this.setBlock(new Pos(1, 103, 9), Block.BLUE_STAINED_GLASS);
this.setBlock(new Pos(2, 104, 6), Block.BLUE_STAINED_GLASS);
this.setBlock(new Pos(5, 103, 7), Block.BLUE_STAINED_GLASS);
this.setBlock(new Pos(7, 102, 10), Block.BLUE_STAINED_GLASS);
Collaborator

Anstatt immer this.setBlock aufzurufen kann man auch AbsoluteBlockBatch benutzen (siehe Tetris Playfield).
Ist aber nicht unbedingt notwendig.

Anstatt immer this.setBlock aufzurufen kann man auch AbsoluteBlockBatch benutzen (siehe Tetris Playfield). Ist aber nicht unbedingt notwendig.
jannis marked this conversation as resolved
@@ -0,0 +3,4 @@
import net.minestom.server.coordinate.Pos;
import net.minestom.server.item.Material;
public class Team {
Collaborator

Könnte ein record sein. IntelliJ schlägt das vermutlich schon vor.

Könnte ein record sein. IntelliJ schlägt das vermutlich schon vor.
jannis marked this conversation as resolved
@@ -0,0 +27,4 @@
private int spawnPosz = 0;
private final int pillarSpacing = 10;
private final int pillarRowCount = 5;
public Pillars() {
Collaborator

Leerzeile davor

Leerzeile davor
jannis marked this conversation as resolved
@@ -0,0 +71,4 @@
@Override
protected void onPlayerMove(@NotNull PlayerMoveEvent playerMoveEvent) {
if(this.isBeforeBeginning && Position.hasPositionChanged(playerMoveEvent.getPlayer().getPosition(), playerMoveEvent.getNewPosition()))
Collaborator

Eigene Variable für playerMoveEvent.getPlayer(), das wiederholt sich sonst.

Eigene Variable für playerMoveEvent.getPlayer(), das wiederholt sich sonst.
jannis marked this conversation as resolved
@@ -0,0 +90,4 @@
.filter(material -> !material.equals(Material.AIR))
.toList();
this.getPlayers().forEach(player -> {
ItemStack item = ItemStack.of(materials.get(new Random().nextInt(Material.values().toArray().length)));
Collaborator

new Random() als eigene Variable in Pillars, damit nicht immer ein neues Objekt erstellt wird.
Alternativ geht ThreadLocalRandom.current()

new Random() als eigene Variable in Pillars, damit nicht immer ein neues Objekt erstellt wird. Alternativ geht ThreadLocalRandom.current()
Owner

nimm ThreadLocalRandom.current()

nimm ThreadLocalRandom.current()
jannis marked this conversation as resolved
@@ -177,0 +181,4 @@
;;
ns:game_BlockBattle#;;
name;Block Battle;Block Kampf
description;The team that fills the center with their color first wins!;Das Team, welches als erstes die Mitte mit ihrer Farbe gefüllt hat, hat gewonnen!
Collaborator

Das Team, welches als erstes die Mitte mit seiner Farbe gefüllt hat, gewinnt!

Das Team, welches als erstes die Mitte mit seiner Farbe gefüllt hat, gewinnt!
jannis marked this conversation as resolved
jannis added 1 commit 2026-02-02 18:15:54 +00:00
jannis added 1 commit 2026-02-02 18:19:47 +00:00
Pupsi reviewed 2026-02-02 19:00:06 +00:00
@@ -0,0 +78,4 @@
playerMoveEvent.setCancelled(true);
if(playerMoveEvent.getNewPosition().y() < 80) {
this.getScore().insertResult(playerMoveEvent.getPlayer());
Collaborator

Hier kann auch player anstatt playerMoveEvent.getPlayer() hin.

Hier kann auch player anstatt playerMoveEvent.getPlayer() hin.
jannis marked this conversation as resolved
jannis added 1 commit 2026-02-02 19:05:01 +00:00
Pupsi scheduled this pull request to auto merge when all checks succeed 2026-02-02 19:07:15 +00:00
Pupsi canceled auto merging this pull request when all checks succeed 2026-02-02 19:07:54 +00:00
Pupsi approved these changes 2026-02-02 19:09:03 +00:00
jannis merged commit 7186b4dbea into develop 2026-02-02 19:09:44 +00:00
Sign in to join this conversation.
No Reviewers
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MineNet/Minigames#10