Permalink
Browse files

Fixed an error with chest protection listener.

  • Loading branch information...
me4502 committed Jul 23, 2018
1 parent bb29883 commit acce59edd4689764929a149b5f5b77cda8ed3202
@@ -80,16 +80,16 @@ public void onPlaceBlock(final PlaceBlockEvent event) {
@EventHandler(ignoreCancelled = true)
public void onBreakBlock(final BreakBlockEvent event) {
final Player player = event.getCause().getFirstPlayer();
final LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
final BukkitWorldConfiguration wcfg = getWorldConfig(localPlayer);
final BukkitWorldConfiguration wcfg = getWorldConfig(BukkitAdapter.adapt(event.getWorld()));
// Early guard
if (!wcfg.signChestProtection) {
return;
}
if (player != null) {
final LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
event.filter(target -> {
if (wcfg.isChestProtected(BukkitAdapter.adapt(target.getBlock().getLocation()), localPlayer)) {
sendMessage(event, player, ChatColor.DARK_RED + "This chest is protected.");

0 comments on commit acce59e

Please sign in to comment.