mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-15 00:43:33 +00:00
Override #equals method in AbstractRegion.java
This is an attempt to fix CPU spikes which do not reduce and continue mounting until the server reaches ~300%-500% usage. This override should allow prompt equality checks for regions based on the world, the minimum point, the maximum point, and area covered by the region. Issues found regarding this change should be quickly reported so this can be reverted and replaced with another appropriate solution.
This commit is contained in:
parent
65afa79c17
commit
6dec0ab2ba
@ -218,6 +218,30 @@ public abstract class AbstractRegion extends AbstractSet<BlockVector3> implement
|
||||
int result = worldHash ^ (worldHash >>> 32);
|
||||
result = 31 * result + this.getMinimumPoint().hashCode();
|
||||
result = 31 * result + this.getMaximumPoint().hashCode();
|
||||
result = 31 * result + this.getArea();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(o == this) {
|
||||
return true;
|
||||
}
|
||||
if(!(o instanceof Region)){
|
||||
return false;
|
||||
}
|
||||
Region region = ((Region) o);
|
||||
if(this.getWorld() != region.getWorld()){
|
||||
if(this.getWorld() == null || region.getWorld() == null){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(this.getWorld().equals(region.getWorld())
|
||||
&& this.getMinimumPoint().equals(region.getMinimumPoint())
|
||||
&& this.getMaximumPoint().equals(region.getMaximumPoint())
|
||||
&& this.getArea() == region.getArea()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user