-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemEntity.java
More file actions
343 lines (310 loc) · 8.95 KB
/
ItemEntity.java
File metadata and controls
343 lines (310 loc) · 8.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
package net.onelitefeather.vulpes.api.model;
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.UUID;
/**
* Represents an Item in the system. This class is used as an entity for persistence
* with JPA and Micronaut Data. It contains details related to an item such as name, description,
* material, enchantments, etc.
* <p>
* This class is mapped to the database table "items" and contains fields that are automatically
* persisted by the JPA and Micronaut Data layers.
* </p>
*/
@Entity(name = "items")
public class ItemEntity implements VulpesModel {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@VulpesGenerator
private UUID id;
private String uiName;
private String variableName;
private String comment;
private String displayName;
private String material;
private String groupName;
private int customModelData;
private int amount;
@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.
* <p>
* This constructor is required for the JPA provider to instantiate the entity.
* </p>
*/
public ItemEntity() {
// No-argument constructor for JPA
}
/**
* Constructs a new {@link ItemEntity} with the specified values.
*
* @param id the unique identifier of the item
* @param uiName the model name associated with the item
* @param variableName the name of the item
* @param comment a description of the item
* @param displayName the display name of the item
* @param material the material type associated with the item
* @param groupName the group to which the item belongs
* @param customModelData the custom model data for the item
* @param amount the amount of the item
* @param enchantments the enchantments applied to the item
* @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,
List<ItemEnchantmentEntity> enchantments,
List<ItemLoreEntity> lore,
List<ItemFlagEntity> flags
) {
this.id = id;
this.uiName = uiName;
this.variableName = variableName;
this.comment = comment;
this.displayName = displayName;
this.material = material;
this.groupName = groupName;
this.customModelData = customModelData;
this.amount = amount;
this.enchantments = enchantments;
this.lore = lore;
this.flags = flags;
}
// Getters and setters for each field
/**
* Returns the unique identifier of the item.
*
* @return the unique identifier of the item
*/
public UUID getId() {
return id;
}
/**
* Sets the unique identifier of the item.
*
* @param id the unique identifier to set
*/
public void setId(UUID id) {
this.id = id;
}
/**
* Sets the name representation for the ui
*
* @param uiName the name to set for the ui
*/
public void setUiName(String uiName) {
this.uiName = uiName;
}
/**
* Returns the name representation for the ui
*
* @return the given ui name
*/
public String getUiName() {
return uiName;
}
/**
* Sets the variable name for the notification
*
* @param variableName the variable name to set
*/
public void setVariableName(String variableName) {
this.variableName = variableName;
}
/**
* Returns the variable name for the notification
*
* @return the variable name of the notification
*/
public String getVariableName() {
return variableName;
}
/**
* Returns the comment of the notification
*
* @return the description
*/
public String getComment() {
return comment;
}
/**
* Sets the comment of the notification
*
* @param description the comment to set
*/
public void setComment(String description) {
this.comment = description;
}
/**
* Returns the display name of the item.
*
* @return the display name of the item
*/
public String getDisplayName() {
return displayName;
}
/**
* Sets the display name of the item.
*
* @param displayName the display name to set
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* Returns the material type associated with the item.
*
* @return the material type of the item
*/
public String getMaterial() {
return material;
}
/**
* Sets the material type associated with the item.
*
* @param material the material to set
*/
public void setMaterial(String material) {
this.material = material;
}
/**
* Returns the group to which the item belongs.
*
* @return the group of the item
*/
public String getGroupName() {
return groupName;
}
/**
* Sets the group to which the item belongs.
*
* @param group the group to set
*/
public void setGroupName(String group) {
this.groupName = group;
}
/**
* Returns the custom model data for the item.
*
* @return the custom model data of the item
*/
public int getCustomModelData() {
return customModelData;
}
/**
* Sets the custom model data for the item.
*
* @param customModelData the custom model data to set
*/
public void setCustomModelData(int customModelData) {
this.customModelData = customModelData;
}
/**
* Returns the amount of the item.
*
* @return the amount of the item
*/
public int getAmount() {
return amount;
}
/**
* Sets the amount of the item.
*
* @param amount the amount to set
*/
public void setAmount(int amount) {
this.amount = amount;
}
/**
* Returns the enchantments applied to the item.
*
* @return the enchantments of the item
*/
public List<ItemEnchantmentEntity> getEnchantments() {
return enchantments;
}
/**
* Sets the enchantments applied to the item.
*
* @param enchantments the enchantments to set
*/
public void setEnchantments(List<ItemEnchantmentEntity> enchantments) {
this.enchantments = enchantments;
}
/**
* Returns the lore associated with the item.
*
* @return the lore of the item
*/
public List<ItemLoreEntity> getLore() {
return lore;
}
/**
* Sets the lore associated with the item.
*
* @param lore the lore to set
*/
public void setLore(List<ItemLoreEntity> lore) {
this.lore = lore;
}
/**
* Returns the flags associated with the item.
*
* @return the flags of the item
*/
public List<ItemFlagEntity> getFlags() {
return flags;
}
/**
* Sets the flags associated with the item.
*
* @param flags the flags to set
*/
public void setFlags(List<ItemFlagEntity> flags) {
this.flags = flags;
}
/**
* Provides a string representation of the ItemModel.
*
* @return a string representation
*/
@Override
public String toString() {
return "ItemModel{" +
"id='" + id + '\'' +
", modelName='" + uiName + '\'' +
", name='" + variableName + '\'' +
", comment='" + comment + '\'' +
", displayName='" + displayName + '\'' +
", material='" + material + '\'' +
", group='" + groupName + '\'' +
", customModelData=" + customModelData +
", amount=" + amount +
", enchantments=" + enchantments +
", lore=" + lore +
", flags=" + flags +
'}';
}
}