11package net .onelitefeather .vulpes .api .model ;
22
3+ import jakarta .persistence .CascadeType ;
34import jakarta .persistence .ElementCollection ;
45import jakarta .persistence .Entity ;
56import jakarta .persistence .GeneratedValue ;
67import jakarta .persistence .GenerationType ;
78import jakarta .persistence .Id ;
9+ import jakarta .persistence .OneToMany ;
810import net .onelitefeather .vulpes .api .generator .VulpesGenerator ;
11+ import net .onelitefeather .vulpes .api .model .item .ItemEnchantmentEntity ;
12+ import net .onelitefeather .vulpes .api .model .item .ItemFlagEntity ;
13+ import net .onelitefeather .vulpes .api .model .item .ItemLoreEntity ;
914
1015import java .util .List ;
1116import java .util .Map ;
@@ -36,12 +41,12 @@ public class ItemEntity implements VulpesModel {
3641 private String groupName ;
3742 private int customModelData ;
3843 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 ;
44+ @ OneToMany ( cascade = CascadeType . ALL )
45+ private List < ItemEnchantmentEntity > enchantments ;
46+ @ OneToMany ( cascade = CascadeType . ALL )
47+ private List <ItemLoreEntity > lore ;
48+ @ OneToMany ( cascade = CascadeType . ALL )
49+ private List <ItemFlagEntity > flags ;
4550
4651 /**
4752 * Default constructor for JPA and Micronaut Data.
@@ -69,7 +74,20 @@ public ItemEntity() {
6974 * @param lore the lore associated with the item
7075 * @param flags the flags associated with the item
7176 */
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 ) {
77+ public ItemEntity (
78+ UUID id ,
79+ String uiName ,
80+ String variableName ,
81+ String comment ,
82+ String displayName ,
83+ String material ,
84+ String groupName ,
85+ int customModelData ,
86+ int amount ,
87+ List <ItemEnchantmentEntity > enchantments ,
88+ List <ItemLoreEntity > lore ,
89+ List <ItemFlagEntity > flags
90+ ) {
7391 this .id = id ;
7492 this .uiName = uiName ;
7593 this .variableName = variableName ;
@@ -158,7 +176,6 @@ public void setComment(String description) {
158176 this .comment = description ;
159177 }
160178
161-
162179 /**
163180 * Returns the display name of the item.
164181 *
@@ -254,7 +271,7 @@ public void setAmount(int amount) {
254271 *
255272 * @return the enchantments of the item
256273 */
257- public Map < String , Short > getEnchantments () {
274+ public List < ItemEnchantmentEntity > getEnchantments () {
258275 return enchantments ;
259276 }
260277
@@ -263,7 +280,7 @@ public Map<String, Short> getEnchantments() {
263280 *
264281 * @param enchantments the enchantments to set
265282 */
266- public void setEnchantments (Map < String , Short > enchantments ) {
283+ public void setEnchantments (List < ItemEnchantmentEntity > enchantments ) {
267284 this .enchantments = enchantments ;
268285 }
269286
@@ -272,7 +289,7 @@ public void setEnchantments(Map<String, Short> enchantments) {
272289 *
273290 * @return the lore of the item
274291 */
275- public List <String > getLore () {
292+ public List <ItemLoreEntity > getLore () {
276293 return lore ;
277294 }
278295
@@ -281,7 +298,7 @@ public List<String> getLore() {
281298 *
282299 * @param lore the lore to set
283300 */
284- public void setLore (List <String > lore ) {
301+ public void setLore (List <ItemLoreEntity > lore ) {
285302 this .lore = lore ;
286303 }
287304
@@ -290,7 +307,7 @@ public void setLore(List<String> lore) {
290307 *
291308 * @return the flags of the item
292309 */
293- public List <String > getFlags () {
310+ public List <ItemFlagEntity > getFlags () {
294311 return flags ;
295312 }
296313
@@ -299,7 +316,7 @@ public List<String> getFlags() {
299316 *
300317 * @param flags the flags to set
301318 */
302- public void setFlags (List <String > flags ) {
319+ public void setFlags (List <ItemFlagEntity > flags ) {
303320 this .flags = flags ;
304321 }
305322
0 commit comments