I hope this doesn't cause more issues than it solves
This commit is contained in:
MattBDev 2019-04-24 21:23:57 -04:00
parent d0be0780fd
commit 9f792fa54b
3 changed files with 12 additions and 15 deletions

View file

@ -420,7 +420,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case SHULKER: case SHULKER:
if (Settings.Enabled_Components.KILL_ROAD_MOBS) { if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
LivingEntity livingEntity = (LivingEntity) entity; LivingEntity livingEntity = (LivingEntity) entity;
List<MetadataValue> meta = entity.getMetadata("plot"); List<MetadataValue> meta = entity.getMetadata("shulkerPlot");
if (!meta.isEmpty()) { if (!meta.isEmpty()) {
if (livingEntity.isLeashed()) { if (livingEntity.isLeashed()) {
continue; continue;
@ -457,7 +457,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (area != null) { if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc)); PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
if (currentPlotId != null) { if (currentPlotId != null) {
entity.setMetadata("plot", new FixedMetadataValue( entity.setMetadata("shulkerPlot", new FixedMetadataValue(
(Plugin) PlotSquared.get().IMP, currentPlotId)); (Plugin) PlotSquared.get().IMP, currentPlotId));
} }
} }

View file

@ -62,7 +62,7 @@ public class EntitySpawnListener implements Listener {
public static void test(Entity entity) { public static void test(Entity entity) {
@NotNull World world = entity.getWorld(); @NotNull World world = entity.getWorld();
List<MetadataValue> meta = entity.getMetadata(KEY); List<MetadataValue> meta = entity.getMetadata(KEY);
if (meta == null || meta.isEmpty()) { if (meta.isEmpty()) {
if (PlotSquared.get().hasPlotArea(world.getName())) { if (PlotSquared.get().hasPlotArea(world.getName())) {
entity.setMetadata(KEY, entity.setMetadata(KEY,
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation())); new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation()));
@ -126,8 +126,8 @@ public class EntitySpawnListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
case SHULKER: case SHULKER:
if (!entity.hasMetadata("plot")) { if (!entity.hasMetadata("shulkerPlot")) {
entity.setMetadata("plot", entity.setMetadata("shulkerPlot",
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId())); new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId()));
} }
} }

View file

@ -10,10 +10,13 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.*; import com.github.intellectualsites.plotsquared.plot.util.*;
import org.bukkit.*; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -1048,17 +1051,11 @@ import java.util.regex.Pattern;
public void onBigBoom(EntityExplodeEvent event) { public void onBigBoom(EntityExplodeEvent event) {
Location location = BukkitUtil.getLocation(event.getLocation()); Location location = BukkitUtil.getLocation(event.getLocation());
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
if (area == null) { boolean plotArea = location.isPlotArea();
if (!plotArea) {
if (!PlotSquared.get().hasPlotArea(location.getWorld())) { if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
return; return;
} }
Iterator<Block> iterator = event.blockList().iterator();
while (iterator.hasNext()) {
iterator.next();
if (location.isPlotArea()) {
iterator.remove();
}
}
return; return;
} }
Plot plot = area.getOwnedPlot(location); Plot plot = area.getOwnedPlot(location);