summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 17:47:15 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 17:47:15 +0000
commit366d310186ef7db141ddef52337d00effa42fff0 (patch)
treef4441c86bb934c8f7454bf3a10536ab9f0fbf686 /src
parent657f458ba7cdfdab45dbaebc8d711c56e3aba774 (diff)
downloadcraftbukkit-366d310186ef7db141ddef52337d00effa42fff0.tar
craftbukkit-366d310186ef7db141ddef52337d00effa42fff0.tar.gz
craftbukkit-366d310186ef7db141ddef52337d00effa42fff0.tar.lz
craftbukkit-366d310186ef7db141ddef52337d00effa42fff0.tar.xz
craftbukkit-366d310186ef7db141ddef52337d00effa42fff0.zip
Added .equals and .hashcode to CraftBlockState
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
index 29b0a72e..b342ea2c 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
@@ -1,4 +1,3 @@
-
package org.bukkit.craftbukkit.block;
import org.bukkit.Location;
@@ -206,4 +205,46 @@ public class CraftBlockState implements BlockState {
public void setData(byte data) {
createData(data);
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final CraftBlockState other = (CraftBlockState) obj;
+ if (this.world != other.world && (this.world == null || !this.world.equals(other.world))) {
+ return false;
+ }
+ if (this.x != other.x) {
+ return false;
+ }
+ if (this.y != other.y) {
+ return false;
+ }
+ if (this.z != other.z) {
+ return false;
+ }
+ if (this.type != other.type) {
+ return false;
+ }
+ if (this.data != other.data && (this.data == null || !this.data.equals(other.data))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 73 * hash + (this.world != null ? this.world.hashCode() : 0);
+ hash = 73 * hash + this.x;
+ hash = 73 * hash + this.y;
+ hash = 73 * hash + this.z;
+ hash = 73 * hash + this.type;
+ hash = 73 * hash + (this.data != null ? this.data.hashCode() : 0);
+ return hash;
+ }
}