Use QueryOption.SORT for region commands (#1817)

This commit is contained in:
stonar96 2021-08-22 16:14:40 +02:00 committed by GitHub
parent 75774dbbb0
commit 5a6b6eb81b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,7 @@
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionQuery.QueryOption;
import com.sk89q.worldguard.protection.util.WorldEditRegionConverter;
import java.util.Set;
@ -200,7 +201,7 @@ protected static ProtectedRegion checkRegionStandingIn(RegionManager regionManag
* @throws CommandException thrown if no region was found
*/
protected static ProtectedRegion checkRegionStandingIn(RegionManager regionManager, LocalPlayer player, boolean allowGlobal, String rgCmd) throws CommandException {
ApplicableRegionSet set = regionManager.getApplicableRegions(player.getLocation().toVector().toBlockPoint());
ApplicableRegionSet set = regionManager.getApplicableRegions(player.getLocation().toVector().toBlockPoint(), QueryOption.SORT);
if (set.size() == 0) {
if (allowGlobal) {
@ -230,7 +231,7 @@ protected static ProtectedRegion checkRegionStandingIn(RegionManager regionManag
builder.append(regionComp);
}
player.print(builder.build());
throw new CommandException("Several regions affect your current location (please pick one).");
throw new CommandException("You're standing in several regions (please pick one).");
}
return set.iterator().next();