Skip to content

Commit

Permalink
Fix Fishing rods not getting exp at offhand launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo56958 committed Dec 11, 2023
1 parent 889468b commit ea89720
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Trident;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
Expand Down Expand Up @@ -171,6 +168,8 @@ public void onProjectileLaunch(@NotNull final ProjectileLaunchEvent event) {

ItemStack tool = player.getInventory().getItemInMainHand();
if (event.getEntity() instanceof Trident trident) tool = trident.getItem();
if (event.getEntity() instanceof FishHook && (tool == null || !ToolType.FISHINGROD.contains(tool.getType())))
tool = player.getInventory().getItemInOffHand(); // Fishing rods can also be thrown in offhand

// get reference from bow shoot
if(event.getEntity().hasMetadata(MineTinker.getPlugin().getName() + "item")) {
Expand Down

0 comments on commit ea89720

Please sign in to comment.