Preventing players from pulling entities with fishing rods?

Discussion in 'Spigot Plugin Development' started by Big_Scary, May 18, 2016.

  1. Players are using fishing rods to move armor stands and animals without the permission of the owners of those entities.

    I'm currently cancelling the EntityDamageByEntity event, and then calling Projectile.remove() to delete the fishing hook projectile. But players can still right-click to pull the armor stand or animal. What's the right way to prevent a fishing hook from attaching, or from pulling once attached? Either would solve my problem I think.
  2. Choco


    Actually, instead of cancelling the hitting of the fishing rod's bobber, cancel the actual right clicking of the fishing rod.
    Most developers aren't aware that the PlayerFishEvent actually fires when you fish an entity as well (That being Armour Stands, other Players, etc.)

    Check if the entity is in the protected region, cancel the event if that is the case :)
    Before using PlayerFishEvent#getCaught(), check what the result is. It can either be an Item (if actually fishing), null if no entity/fish is caught at all, or any Entity in general
    • Like Like x 1
    • Winner Winner x 1
    • Informative Informative x 1
  3. Thanks, but that's no good - I think that event only fires for projectiles hitting blocks, and even if I'm wrong and it also fires for hitting entities, the event doesn't include any getters for information about hit entities, only hit blocks and the projectile.

    Thanks very much! I wouldn't have guessed that about the fishing event. I will try your suggestion. :)
    • Like Like x 1
  4. Googled my issue and it affects all worldguard regions, players are using their fishing rods to steal player's animals...

    PS: I'm aware this is GP related, but google found this topic
    #5 TNTUP, Jul 1, 2016
    Last edited: Jul 1, 2016
  5. Yep thanks I got it fixed in grief prevention.
    • Like Like x 1
  6. Lately I've been working on this group project and one of the guy's code for a paintball gun involves using a BlockIterator to trace a line in the direction of the paintball (which is a snowball) and look for the block that it's going to hit immediately following the ProjectileHitEvent processing. dang, that run-on sentence tho

    I know you've got your particular issue solved, but if ya wanted to try something else, here ya go :p
    • Agree Agree x 1
  7. I think you should ask it here instead.