Override hashCode method in AbstractRegion

This commit fixes the PlotSquared issue where running a PlotSquared command could result in intense lag on the main thread. This was mainly seen with running the /p info command on an extremely large plot.

Since #world can be null, the uniqueness of this hashCode is not the best, but since it's essentially just a collection of BlockVector3's, I don't believe this change will break anything. If it does, please let me know! Feedback on the uniqueness of this is welcomed.
Dieser Commit ist enthalten in:
IronApollo 2020-04-29 14:17:05 -04:00
Ursprung 058990f6fe
Commit 8247f78e9d

Datei anzeigen

@ -212,4 +212,12 @@ public abstract class AbstractRegion extends AbstractSet<BlockVector3> implement
return chunks; return chunks;
} }
@Override
public int hashCode() {
int worldHash = this.world == null ? 7 : this.world.hashCode();
int result = worldHash ^ (worldHash >>> 32);
result = 31 * result + this.getMinimumPoint().hashCode();
result = 31 * result + this.getMaximumPoint().hashCode();
return result;
}
} }