The first will flag the hook (bob) when it lands, the second will teleport the player to the hook only once it's landed, and the third will kill the landed hook (so you aren't stuck infinitely teleporting to it).
Note: This design is limited in several ways:
One, all fishing rods will act like grappling hooks. You will need to distinguish grappling hooks from the rest. Maybe add another score called "HoldingGrapple", then add two more commands to the command chain; the first would reset the HoldingGrapple score for all players, then the second would flag the player (set the score) if they're holding a fishing rod named "grappling hook". Finally, add that score requirement as part of the target selectors in the other above commands so they only trigger if the player is holding a grappling hook).
Two, you will not be able to grapple onto water blocks or moving entities. This system relies on the hook coming to a complete stop before you are teleported to it, and the bob will not have a motion tag of 0,0,0 on an entity that's moving, or in water blocks (it continuously bobs in water).
Three, this system will not work perfectly in multiplayer maps if multiple people are casting in close proximity (this system would just teleport the closest person to where the bob landed, which would not necessarily be the person who cast it).
Four, the hook won't naturally degrade and eventually break like regular tools. This may not be a problem for your specific intent, though. You'd have to somehow use the score system to detect when a player had cast the rod, then invisibly track it's health and destroy the tool when it had "broken".
Obviously there's room for improvement, but this proves it can be done. Let me know if you come up with any ideas to improve.
I'm trying to adapt this for multiplayer by making the grappling hook command only affect players who have a score of 1 for an objective. I know how to do this for @a but not for @e. Do you know if they work similarly?
I'd need to see the commands you're writing to offer an actual answer. The only difference between @e and @a is that @a targets only players, while @e targets everything.
I haven't been able to think of a perfect solution to adapt this to multiplayer. One option is to add a new score that tracks fishingrod use (stat.useItem), then reset the score once the player is within range of the fishing bob. This would help reduce the chance of teleporting the wrong player, but there's the still the chance of having two people cast simultaneously nearby each other. Otherwise, I don't know if this is possible to do perfectly without mods/plugins.
The stat.useItem is what I meant. I'm trying to adapt the commands so that they only affect players with a useItem.fishing_rod score of 1, so that only they would be teleported. The server I'm making has no chance of having two people simultaneously casting, so I'm not worried about that.
My solution was just to add a [score_stat.useFishingRod_min=1] qualifier to the teleport @p portion of the second command. It now works very well. Thanks so much for your help!
This will automatically track players use of fishing rods. Then you put "score_UseHook_min=1" in the target selector of your other commands. Don't forget to add another command that resets UseHook to 0 once the player has been teleported.