Simplify and remove duplicate code.

This commit is contained in:
wizjany 2020-08-03 07:21:56 -04:00
parent c8bde17994
commit 03f05d3a4e
1 changed files with 3 additions and 4 deletions

View File

@ -246,11 +246,10 @@ class RegionCommandsBase {
*/
protected static Region checkSelection(Actor actor) throws CommandException {
LocalSession localSession = WorldEdit.getInstance().getSessionManager().get(actor);
if (localSession == null || localSession.getSelectionWorld() == null)
throw new CommandException("Please select an area first. " +
"Use WorldEdit to make a selection! " +
"(see: https://worldedit.enginehub.org/en/latest/usage/regions/selections/).");
try {
if (localSession == null || localSession.getSelectionWorld() == null) {
throw new IncompleteRegionException();
}
return localSession.getRegionSelector(localSession.getSelectionWorld()).getRegion();
} catch (IncompleteRegionException e) {
throw new CommandException("Please select an area first. " +