From 130e1b63008c9e8f66bc86a65aae29910527cdf2 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 13 Feb 2019 21:47:54 +0000 Subject: [PATCH] Fix armorstands, boats etc being placeable on players plots with "use 0" flag --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 13 +++---------- .../bukkit/util/BukkitLegacyMappings.java | 2 +- 2 files changed, 4 insertions(+), 11 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 93d462d32..ea5f96be0 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,23 +1876,16 @@ import java.util.regex.Pattern; eventType = PlayerBlockEventType.TELEPORT_OBJECT; break; default: - LegacyPlotBlock legacyPlotBlock = - (LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings() - .fromStringToLegacy(blockType.name()); - if (legacyPlotBlock != null) { - int blockId = legacyPlotBlock.id; - if (blockId > 197) { - eventType = PlayerBlockEventType.INTERACT_BLOCK; - } + if (blockType.isInteractable()) { + eventType = PlayerBlockEventType.INTERACT_BLOCK; } - break; } lb = new BukkitLazyBlock(PlotBlock.get(block.getType().toString())); - ItemStack hand = player.getInventory().getItemInMainHand(); if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK || !player.isSneaking())) { break; } + ItemStack hand = player.getInventory().getItemInMainHand(); Material type = (hand == null) ? null : hand.getType(); if (type == Material.AIR) { eventType = PlayerBlockEventType.INTERACT_BLOCK; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java index f31acd04f..bf75a93e5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java @@ -675,7 +675,7 @@ public final class BukkitLegacyMappings extends LegacyMappings { final List missing = new ArrayList<>(); for (final Material material : Material.values()) { final String materialName = material.name().toLowerCase(Locale.ENGLISH); - if (OLD_STRING_TO_STRING_PLOT_BLOCK.get(materialName) == null) { + if (NEW_STRING_TO_LEGACY_PLOT_BLOCK.get(materialName) == null) { final LegacyBlock missingBlock = new LegacyBlock(material.getId(), materialName, materialName); missing.add(missingBlock);