File tree Expand file tree Collapse file tree
src/main/java/net/onelitefeather/vulpes/api/model Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313import java .util .UUID ;
1414
1515@ Entity (name = "font_lore" )
16- public final class FontLoreEntity {
16+ public final class FontLoreEntity implements Comparable < FontLoreEntity > {
1717 @ Id
1818 @ GeneratedValue (strategy = GenerationType .UUID )
1919 @ VulpesGenerator
2020 private UUID id ;
21- private String line ;
21+ private String line ;
2222 @ ManyToOne
2323 @ JoinColumn (name = "font_id" , nullable = false )
24- private FontEntity font ;
24+ private FontEntity font ;
25+ private int orderIndex ;
2526
2627 public FontLoreEntity () {
2728 }
2829
2930 public FontLoreEntity (
3031 UUID id ,
3132 String line ,
32- FontEntity font
33+ FontEntity font ,
34+ int orderIndex
3335 ) {
3436 this .id = id ;
3537 this .line = line ;
3638 this .font = font ;
39+ this .orderIndex = orderIndex ;
3740 }
3841
3942 public void setId (UUID id ) {
@@ -60,6 +63,14 @@ public FontEntity getFont() {
6063 return font ;
6164 }
6265
66+ public void setOrderIndex (int orderIndex ) {
67+ this .orderIndex = orderIndex ;
68+ }
69+
70+ public int getOrderIndex () {
71+ return orderIndex ;
72+ }
73+
6374 @ Override
6475 public boolean equals (Object obj ) {
6576 if (obj == this ) return true ;
@@ -83,4 +94,8 @@ public String toString() {
8394 "font=" + font + ']' ;
8495 }
8596
97+ @ Override
98+ public int compareTo (FontLoreEntity o ) {
99+ return Integer .compare (this .orderIndex , o .orderIndex );
100+ }
86101}
Original file line number Diff line number Diff line change 1717 *
1818 */
1919@ Entity (name = "item_lore" )
20- public final class ItemLoreEntity {
20+ public final class ItemLoreEntity implements Comparable < ItemLoreEntity > {
2121 @ Id
2222 @ GeneratedValue (strategy = GenerationType .UUID )
2323 @ VulpesGenerator
@@ -26,6 +26,7 @@ public final class ItemLoreEntity {
2626 @ ManyToOne
2727 @ JoinColumn (name = "item_id" , nullable = false )
2828 private ItemEntity item ;
29+ private int orderIndex ;
2930
3031
3132 public ItemLoreEntity () {
@@ -38,11 +39,13 @@ public ItemLoreEntity() {
3839 public ItemLoreEntity (
3940 UUID id ,
4041 String text ,
41- ItemEntity item
42+ ItemEntity item ,
43+ int orderIndex
4244 ) {
4345 this .id = id ;
4446 this .text = text ;
4547 this .item = item ;
48+ this .orderIndex = orderIndex ;
4649 }
4750
4851 public void setId (UUID id ) {
@@ -69,6 +72,14 @@ public String getText() {
6972 return text ;
7073 }
7174
75+ public void setOrderIndex (int orderIndex ) {
76+ this .orderIndex = orderIndex ;
77+ }
78+
79+ public int getOrderIndex () {
80+ return orderIndex ;
81+ }
82+
7283 @ Override
7384 public boolean equals (Object obj ) {
7485 if (obj == this ) return true ;
@@ -92,4 +103,8 @@ public String toString() {
92103 "item=" + item + ']' ;
93104 }
94105
106+ @ Override
107+ public int compareTo (ItemLoreEntity o ) {
108+ return Integer .compare (this .orderIndex , o .orderIndex );
109+ }
95110}
You can’t perform that action at this time.
0 commit comments