Fix players being allowed to build outside regions (Fixes #278)

Basically players were allowed to build shops outside regions in the
case where no region manager was available.
This commit is contained in:
Phoenix616 2020-01-15 23:13:18 +01:00
parent 4067427650
commit 37b7669acb

View File

@ -29,10 +29,12 @@ public class WorldGuardBuilding implements Listener {
public void canBuild(BuildPermissionEvent event) {
ApplicableRegionSet regions = getApplicableRegions(event.getSign().getBlock().getLocation());
if (regions != null && Properties.WORLDGUARD_USE_FLAG) {
if (regions == null) {
event.allow(false);
} else if (Properties.WORLDGUARD_USE_FLAG) {
event.allow(regions.queryState(worldGuard.wrapPlayer(event.getPlayer()), WorldGuardFlags.ENABLE_SHOP) == StateFlag.State.ALLOW);
} else {
event.allow(regions == null || regions.size() != 0);
event.allow(regions.size() > 0);
}
}