This commit is contained in:
Telesphoreo 2020-08-15 23:35:04 -05:00
commit e525aa4d0a
1 changed files with 8 additions and 2 deletions

View File

@ -73,17 +73,23 @@ public class BlockListener implements Listener
for(Block block : event.getBlocks())
{
Material type = block.getType();
if (type == Material.AIR) //Workaround for https://github.com/aromaa/WorldGuardExtraFlagsPlugin/issues/12
{
type = event.getEffectiveMaterial();
}
ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
Set<Material> state = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.ALLOW_BLOCK_PLACE);
if (state != null && state.contains(block.getType()))
if (state != null && state.contains(type))
{
event.setResult(Result.ALLOW);
}
else
{
Set<Material> state2 = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.DENY_BLOCK_PLACE);
if (state2 != null && state2.contains(block.getType()))
if (state2 != null && state2.contains(type))
{
event.setResult(Result.DENY);
return;