Move permission check out of loop

See #1307
This commit is contained in:
MattBDev 2016-08-12 15:04:11 -04:00
parent 2f74368879
commit 749ab83e5d

View File

@ -48,11 +48,11 @@ public class WEManager {
if (area == null) {
return regions;
}
boolean allowMember = player.hasPermission("plots.worldedit.member");
for (Plot plot : area.getPlots()) {
if (!plot.isBasePlot() || (Settings.Done.RESTRICT_BUILDING && (plot.getFlag(Flags.DONE).isPresent()))) {
continue;
}
boolean allowMember = player.hasPermission("plots.worldedit.member");
if (allowMember && plot.isAdded(uuid) || !allowMember && (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {
regions.addAll(plot.getRegions());
}