11package net .onelitefeather .vulpes .api .model ;
22
3- import jakarta .persistence .ElementCollection ;
3+ import jakarta .persistence .CascadeType ;
44import jakarta .persistence .Entity ;
55import jakarta .persistence .GeneratedValue ;
66import jakarta .persistence .GenerationType ;
77import jakarta .persistence .Id ;
8+ import jakarta .persistence .OneToMany ;
89import net .onelitefeather .vulpes .api .generator .VulpesGenerator ;
10+ import net .onelitefeather .vulpes .api .model .item .ItemEnchantmentEntity ;
11+ import net .onelitefeather .vulpes .api .model .item .ItemFlagEntity ;
12+ import net .onelitefeather .vulpes .api .model .item .ItemLoreEntity ;
913
1014import java .util .List ;
11- import java .util .Map ;
1215import java .util .UUID ;
1316
1417/**
@@ -36,12 +39,12 @@ public class ItemEntity implements VulpesModel {
3639 private String groupName ;
3740 private int customModelData ;
3841 private int amount ;
39- @ ElementCollection
40- private Map < String , Short > enchantments ;
41- @ ElementCollection
42- private List <String > lore ;
43- @ ElementCollection
44- private List <String > flags ;
42+ @ OneToMany ( mappedBy = "item" , cascade = CascadeType . ALL )
43+ private List < ItemEnchantmentEntity > enchantments ;
44+ @ OneToMany ( mappedBy = "item" , cascade = CascadeType . ALL )
45+ private List <ItemLoreEntity > lore ;
46+ @ OneToMany ( mappedBy = "item" , cascade = CascadeType . ALL )
47+ private List <ItemFlagEntity > flags ;
4548
4649 /**
4750 * Default constructor for JPA and Micronaut Data.
@@ -69,7 +72,20 @@ public ItemEntity() {
6972 * @param lore the lore associated with the item
7073 * @param flags the flags associated with the item
7174 */
72- 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 ) {
75+ public ItemEntity (
76+ UUID id ,
77+ String uiName ,
78+ String variableName ,
79+ String comment ,
80+ String displayName ,
81+ String material ,
82+ String groupName ,
83+ int customModelData ,
84+ int amount ,
85+ List <ItemEnchantmentEntity > enchantments ,
86+ List <ItemLoreEntity > lore ,
87+ List <ItemFlagEntity > flags
88+ ) {
7389 this .id = id ;
7490 this .uiName = uiName ;
7591 this .variableName = variableName ;
@@ -158,7 +174,6 @@ public void setComment(String description) {
158174 this .comment = description ;
159175 }
160176
161-
162177 /**
163178 * Returns the display name of the item.
164179 *
@@ -254,7 +269,7 @@ public void setAmount(int amount) {
254269 *
255270 * @return the enchantments of the item
256271 */
257- public Map < String , Short > getEnchantments () {
272+ public List < ItemEnchantmentEntity > getEnchantments () {
258273 return enchantments ;
259274 }
260275
@@ -263,7 +278,7 @@ public Map<String, Short> getEnchantments() {
263278 *
264279 * @param enchantments the enchantments to set
265280 */
266- public void setEnchantments (Map < String , Short > enchantments ) {
281+ public void setEnchantments (List < ItemEnchantmentEntity > enchantments ) {
267282 this .enchantments = enchantments ;
268283 }
269284
@@ -272,7 +287,7 @@ public void setEnchantments(Map<String, Short> enchantments) {
272287 *
273288 * @return the lore of the item
274289 */
275- public List <String > getLore () {
290+ public List <ItemLoreEntity > getLore () {
276291 return lore ;
277292 }
278293
@@ -281,7 +296,7 @@ public List<String> getLore() {
281296 *
282297 * @param lore the lore to set
283298 */
284- public void setLore (List <String > lore ) {
299+ public void setLore (List <ItemLoreEntity > lore ) {
285300 this .lore = lore ;
286301 }
287302
@@ -290,7 +305,7 @@ public void setLore(List<String> lore) {
290305 *
291306 * @return the flags of the item
292307 */
293- public List <String > getFlags () {
308+ public List <ItemFlagEntity > getFlags () {
294309 return flags ;
295310 }
296311
@@ -299,7 +314,7 @@ public List<String> getFlags() {
299314 *
300315 * @param flags the flags to set
301316 */
302- public void setFlags (List <String > flags ) {
317+ public void setFlags (List <ItemFlagEntity > flags ) {
303318 this .flags = flags ;
304319 }
305320
0 commit comments