From dae7bbdf9dc2c80bb259e157df5404328d953df2 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 13 Feb 2019 13:26:19 +0000 Subject: [PATCH 1/3] Fix dropped items being removed from plots --- .../intellectualsites/plotsquared/bukkit/BukkitMain.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index f08fbccaf..9c2bc49db 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -375,7 +375,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case FIREBALL: case DRAGON_FIREBALL: case DROPPED_ITEM: - if (Settings.Enabled_Components.KILL_ROAD_ITEMS || plotArea + if (Settings.Enabled_Components.KILL_ROAD_ITEMS && plotArea .getOwnedPlotAbs( BukkitUtil.getLocation(entity.getLocation())) == null) { entity.remove(); @@ -386,7 +386,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case FALLING_BLOCK: // managed elsewhere continue; - case SHULKER: { + case SHULKER: if (Settings.Enabled_Components.KILL_ROAD_MOBS) { LivingEntity livingEntity = (LivingEntity) entity; List meta = entity.getMetadata("plot"); @@ -436,7 +436,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } continue; - } case LLAMA: case DONKEY: case MULE: From 3e8308ecd74769191e718228d7142bbb6170d096 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 13 Feb 2019 13:35:19 +0000 Subject: [PATCH 2/3] Catch statement already being null --- .../intellectualsites/plotsquared/plot/database/SQLManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java index 013b2c7ca..2995a448d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java @@ -351,7 +351,7 @@ import java.util.concurrent.atomic.AtomicInteger; task.set(statement); task.addBatch(statement); try { - if (statement.isClosed()) { + if (statement != null && statement.isClosed()) { statement = null; } } catch (AbstractMethodError ignore) { From 8710f2f83be0cbd5954d14f3966b1604ae76ef6c Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 13 Feb 2019 13:43:22 +0000 Subject: [PATCH 3/3] Fix NPE when right-clicking a >1.13 block --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 890d82f85..93d462d32 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1876,10 +1876,14 @@ import java.util.regex.Pattern; eventType = PlayerBlockEventType.TELEPORT_OBJECT; break; default: - int blockId = ((LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings() - .fromStringToLegacy(blockType.name())).id; - if (blockId > 197) { - eventType = PlayerBlockEventType.INTERACT_BLOCK; + LegacyPlotBlock legacyPlotBlock = + (LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings() + .fromStringToLegacy(blockType.name()); + if (legacyPlotBlock != null) { + int blockId = legacyPlotBlock.id; + if (blockId > 197) { + eventType = PlayerBlockEventType.INTERACT_BLOCK; + } } break; }