From 1a7b7cdeb76e39fd9259a009c40f58500e090782 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 25 Jul 2021 10:52:03 -0700 Subject: [PATCH] 1.17.2 Release (#1812) * Version 1.17.2 * Add alternative Addon#getIslandManager method (#1797) We have already done this to the main BentoBox class. But add-ons missed it, and it still has this weird structure: Addon#getIslands().getIslands(). This will just add the same method as it is already in BentoBox class. * Fix bucket dupe (#1806) Fix https://discord.com/channels/272499714048524288/310623455462686720/867790395442462760 * Removes unneeded exploit protection code for skulls (#1810) This no longer seems to be required with 1.17.1 https://github.com/BentoBoxWorld/BSkyBlock/issues/430 * Quote filename of addon that cannot be loaded. Provides a better understanding of which addon failed. * Remove update when pasting chest. Co-authored-by: BONNe Co-authored-by: Fredthedoggy <45927799+Fredthedoggy@users.noreply.github.com> Co-authored-by: Justin Co-authored-by: gecko10000 <60494179+levtey@users.noreply.github.com> --- pom.xml | 2 +- .../bentobox/bentobox/api/addons/Addon.java | 10 ++++++++++ .../bentobox/blueprints/BlueprintPaster.java | 1 - .../flags/protection/BreakBlocksListener.java | 17 ----------------- .../worldsettings/ObsidianScoopingListener.java | 1 + .../bentobox/managers/AddonsManager.java | 2 +- 6 files changed, 13 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index c63f3cf3c..db6efb907 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ -LOCAL - 1.17.1 + 1.17.2 diff --git a/src/main/java/world/bentobox/bentobox/api/addons/Addon.java b/src/main/java/world/bentobox/bentobox/api/addons/Addon.java index 2516b3cfb..c05225ef6 100644 --- a/src/main/java/world/bentobox/bentobox/api/addons/Addon.java +++ b/src/main/java/world/bentobox/bentobox/api/addons/Addon.java @@ -393,6 +393,16 @@ public abstract class Addon { public IslandsManager getIslands() { return getPlugin().getIslands(); } + + /** + * Get Islands Manager + * @return Islands manager + * @see #getIslands() + * @since 1.17.1 + */ + public IslandsManager getIslandsManager() { + return getPlugin().getIslandsManager(); + } /** * Get the Addon By Name diff --git a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java index c8415e2dc..d6f754863 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java @@ -296,7 +296,6 @@ public class BlueprintPaster { } // Chests, in general if (bs instanceof InventoryHolder) { - bs.update(true, false); Inventory ih = ((InventoryHolder)bs).getInventory(); // Double chests are pasted as two blocks so inventory is filled twice. This code stops over filling for the first block. bpBlock.getInventory().forEach(ih::setItem); diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java index bbe367e9e..35b4bc0ea 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java @@ -2,7 +2,6 @@ package world.bentobox.bentobox.listeners.flags.protection; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; import org.bukkit.entity.AbstractArrow; import org.bukkit.entity.ArmorStand; @@ -20,7 +19,6 @@ import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; -import org.bukkit.util.BlockIterator; import world.bentobox.bentobox.api.flags.FlagListener; import world.bentobox.bentobox.lists.Flags; @@ -68,21 +66,6 @@ public class BreakBlocksListener extends FlagListener { if (!e.getAction().equals(Action.LEFT_CLICK_BLOCK)) { return; } - - // Look along player's sight line to see if any blocks are skulls - try { - BlockIterator iterator = new BlockIterator(e.getPlayer(), 10); - while (iterator.hasNext()) { - Block lastBlock = iterator.next(); - if (lastBlock.getType().toString().endsWith("_SKULL") || (lastBlock.getType().toString().endsWith("_HEAD") && !lastBlock.getType().equals(Material.PISTON_HEAD))) { - checkIsland(e, e.getPlayer(), lastBlock.getLocation(), Flags.BREAK_BLOCKS); - return; - } - } - } catch (Exception ignored) { - // We can ignore this exception - } - switch (e.getClickedBlock().getType()) { case CAKE: checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS); diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/ObsidianScoopingListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/ObsidianScoopingListener.java index 73fb568a4..bcff672a1 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/ObsidianScoopingListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/ObsidianScoopingListener.java @@ -62,6 +62,7 @@ public class ObsidianScoopingListener extends FlagListener { user.sendMessage("protection.flags.OBSIDIAN_SCOOPING.scooping"); player.getWorld().playSound(player.getLocation(), Sound.ITEM_BUCKET_FILL_LAVA, 1F, 1F); b.setType(Material.AIR); + e.setCancelled(true); Bukkit.getScheduler().runTask(BentoBox.getInstance(), () -> givePlayerLava(player, bucket)); return true; } diff --git a/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java b/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java index b7c5b26a2..9e0ae0d45 100644 --- a/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java @@ -173,7 +173,7 @@ public class AddonsManager { } } catch (Exception e) { // We couldn't load the addon, aborting. - plugin.logError("Could not load addon! " + e.getMessage()); + plugin.logError("Could not load addon '" + f.getName() + "'. Error is: " + e.getMessage()); plugin.logStacktrace(e); return; }