From 4bc8b78224f241a6928db9b7fd85103387cade61 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 9 Oct 2022 15:41:16 +0100 Subject: [PATCH] fix: adjust nullability checks for shulkers in the kill road mobs task - Fixes #3789 --- .../java/com/plotsquared/bukkit/BukkitPlatform.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index b19130c1c..019559146 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -866,10 +866,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl com.plotsquared.core.location.Location pLoc = BukkitUtil.adapt(entity.getLocation()); PlotArea area = pLoc.getPlotArea(); if (area != null) { - PlotId currentPlotId = area.getPlotAbs(pLoc).getId(); - if (!originalPlotId.equals(currentPlotId) && (currentPlotId == null || !area.getPlot( - originalPlotId) - .equals(area.getPlot(currentPlotId)))) { + Plot currentPlot = area.getPlotAbs(pLoc); + if (currentPlot == null || !originalPlotId.equals(currentPlot.getId())) { if (entity.hasMetadata("ps-tmp-teleport")) { continue; } @@ -883,11 +881,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl com.plotsquared.core.location.Location pLoc = BukkitUtil.adapt(entity.getLocation()); PlotArea area = pLoc.getPlotArea(); if (area != null) { - PlotId currentPlotId = area.getPlotAbs(pLoc).getId(); - if (currentPlotId != null) { + Plot currentPlot = area.getPlotAbs(pLoc); + if (currentPlot != null) { entity.setMetadata( "shulkerPlot", - new FixedMetadataValue((Plugin) PlotSquared.platform(), currentPlotId) + new FixedMetadataValue((Plugin) PlotSquared.platform(), currentPlot.getId()) ); } }