Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02: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.
Dieser Commit ist enthalten in:
Ursprung
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;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren