diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java index 5b873a8ce..8a692bddf 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java @@ -48,6 +48,7 @@ public Configuration() { public boolean obsidianBucket = true; + public boolean endPortalPick = true; public boolean removeIslandBlocksOnDelete = false; public boolean clearInventoryOnRegen = false; public boolean clearEnderChestOnRegen = false; diff --git a/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java b/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java index 38814e4dc..372257220 100644 --- a/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java +++ b/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java @@ -23,13 +23,6 @@ public void onClick(PlayerInteractEvent event) { User user = IridiumSkyblock.getInstance().getUserManager().getUser(player); ItemStack itemInHand = player.getInventory().getItemInMainHand(); - if (!(IridiumSkyblock.getInstance().getConfiguration().obsidianBucket - && event.getAction().equals(Action.RIGHT_CLICK_BLOCK) - && event.getClickedBlock().getType().equals(Material.OBSIDIAN) - && itemInHand.getType().equals(Material.BUCKET))) { - return; - } - Optional island = IridiumSkyblock.getInstance().getTeamManager().getTeamViaLocation(event.getClickedBlock().getLocation()); if (!island.isPresent()) return; if (!IridiumSkyblock.getInstance().getTeamManager().getTeamPermission(island.get(), user, PermissionType.BLOCK_BREAK)) { @@ -39,15 +32,32 @@ public void onClick(PlayerInteractEvent event) { return; } - event.getClickedBlock().setType(Material.AIR); - if (itemInHand.getAmount() > 1) { - itemInHand.setAmount(itemInHand.getAmount() - 1); - player.getInventory().addItem(new ItemStack(Material.LAVA_BUCKET)).values().forEach(itemStack -> - player.getWorld().dropItem(player.getLocation(), itemStack) - ); - } else { - itemInHand.setType(Material.LAVA_BUCKET); + if(IridiumSkyblock.getInstance().getConfiguration().obsidianBucket + && event.getAction().equals(Action.RIGHT_CLICK_BLOCK) + && event.getClickedBlock().getType().equals(Material.OBSIDIAN) + && itemInHand.getType().equals(Material.BUCKET)) { + + event.getClickedBlock().setType(Material.AIR); + + if (itemInHand.getAmount() > 1) { + itemInHand.setAmount(itemInHand.getAmount() - 1); + player.getInventory().addItem(new ItemStack(Material.LAVA_BUCKET)).values().forEach(itemStack -> + player.getWorld().dropItem(player.getLocation(), itemStack) + ); + } else { + itemInHand.setType(Material.LAVA_BUCKET); + } } - } + if(IridiumSkyblock.getInstance().getConfiguration().endPortalPick + && (event.getAction().equals(Action.LEFT_CLICK_BLOCK) && player.isSneaking()) + && event.getClickedBlock().getType().equals(Material.END_PORTAL_FRAME) + && (itemInHand.getType().name().contains("PICKAXE"))) { + + event.getClickedBlock().breakNaturally(); + + player.getInventory().addItem(new ItemStack(Material.END_PORTAL_FRAME)).values().forEach(itemStack -> + player.getWorld().dropItem(player.getLocation(), itemStack)); + } + } }