Allow EditSession construction with no allowed regions

Not sure why WorldEdit creates an EditSession for commands which clearly
do not need one. This change now means players without an allowed region
can use informational and navigation commands without a region.

The error will be instead thrown when the EditSession is first used.
This commit is contained in:
Jesse Boyd 2016-08-22 23:10:51 +10:00
parent 814ac60823
commit 46887623bc

View File

@ -248,9 +248,6 @@ public class EditSession implements Extent {
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY);
}
}
if (allowedRegions != null && allowedRegions.length == 0) {
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_NO_REGION);
}
this.blockBag = blockBag;
this.originalLimit = limit;
this.limit = limit.copy();
@ -273,8 +270,12 @@ public class EditSession implements Extent {
}
}
if (allowedRegions != null) {
if (allowedRegions.length == 0) {
this.extent = new NullExtent(this.extent, BBC.NO_REGION);
} else {
this.extent = new ProcessedWEExtent(this.extent, allowedRegions, limit);
}
}
this.extent = wrapExtent(this.extent, bus, event, Stage.BEFORE_HISTORY);
}