Skip to content

Commit

Permalink
fixed grappling hook not working due to bat dying (#3926)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeroen <j.teriele1@students.uu.nl>
  • Loading branch information
iTwins and Jeroen authored Jul 29, 2023
1 parent ca85798 commit fe99cbd
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;

import io.github.bakedlibs.dough.items.ItemUtils;
Expand Down Expand Up @@ -58,7 +56,7 @@ public GrapplingHook(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec
UUID uuid = p.getUniqueId();
boolean isConsumed = consumeOnUse.getValue() && p.getGameMode() != GameMode.CREATIVE;

if (!e.getClickedBlock().isPresent() && !Slimefun.getGrapplingHookListener().isGrappling(uuid)) {
if (e.getClickedBlock().isEmpty() && !Slimefun.getGrapplingHookListener().isGrappling(uuid)) {
e.cancel();

if (p.getInventory().getItemInOffHand().getType() == Material.BOW) {
Expand All @@ -79,10 +77,11 @@ public GrapplingHook(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec
arrow.setVelocity(direction);

Bat bat = (Bat) p.getWorld().spawnEntity(p.getLocation(), EntityType.BAT);
bat.setInvulnerable(true);
bat.setCanPickupItems(false);
bat.setAI(false);
bat.setSilent(true);
bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 100000));
bat.setInvisible(true);
bat.setLeashHolder(arrow);

boolean state = item.getType() != Material.SHEARS;
Expand Down

0 comments on commit fe99cbd

Please sign in to comment.