Skip to content

Commit 1da2472

Browse files
committed
feat: add unsafe boolean to the EnchantmentEntity
1 parent 8d8734b commit 1da2472

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

src/main/java/net/onelitefeather/vulpes/api/model/item/ItemEnchantmentEntity.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public final class ItemEnchantmentEntity {
2020
private UUID id;
2121
private String name;
2222
private short level;
23+
private boolean unsafe;
2324
@ManyToOne
2425
@JoinColumn(name = "item_id", nullable = false)
2526
private ItemEntity item;
@@ -34,18 +35,21 @@ public ItemEnchantmentEntity() {
3435
/**
3536
* Constructs a new {@link ItemEnchantmentEntity} with the specified values.
3637
*
37-
* @param id the unique identifier of the item enchantment
38-
* @param name the name of the enchantment
39-
* @param level the level of the enchantment
38+
* @param id the unique identifier of the item enchantment
39+
* @param name the name of the enchantment
40+
* @param level the level of the enchantment
41+
* @param unsafe whether the enchantment is unsafe
4042
*/
4143
public ItemEnchantmentEntity(
4244
UUID id,
4345
String name,
44-
short level
46+
short level,
47+
boolean unsafe
4548
) {
4649
this.id = id;
4750
this.name = name;
4851
this.level = level;
52+
this.unsafe = unsafe;
4953
}
5054

5155
/**
@@ -102,6 +106,24 @@ public void setLevel(short level) {
102106
this.level = level;
103107
}
104108

109+
/**
110+
* Returns whether the enchantment is unsafe.
111+
*
112+
* @return true if the enchantment is unsafe, false otherwise
113+
*/
114+
public boolean isUnsafe() {
115+
return unsafe;
116+
}
117+
118+
/**
119+
* Sets whether the enchantment is unsafe.
120+
*
121+
* @param unsafe whether the enchantment is unsafe
122+
*/
123+
public void setUnsafe(boolean unsafe) {
124+
this.unsafe = unsafe;
125+
}
126+
105127
/**
106128
* Returns the {@link ItemEntity} which is linked with this enchantment.
107129
*
@@ -128,12 +150,13 @@ public boolean equals(Object obj) {
128150
return Objects.equals(this.id, that.id) &&
129151
Objects.equals(this.name, that.name) &&
130152
this.level == that.level &&
153+
this.unsafe == that.unsafe &&
131154
Objects.equals(this.item, that.item);
132155
}
133156

134157
@Override
135158
public int hashCode() {
136-
return Objects.hash(id, name, level, item);
159+
return Objects.hash(id, name, level, unsafe, item);
137160
}
138161

139162
@Override
@@ -142,7 +165,7 @@ public String toString() {
142165
"id=" + id + ", " +
143166
"name=" + name + ", " +
144167
"level=" + level + ", " +
168+
"unsafe=" + unsafe + ", " +
145169
"item=" + item + ']';
146170
}
147-
148171
}

0 commit comments

Comments
 (0)