From def33bc9ad902aa50ebb0e6d9941ee3a3d2dceab Mon Sep 17 00:00:00 2001 From: manuelgu Date: Sun, 29 May 2016 11:59:16 +0200 Subject: [PATCH 1/2] Fix IntellectualSites/PlotSquared#1140 --- .../java/com/plotsquared/bukkit/listeners/PlayerEvents.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index d2c155023..2c5416b2f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -780,8 +780,7 @@ public class PlayerEvents extends PlotListener implements Listener { return; } Plot plot = area.getOwnedPlot(location); - Optional flag; - switch (block.getType()) { + switch (event.getSource().getType()) { case GRASS: if (Flags.GRASS_GROW.isFalse(plot)) { event.setCancelled(true); From 8d6565c32c37ae98c834303ed4602457fabdb493 Mon Sep 17 00:00:00 2001 From: manuelgu Date: Sun, 29 May 2016 19:38:31 +0200 Subject: [PATCH 2/2] Fix NPE --- .../java/com/plotsquared/bukkit/listeners/PlayerEvents.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 2c5416b2f..15fa9f7a7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -780,6 +780,9 @@ public class PlayerEvents extends PlotListener implements Listener { return; } Plot plot = area.getOwnedPlot(location); + if (plot == null) { + return; + } switch (event.getSource().getType()) { case GRASS: if (Flags.GRASS_GROW.isFalse(plot)) {