SR-Game/src/main/java/me/unurled/sacredrealms/sr/utils/ChunkWrapper.java
unurled ced4c0d186
Some checks failed
Build / build (push) Failing after 1m19s
add of SR-Core and many more things
2024-09-06 09:29:26 +02:00

65 lines
1.2 KiB
Java

package me.unurled.sacredrealms.sr.utils;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.jetbrains.annotations.NotNull;
public class ChunkWrapper {
private int x;
private int z;
private World world;
public ChunkWrapper(@NotNull Chunk chunk) {
this.x = chunk.getX();
this.z = chunk.getZ();
this.world = chunk.getWorld();
}
@Override
public int hashCode() {
int hash = 17;
hash = hash * 31 + x;
hash = hash * 31 + z;
hash = hash * 31 + world.hashCode();
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!(obj instanceof ChunkWrapper)) return false;
return ((ChunkWrapper) obj).x == this.x
&& ((ChunkWrapper) obj).z == this.z
&& ((ChunkWrapper) obj).world.equals(this.world);
}
@Override
public String toString() {
return "(" + x + ", " + z + ") [" + world + "]";
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
public World getWorld() {
return world;
}
public void setWorld(World world) {
this.world = world;
}
}