Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ dependencies {
implementation(libs.minestom)
implementation(libs.aves)
implementation(libs.bundles.cloudnet)
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
// implementation("org.slf4j:slf4j-api:2.0.17")
implementation(libs.slf4j.api)
implementation(libs.xerus)

testImplementation(libs.minestom)
Expand Down
1 change: 1 addition & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {

dependencies {
implementation(platform(libs.aonyx.bom))
implementation(libs.slf4j.api)
compileOnly(libs.adventure)
compileOnly(libs.minestom)
compileOnly(libs.aves)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import net.theevilreaper.aves.map.BaseMap;
import net.theevilreaper.bounce.common.push.PushData;

import java.util.List;

/**
* The {@link GameMap} contains all relevant information about a map which is used in the context of the game.
* It holds data about the used positions and other things.
Expand All @@ -25,11 +27,10 @@ public final class GameMap extends BaseMap {
* @param gameSpawn the spawn position during the game
* @param pushData the {@link PushData} which includes information about push values
*/
public GameMap(String name, Pos spawn, Pos gameSpawn, PushData pushData, String... builders) {
public GameMap(String name, Pos spawn, Pos gameSpawn, PushData pushData, List<String> builders) {
super(name, spawn, builders);
this.gameSpawn = gameSpawn;
this.pushData = pushData;

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
import net.theevilreaper.bounce.common.push.PushData;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

class GameMapTest {

@Test
void testGameMap() {
GameMap gameMap = new GameMap("Test-Map", Pos.ZERO, new Pos(10, 0, 10), PushData.builder().build());
GameMap gameMap = new GameMap("Test-Map", Pos.ZERO, new Pos(10, 0, 10), PushData.builder().build(), List.of());
assertNotNull(gameMap);
assertInstanceOf(BaseMap.class, gameMap, "The GameMap should be rely on the BaseMap");
assertEquals("Test-Map", gameMap.getName());
assertEquals(Pos.ZERO, gameMap.getSpawn());
assertEquals("Test-Map", gameMap.name());
assertEquals(Pos.ZERO, gameMap.spawn());
assertEquals(new Pos(10, 0, 10), gameMap.getGameSpawn());
assertNotEquals(gameMap.getGameSpawn(), gameMap.getSpawn());
assertNotEquals(gameMap.getGameSpawn(), gameMap.spawn());
assertNotNull(gameMap.getPushData());
assertTrue(gameMap.getPushData().push().isEmpty());
}
Expand Down
4 changes: 3 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ dependencyResolutionManagement {
versionCatalogs {
create("libs") {
version("shadow", "9.4.2")
version("aonyx", "0.7.1")
version("aonyx", "0.7.3")
version("pvp", "2026.05.30-26.1.1")
version("cloudnet", "4.0.0-RC17-SNAPSHOT")
version("slf4j", "2.0.18")

library("aonyx.bom", "net.onelitefeather", "aonyx-bom").versionRef("aonyx")

library("slf4j.api", "org.slf4j", "slf4j-api").versionRef("slf4j")
library("pvp", "io.github.togar2", "MinestomPvP").versionRef("pvp")
library("minestom", "net.minestom", "minestom").withoutVersion()
library("adventure", "net.kyori", "adventure-text-minimessage").withoutVersion()
Expand Down
3 changes: 1 addition & 2 deletions setup/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ dependencies {
implementation(libs.pvp)
implementation(libs.minestom)
implementation(libs.aves)
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
implementation("org.slf4j:slf4j-simple:2.0.18")
implementation(libs.slf4j.api)
implementation(libs.xerus)
implementation(libs.guira)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void clearBuilders() {
*/
@Override
public @NotNull GameMap build() {
return new GameMap(this.name, this.spawn, this.gameSpawn, pushDataBuilder.build(), this.builders.toArray(String[]::new));
return new GameMap(this.name, this.spawn, this.gameSpawn, pushDataBuilder.build(), this.builders);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class SetupMapProvider extends AbstractMapProvider {

public SetupMapProvider(@NotNull FileHandler fileHandler, @NotNull Path path) {
super(fileHandler, MapFilters::filterMapsForSetup);
this.mapEntries = loadMapEntries(path.resolve("maps"));
this.loadMapEntries(path.resolve("maps"));

Optional<MapEntry> fetchedEntry = this.mapEntries.stream()
.filter(MapEntry::hasMapFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ void testGameMapBuilderInitialization() {
assertAll(
"Assert null values",
() -> assertNull(gameMapBuilder.getGameSpawn()),
() -> assertNull(gameMapBuilder.getName()),
() -> assertNull(gameMapBuilder.getSpawn())
);

Expand All @@ -52,16 +51,16 @@ void testGameMapBuilderInitializationWithExistingData() {

assertNotNull(gameMap, "GameMap should not be null after initialization");
assertEquals(new Pos(1, 2, 3), gameMap.getGameSpawn(), "Game spawn position should match");
assertEquals("Test Map", gameMap.getName(), "Game map name should match");
assertEquals(new Pos(4, 5, 6), gameMap.getSpawn(), "Spawn position should match");
assertEquals("Test Map", gameMap.name(), "Game map name should match");
assertEquals(new Pos(4, 5, 6), gameMap.spawn(), "Spawn position should match");
assertEquals(1, gameMap.getPushData().getPush(Block.STONE), "Push value for STONE should be 1");

GameMapBuilder anotherBuilder = new GameMapBuilder(gameMap);

assertNotNull(anotherBuilder, "GameMapBuilder should not be null after initialization with existing data");
assertEquals(gameMap.getGameSpawn(), anotherBuilder.getGameSpawn(), "Game spawn position should match");
assertEquals(gameMap.getName(), anotherBuilder.getName(), "Game map name should match");
assertEquals(gameMap.getSpawn(), anotherBuilder.getSpawn(), "Spawn position should match");
assertEquals(gameMap.name(), anotherBuilder.getName(), "Game map name should match");
assertEquals(gameMap.spawn(), anotherBuilder.getSpawn(), "Spawn position should match");

PushData.Builder anotherPushDataBuilder = anotherBuilder.getPushDataBuilder();
assertNotNull(anotherPushDataBuilder, "PushDataBuilder should not be null after initialization with existing data");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class BounceMapProvider extends AbstractMapProvider {

public BounceMapProvider(@NotNull Path path) {
super(new GsonFileHandler(GsonUtil.GSON), MapFilters::filterMapsForGame);
this.mapEntries = this.loadMapEntries(path.resolve("maps"));
this.loadMapEntries(path.resolve("maps"));
this.activeInstance = MinecraftServer.getInstanceManager().createInstanceContainer();

MapEntry mapEntry = this.getEntries().getFirst();
Expand Down Expand Up @@ -48,7 +48,7 @@ public void teleportToGameSpawn(@NotNull Player player) {
}

public String getMapName() {
return this.activeMap.getName();
return this.activeMap.name();
}

public @NotNull GameMap getActiveMap() {
Expand Down
Loading