Solved Fishing rod, teleporting

Discussion in 'Plugin Development' started by bkleinman1, Sep 30, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    bkleinman1

    So i need a plugin The will allow people to cast out a fishing rod, and when it hits a player, it will teleport the player that it hit, to the player that cast the rod.

    i have tried using the EntityDamageByEntityEvent, but i think i am using it wrong as nothing i seem to try, works.
    Thanks for any help.
     
  2. Offline

    josh32hamilton

    You could use EntityDamageByEntityEvent, check if event.getDama...uh....uh what he said
     
  3. Offline

    chasechocolate

    josh32hamilton well that was helpful.

    You could use EntityDamageByEntityEvent, check if event.getDamager() instanceof Fish, cast, check if fish.getShooter() instanceof Player, cast, then teleport event.getEntity() to player. Alternatively, you could use PlayerFishEvent, check if event.getState() is PlayerFishEvent.State.CAUGHT_ENTITY, and then teleport event.getCaught() to event.getHook().getShooter().
     
    bkleinman1 likes this.
  4. Offline

    bkleinman1

    chasechocolate the event.getHook doesnt seem to work

    Would "event.getCaught().teleport(event.getPlayer());" be right?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  5. Offline

    chasechocolate

    bkleinman1 yes, my bad, don't have my IDE or the JavaDocs open :p
     
    bkleinman1 likes this.
  6. Offline

    dtclaybaugh

    I've been experimenting with that code you wrote up, I tried it just as it was in my listener but it gives an error on line 6. I removed the line altogether, moved things around, but it still isn't working. Anyone have ideas? I actually don't understand what line 6 is doing at all. Explanation maybe too?

    EDIT: This isn't what I was looking for anyhow, no wonder it didn't work lol

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page