diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockBreakEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockBreakEvent.java deleted file mode 100644 index 30e88ae92..000000000 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockBreakEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -package io.github.thebusybiscuit.slimefun4.api.events; - -import java.util.List; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -/** - * This {@link Event} is called when a {@link Player} breaks multiply blocks. - * - * @author TheBusyBiscuit - * - */ -public class MultiBlockBreakEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - private final Player player; - private final Block clickedBlock; - private final List blocks; - private boolean cancelled; - - @ParametersAreNonnullByDefault - public MultiBlockBreakEvent(@Nullable Player player, Block clicked, List blocks) { - this.player = player; - this.clickedBlock = clicked; - this.blocks = blocks; - } - - /** - * This returns the specific {@link Block} that was breaked. - * - * @return The {@link Block} that was breaked - */ - @Nonnull - public Block getClickedBlock() { - return clickedBlock; - } - - /** - * This returns the list of all breaking blocks. - * - * @return A list of {@link Block} - */ - @Nonnull - public List getBlocks() { - return this.blocks; - } - - @Nullable - public Player getPlayer() { - return this.player; - } - - @Override - public boolean isCancelled() { - return cancelled; - } - - @Override - public void setCancelled(boolean cancel) { - this.cancelled = cancel; - } - - @Nonnull - public static HandlerList getHandlerList() { - return handlers; - } - - @Nonnull - @Override - public HandlerList getHandlers() { - return getHandlerList(); - } - -} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java index e3fc82aff..eb7499f78 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java @@ -19,7 +19,6 @@ import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.blocks.Vein; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; -import io.github.thebusybiscuit.slimefun4.api.events.MultiBlockBreakEvent; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; import me.mrCookieSlime.Slimefun.Lists.RecipeType; @@ -49,13 +48,6 @@ public class WoodcutterAndroid extends ProgrammableAndroid { List list = Vein.find(target, MAX_REACH, block -> Tag.LOGS.isTagged(block.getType())); if (!list.isEmpty()) { - MultiBlockBreakEvent event = new MultiBlockBreakEvent(null, target, list); - Bukkit.getServer().getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return true; - } - Block log = list.get(list.size() - 1); log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java index 15ebd16ff..9ea48d8f5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java @@ -6,7 +6,6 @@ import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.Axis; -import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; @@ -17,7 +16,6 @@ import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.blocks.Vein; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; -import io.github.thebusybiscuit.slimefun4.api.events.MultiBlockBreakEvent; import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable; import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler; @@ -77,13 +75,6 @@ public class LumberAxe extends SlimefunItem implements NotPlaceable { logs.remove(block); } - MultiBlockBreakEvent event = new MultiBlockBreakEvent(e.getPlayer(), block, logs); - Bukkit.getServer().getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - for (Block b : logs) { if (!BlockStorage.hasBlockInfo(b) && SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), b, ProtectableAction.BREAK_BLOCK)) { stripLog(b); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java index b6a969030..45965d1d8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java @@ -4,7 +4,6 @@ import java.util.List; import javax.annotation.ParametersAreNonnullByDefault; -import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; @@ -15,7 +14,6 @@ import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.blocks.Vein; import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; -import io.github.thebusybiscuit.slimefun4.api.events.MultiBlockBreakEvent; import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting; import io.github.thebusybiscuit.slimefun4.api.items.settings.IntRangeSetting; import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler; @@ -49,13 +47,7 @@ public class PickaxeOfVeinMining extends SimpleSlimefunItem { return (e, tool, fortune, drops) -> { if (SlimefunTag.PICKAXE_OF_VEIN_MINING_BLOCKS.isTagged(e.getBlock().getType())) { List blocks = Vein.find(e.getBlock(), maxBlocks.getValue(), b -> SlimefunTag.PICKAXE_OF_VEIN_MINING_BLOCKS.isTagged(b.getType())); - - MultiBlockBreakEvent event = new MultiBlockBreakEvent(e.getPlayer(), e.getBlock(), blocks); - Bukkit.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { - breakBlocks(e.getPlayer(), blocks, fortune, tool); - } + breakBlocks(e.getPlayer(), blocks, fortune, tool); } }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/OrebfuscatorIntegration.java b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/OrebfuscatorIntegration.java index 9b3123b64..a41fc9076 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/OrebfuscatorIntegration.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/OrebfuscatorIntegration.java @@ -14,7 +14,6 @@ import org.bukkit.event.Listener; import io.github.thebusybiscuit.slimefun4.api.events.BlockPlacerPlaceEvent; import io.github.thebusybiscuit.slimefun4.api.events.ExplosiveToolBreakBlocksEvent; -import io.github.thebusybiscuit.slimefun4.api.events.MultiBlockBreakEvent; import io.github.thebusybiscuit.slimefun4.api.events.ReactorExplodeEvent; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import net.imprex.orebfuscator.api.OrebfuscatorService; @@ -61,9 +60,4 @@ public class OrebfuscatorIntegration implements Listener { public void onReactorExplode(ReactorExplodeEvent event) { this.service.deobfuscate(Arrays.asList(event.getLocation().getBlock())); } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onMultiBlockBreak(MultiBlockBreakEvent event) { - this.service.deobfuscate(event.getBlocks()); - } }