mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
#equals and #hashCode for item stats!
This commit is contained in:
parent
674df6c4b6
commit
d2c65dc3e8
@ -14,10 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData> {
|
public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData> {
|
||||||
@NotNull
|
@NotNull
|
||||||
@ -239,8 +236,16 @@ public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object o) {
|
||||||
return obj instanceof ItemStat && ((ItemStat) obj).getId().equals(getId());
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
ItemStat<?, ?> itemStat = (ItemStat<?, ?>) o;
|
||||||
|
return id.equals(itemStat.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String translate(String path) {
|
public static String translate(String path) {
|
||||||
|
Loading…
Reference in New Issue
Block a user