Use a long to refer to the volume of a region to prevent overflow (#1350)

* Use a long to refer to the volume of a region, and rename the method to getVolume

* Fixed issues noted in review

* Forgot to floor

* Fixed review notes

* Can use a long here rather than BigDecimal

* Improve javadocs

* style

(cherry picked from commit 328030fd6281e58a4ea1d0cdd0a2e274da90afbe)
This commit is contained in:
Matthew Miller
2020-06-08 05:50:17 -04:00
committed by MattBDev
parent a23b182de5
commit 33adba4a6f
27 changed files with 225 additions and 124 deletions

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.extension.platform;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.task.AsyncNotifyQueue;
import com.sk89q.worldedit.EditSession;
@ -701,10 +700,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
* @return
*/
public Region getLargestRegion() {
int area = 0;
long area = 0;
Region max = null;
for (Region region : this.getCurrentRegions()) {
final int tmp = region.getArea();
final long tmp = region.getVolume();
if (tmp > area) {
area = tmp;
max = region;