use of com.sk89q.worldguard.blacklist.event.BlockPlaceBlacklistEvent in project WorldGuard by EngineHub.
the class BlacklistListener method onPlaceBlock.
@EventHandler(ignoreCancelled = true)
public void onPlaceBlock(final PlaceBlockEvent event) {
final WorldConfiguration wcfg = getWorldConfig(event.getWorld());
// Blacklist guard
if (wcfg.getBlacklist() == null) {
return;
}
Player player = event.getCause().getFirstPlayer();
if (player == null) {
return;
}
final LocalPlayer localPlayer = getPlugin().wrapPlayer(player);
event.filter(target -> wcfg.getBlacklist().check(new BlockPlaceBlacklistEvent(localPlayer, BukkitAdapter.asBlockVector(target), createTarget(target.getBlock(), event.getEffectiveMaterial())), false, false));
}
Aggregations