Skip to content

Commit

Permalink
Fix rocket dupe
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan committed Jul 11, 2024
1 parent 55169ef commit 974bb57
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Map;

import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import lombok.Getter;

Expand All @@ -26,6 +27,7 @@
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
Expand All @@ -51,6 +53,7 @@
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
Expand Down Expand Up @@ -104,6 +107,17 @@ public void onPlayerPlace(@Nonnull BlockPlaceEvent e) {
b.setBlockData(data, true);
}
});

addItemHandler(new BlockBreakHandler(false, false) {
@Override
@ParametersAreNonnullByDefault
public void onPlayerBreak(BlockBreakEvent e, ItemStack itemStack, List<ItemStack> list) {
if (Boolean.parseBoolean(BlockStorage.getLocationInfo(e.getBlock().getLocation(), "isLaunching"))) {
e.setCancelled(true);
e.getPlayer().sendMessage(ChatColor.RED + "The rocket is currently launching!");
}
}
});
}

private void openGUI(@Nonnull Player p, @Nonnull Block b) {
Expand Down

0 comments on commit 974bb57

Please sign in to comment.