This commit is contained in:
Telesphoreo 2020-08-15 23:35:04 -05:00
commit e525aa4d0a

View file

@ -73,17 +73,23 @@ public class BlockListener implements Listener
for(Block block : event.getBlocks()) 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()); ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
Set<Material> state = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.ALLOW_BLOCK_PLACE); 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); event.setResult(Result.ALLOW);
} }
else else
{ {
Set<Material> state2 = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.DENY_BLOCK_PLACE); 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); event.setResult(Result.DENY);
return; return;