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
21 changes: 1 addition & 20 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,8 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 24
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build on ${{ matrix.os }}
run: ./gradlew clean build test
- name: Generate JaCoCo Coverage Report
if: matrix.os == 'ubuntu-latest'
run: ./gradlew jacocoRootReport
- name: Upload Coverage Report
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: jacoco-report
path: |
build/reports/jacoco/jacocoRootReport/html/
build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml
- name: Upload Coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v5
with:
file: build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
comment: true
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tasks {
}

test {
finalizedBy(rootProject.tasks.jacocoTestReport)
finalizedBy(jacocoTestReport)
testLogging {
events("passed", "skipped", "failed")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package net.onelitefeather.vulpes.api.model;

import jakarta.persistence.ElementCollection;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.font.FontLoreEntity;

import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -34,8 +36,8 @@ public class FontEntity implements VulpesModel {
private String comment;
private int height;
private int ascent;
@ElementCollection
private List<String> chars;
@OneToMany(mappedBy = "font", cascade = CascadeType.ALL)
private List<FontLoreEntity> chars;

/**
* Default constructor for JPA and Micronaut Data.
Expand All @@ -60,7 +62,17 @@ public FontEntity() {
* @param ascent the ascent of the font
* @param chars the list of characters included in the font
*/
public FontEntity(UUID id, String uiName, String variableName, String provider, String texturePath, String comment, int height, int ascent, List<String> chars) {
public FontEntity(
UUID id,
String uiName,
String variableName,
String provider,
String texturePath,
String comment,
int height,
int ascent,
List<FontLoreEntity> chars
) {
this.id = id;
this.uiName = uiName;
this.variableName = variableName;
Expand Down Expand Up @@ -181,7 +193,7 @@ public void setHeight(int height) {
*
* @return the list of characters in the font
*/
public List<String> getChars() {
public List<FontLoreEntity> getChars() {
return chars;
}

Expand All @@ -190,7 +202,7 @@ public List<String> getChars() {
*
* @param chars the list of characters to set
*/
public void setChars(List<String> chars) {
public void setChars(List<FontLoreEntity> chars) {
this.chars = chars;
}

Expand Down
47 changes: 31 additions & 16 deletions src/main/java/net/onelitefeather/vulpes/api/model/ItemEntity.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package net.onelitefeather.vulpes.api.model;

import jakarta.persistence.ElementCollection;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.item.ItemEnchantmentEntity;
import net.onelitefeather.vulpes.api.model.item.ItemFlagEntity;
import net.onelitefeather.vulpes.api.model.item.ItemLoreEntity;

import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
Expand Down Expand Up @@ -36,12 +39,12 @@ public class ItemEntity implements VulpesModel {
private String groupName;
private int customModelData;
private int amount;
@ElementCollection
private Map<String, Short> enchantments;
@ElementCollection
private List<String> lore;
@ElementCollection
private List<String> flags;
@OneToMany(mappedBy = "item", cascade = CascadeType.ALL)
private List<ItemEnchantmentEntity> enchantments;
@OneToMany(mappedBy = "item", cascade = CascadeType.ALL)
private List<ItemLoreEntity> lore;
@OneToMany(mappedBy = "item", cascade = CascadeType.ALL)
private List<ItemFlagEntity> flags;

/**
* Default constructor for JPA and Micronaut Data.
Expand Down Expand Up @@ -69,7 +72,20 @@ public ItemEntity() {
* @param lore the lore associated with the item
* @param flags the flags associated with the item
*/
public ItemEntity(UUID id, String uiName, String variableName, String comment, String displayName, String material, String groupName, int customModelData, int amount, Map<String, Short> enchantments, List<String> lore, List<String> flags) {
public ItemEntity(
UUID id,
String uiName,
String variableName,
String comment,
String displayName,
String material,
String groupName,
int customModelData,
int amount,
List<ItemEnchantmentEntity> enchantments,
List<ItemLoreEntity> lore,
List<ItemFlagEntity> flags
) {
this.id = id;
this.uiName = uiName;
this.variableName = variableName;
Expand Down Expand Up @@ -158,7 +174,6 @@ public void setComment(String description) {
this.comment = description;
}


/**
* Returns the display name of the item.
*
Expand Down Expand Up @@ -254,7 +269,7 @@ public void setAmount(int amount) {
*
* @return the enchantments of the item
*/
public Map<String, Short> getEnchantments() {
public List<ItemEnchantmentEntity> getEnchantments() {
return enchantments;
}

Expand All @@ -263,7 +278,7 @@ public Map<String, Short> getEnchantments() {
*
* @param enchantments the enchantments to set
*/
public void setEnchantments(Map<String, Short> enchantments) {
public void setEnchantments(List<ItemEnchantmentEntity> enchantments) {
this.enchantments = enchantments;
}

Expand All @@ -272,7 +287,7 @@ public void setEnchantments(Map<String, Short> enchantments) {
*
* @return the lore of the item
*/
public List<String> getLore() {
public List<ItemLoreEntity> getLore() {
return lore;
}

Expand All @@ -281,7 +296,7 @@ public List<String> getLore() {
*
* @param lore the lore to set
*/
public void setLore(List<String> lore) {
public void setLore(List<ItemLoreEntity> lore) {
this.lore = lore;
}

Expand All @@ -290,7 +305,7 @@ public void setLore(List<String> lore) {
*
* @return the flags of the item
*/
public List<String> getFlags() {
public List<ItemFlagEntity> getFlags() {
return flags;
}

Expand All @@ -299,7 +314,7 @@ public List<String> getFlags() {
*
* @param flags the flags to set
*/
public void setFlags(List<String> flags) {
public void setFlags(List<ItemFlagEntity> flags) {
this.flags = flags;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package net.onelitefeather.vulpes.api.model.font;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.FontEntity;

import java.util.Objects;
import java.util.UUID;

@Entity(name = "font_lore")
public final class FontLoreEntity implements Comparable<FontLoreEntity> {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@VulpesGenerator
private UUID id;
private String line;
@ManyToOne
@JoinColumn(name = "font_id", nullable = false)
private FontEntity font;
private int orderIndex;

public FontLoreEntity() {
}

public FontLoreEntity(
UUID id,
String line,
FontEntity font,
int orderIndex
) {
this.id = id;
this.line = line;
this.font = font;
this.orderIndex = orderIndex;
}

public void setId(UUID id) {
this.id = id;
}

public UUID getId() {
return id;
}

public void setLine(String line) {
this.line = line;
}

public String getLine() {
return line;
}

public void setFont(FontEntity font) {
this.font = font;
}

public FontEntity getFont() {
return font;
}

public void setOrderIndex(int orderIndex) {
this.orderIndex = orderIndex;
}

public int getOrderIndex() {
return orderIndex;
}

@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
var that = (FontLoreEntity) obj;
return Objects.equals(this.id, that.id) &&
Objects.equals(this.line, that.line) &&
Objects.equals(this.font, that.font);
}

@Override
public int hashCode() {
return Objects.hash(id, line, font);
}

@Override
public String toString() {
return "FontLoreEntity[" +
"id=" + id + ", " +
"line=" + line + ", " +
"font=" + font + ']';
}

@Override
public int compareTo(FontLoreEntity o) {
return Integer.compare(this.orderIndex, o.orderIndex);
}
}
Loading