Querying ProtectionΒΆ

To query protection, the DefaultFlag.BUILD flag can be tested using the methods explained in Flag Calculation.

Tip

You can also use the shortcut methods as explained in Build Checks.

Example: Querying build permission using the query cache

LocalPlayer localPlayer = getWorldGuard().wrapPlayer(player)
Location loc = new Location(world, 10, 64, 100);
RegionContainer container = getWorldGuard().getRegionContainer();
RegionQuery query = container.createQuery();

if (!query.testState(loc, localPlayer, DefaultFlag.BUILD)) {
    // Can't build
}