From ba86f289944e967aa0c3898aa15d4205f3ea1930 Mon Sep 17 00:00:00 2001 From: AigleDev Date: Thu, 12 Sep 2019 21:20:20 +0200 Subject: [PATCH 1/2] NPE fix --- .../massivecraft/factions/listeners/FactionsPlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 36b9b647..99fc0642 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -804,7 +804,7 @@ public class FactionsPlayerListener implements Listener { Block block = event.getClickedBlock(); Player player = event.getPlayer(); // Check if the material is bypassing protection - if (block == null) return; // clicked in air, apparently + if (block == null || event.getItem() == null) return; // clicked in air, apparently if (Conf.territoryBypassProtectedMaterials.contains(event.getItem().getType())) return; if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) { if (!canPlayerUseBlock(player, block, false)) { From 0d8526372ef19419ae8779785c6572effd5c2a31 Mon Sep 17 00:00:00 2001 From: AigleDev Date: Thu, 12 Sep 2019 21:21:23 +0200 Subject: [PATCH 2/2] change --- .../factions/listeners/FactionsPlayerListener.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 99fc0642..8e3a07bf 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -804,8 +804,10 @@ public class FactionsPlayerListener implements Listener { Block block = event.getClickedBlock(); Player player = event.getPlayer(); // Check if the material is bypassing protection - if (block == null || event.getItem() == null) return; // clicked in air, apparently - if (Conf.territoryBypassProtectedMaterials.contains(event.getItem().getType())) return; + if (block == null) return; // clicked in air, apparently + if(event.getItem() != null) { + if (Conf.territoryBypassProtectedMaterials.contains(event.getItem().getType())) return; + } if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) { if (!canPlayerUseBlock(player, block, false)) { event.setCancelled(true);