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
2 changes: 2 additions & 0 deletions src/main/java/io/github/moulberry/repo/NEUConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

@Getter
public class NEUConstants implements IReloadable {
Map<String, AbiphoneContact> abiphoneContacts;
Bonuses bonuses;
Parents parents;
Enchants enchants;
Expand All @@ -29,6 +30,7 @@ public class NEUConstants implements IReloadable {
ResourcePack resourcePack;

public void reload(NEURepository repository) throws NEURepositoryException {
abiphoneContacts = repository.requireFile("constants/abiphone.json").json(new TypeToken<Map<String, AbiphoneContact>>() {});
bonuses = repository.requireFile("constants/bonuses.json").json(Bonuses.class);
parents = new Parents(repository.requireFile("constants/parents.json")
.json(new TypeToken<Map<String, List<String>>>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.github.moulberry.repo.constants;

import java.util.List;

import org.checkerframework.checker.nullness.qual.Nullable;

import com.google.gson.annotations.SerializedName;

import lombok.Getter;

public class AbiphoneContact {
@Getter
@Nullable List<String> callNames;

@Getter
@SerializedName("requirement")
List<String> requirements;

@Getter
@Nullable String island;

@Getter
@Nullable Integer x;

@Getter
@Nullable Integer y;

@Getter
@Nullable Integer z;
}
10 changes: 10 additions & 0 deletions src/test/java/io/github/moulberry/repo/NEURepoParserTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package io.github.moulberry.repo;

import io.github.moulberry.repo.constants.AbiphoneContact;
import io.github.moulberry.repo.data.*;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.nio.file.Paths;
import java.util.Collections;
import java.util.Objects;
import java.util.stream.Collectors;

public class NEURepoParserTest {
Expand Down Expand Up @@ -114,4 +116,12 @@ void testUnknownRecipes() {
.collect(Collectors.toList())
);
}

@Test
void testAbiphoneContacts() {
AbiphoneContact elizabeth = repository.getConstants().getAbiphoneContacts().get("Elizabeth");

Assertions.assertTrue(Objects.requireNonNull(elizabeth.getCallNames()).contains("elizabeth"));
Assertions.assertEquals("hub", elizabeth.getIsland());
}
}
Loading