Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
1) Anyone on the server equips the grappling hook gadget.
2) Anyone else on the server trys to fish, they are shot across the water like they're using a grappling hook.
Expected behavior
Fishing rods don't turn into grappling hooks
Further Information (please complete the following information):
Server Version: Paper 1.18.2
GadgetsMenu Version: 5.1.4
Console stack trace if have. N/A
Screenshots
If applicable, add screenshots to help explain your problem.
Additional Information
Any other information that you would like to provide that may be relevant to the issue?
GadgetGrapplingHook#onPlayerHook(PlayerFishEvent) uses "getPlayer().getItemInHand()" to check the fishing rod to see if it's a grappling hook, if it is, it does what grappling hook things. getPlayer() is not the player that fired the event. It's the player stored in the GadgetGrapplingHook object, which means if anyone has the grappling hook equipped, this check will be satisfied and everyone will be able to grapple with a regular fishing rod.
To fix, just replace line 97
"ItemStack itemStack = getPlayer().getItemInHand();"
with
"ItemStack itemStack = player.getItemInHand();"
Same typo exists in GadgetGrapplingHook#onPlayerGrapple(PlayerGrappleEvent), line 79
Alternatively, put a check to see if the player in the event is the same as GadgetGrapplingHook#getPlayer()
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior: 1) Anyone on the server equips the grappling hook gadget. 2) Anyone else on the server trys to fish, they are shot across the water like they're using a grappling hook.
Expected behavior Fishing rods don't turn into grappling hooks
Further Information (please complete the following information):
Screenshots If applicable, add screenshots to help explain your problem.
Additional Information Any other information that you would like to provide that may be relevant to the issue? GadgetGrapplingHook#onPlayerHook(PlayerFishEvent) uses "getPlayer().getItemInHand()" to check the fishing rod to see if it's a grappling hook, if it is, it does what grappling hook things. getPlayer() is not the player that fired the event. It's the player stored in the GadgetGrapplingHook object, which means if anyone has the grappling hook equipped, this check will be satisfied and everyone will be able to grapple with a regular fishing rod.
To fix, just replace line 97
"ItemStack itemStack = getPlayer().getItemInHand();" with "ItemStack itemStack = player.getItemInHand();"
Same typo exists in GadgetGrapplingHook#onPlayerGrapple(PlayerGrappleEvent), line 79
Alternatively, put a check to see if the player in the event is the same as GadgetGrapplingHook#getPlayer()