Implement equals
and hashCode
methods for material specifiers
This commit is contained in:
@@ -33,4 +33,17 @@ public class BukkitMaterialSpecifier implements MaterialSpecifier {
|
|||||||
return Set.of(this.material);
|
return Set.of(this.material);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (!(other instanceof BukkitMaterialSpecifier bukkitMaterialSpecifier)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.material == bukkitMaterialSpecifier.material;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return material.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -32,4 +32,18 @@ public class BukkitTagSpecifier implements MaterialSpecifier {
|
|||||||
return this.tag.getValues();
|
return this.tag.getValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (!(other instanceof BukkitTagSpecifier bukkitMaterialSpecifier)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.tag == bukkitMaterialSpecifier.tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return tag.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user