mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-12-27 17:44:47 +00:00
Fixed TNT not working on allow-block-place, closes #12
This commit is contained in:
parent
d9f15956cd
commit
4d084282e5
1 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue