Grappler Kit [McPvP]

Discussion in 'Plugin Development' started by ajs333, Nov 9, 2013.

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

    ajs333

    Is there a way someone can code for me the grappler kit like McPvP?
     
  2. Offline

    c0mp

    Removed post seeking compensation, moved to Plugin Requests!
     
  3. Offline

    ajs333

    Thank you...

    Can someone help me? I'm really stuck...

    I don't know how to do the leash throwing a hook...
     
  4. Offline

    timtower Administrator Administrator Moderator

    ajs333 Are you looking for the code or for a plugin? BTW: Don't bump within 24 hours
     
  5. Offline

    LemonLimes4ever

  6. Offline

    ajs333

    timtower
    Yeah, I'm creating my own KitPvP plugin and I can't seem to figure out how to do the grappler kit...
     
  7. Offline

    daytonpoop

    Code:java
    1. @EventHandler(priority=EventPriority.NORMAL, ignoreCancelled=true)
    2. public void onPlayerFish(PlayerFishEvent event)
    3. {
    4. final Player player = event.getPlayer();
    5.  
    6. if (this.grappler.contains(player.getName())) {
    7. player.sendMessage(ChatColor.RED + "Cooling Down");
    8. event.setCancelled(true);
    9. }
    10. else if (event.getState().equals(PlayerFishEvent.State.IN_GROUND))
    11. {
    12.  
    13. Location lc = player.getLocation();
    14. Location to = event.getHook().getLocation();
    15.  
    16. lc.setY(lc.getY() + 0.5D);
    17. player.teleport(lc);
    18.  
    19. double g = -0.08D;
    20. double d = to.distance(lc);
    21. double t = d;
    22. double v_x = (1.0D + 0.07000000000000001D * t) * (to.getX() - lc.getX()) / t;
    23. double v_y = (1.0D + 0.03D * t) * (to.getY() - lc.getY()) / t - 0.5D * g * t;
    24. double v_z = (1.0D + 0.07000000000000001D * t) * (to.getZ() - lc.getZ()) / t;
    25.  
    26. Vector v = player.getVelocity();
    27. v.setX(v_x);
    28. v.setY(v_y);
    29. v.setZ(v_z);
    30. player.setVelocity(v);
    31. grappler.add(player.getName());
    32. Bukkit.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable() {
    33. public void run() {
    34. grappler.remove(player.getName());
    35. }
    36. }
    37. , 250L);
    38. }
    39. else if (event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY))
    40. {
    41.  
    42. Location lc = player.getLocation();
    43. Location to = event.getHook().getLocation();
    44.  
    45. lc.setY(lc.getY() + 0.5D);
    46. player.teleport(lc);
    47.  
    48. double g = -0.08D;
    49. double d = to.distance(lc);
    50. double t = d;
    51. double v_x = (1.0D + 0.07000000000000001D * t) * (to.getX() - lc.getX()) / t;
    52. double v_y = (1.0D + 0.03D * t) * (to.getY() - lc.getY()) / t - 0.5D * g * t;
    53. double v_z = (1.0D + 0.07000000000000001D * t) * (to.getZ() - lc.getZ()) / t;
    54.  
    55. Vector v = player.getVelocity();
    56. v.setX(v_x);
    57. v.setY(v_y);
    58. v.setZ(v_z);
    59. player.setVelocity(v);
    60. this.grappler.add(player.getName());
    61. Bukkit.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable() {
    62. public void run() {
    63. grappler.remove(player.getName());
    64. }
    65. }
    66. , 250L);
    67. }
    68. }
     
    CynutsBR likes this.
  8. Offline

    Necrodoom

    Moved to correct section.
     
  9. Offline

    ajs333

    daytonpoop
    That work but I get an error. The error message is Plugin cannot be resolved to a variable. What did I do wrong and I want the item to be a leash not a fishing rod...
    When a player right clicks the leash then the hook will fly out and when they left click it moves them towards the hook location!
     
  10. Offline

    sgavster

    ajs333 plugin should be 'this' if in your main class.
     
  11. Offline

    ajs333

    sgavster what about the leash part...
     
  12. Offline

    sgavster

    ajs333 No idea, I'm looking for the same thing.
     
  13. Offline

    ajs333

    sgavster
    Ok...

    I was trying to get the hook to come out of the leash but don't seem to get it...

    sgavster
    Did you find it yet? I can't seem to get it just right... :(

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

    Plo124

    Try leashing an Invisible entity, or something you want at the start (e.g. An arrow), then you can set the arrow's velocity, and the leash will render until it "breaks"
     
  15. Offline

    chasechocolate

    ajs333 it's done with a custom fishing hook entity.
     
  16. Offline

    ajs333

    chasechocolate
    I have never done anything with that... so can you give an example.. PLZ! :)
     
  17. Offline

    Luke_Lax

    I don't want to sound rude but it seems like you're asking to be spoon fed, the whole meal :3 If someone told you how to do it, could you turn it into Java code? :/
     
    Phatomhugo likes this.
  18. Offline

    ajs333

    Luke_Lax
    I'm pretty new to Java Coding and it seems like this is a very hard kit to code... I'm not asking for someone to do the whole thing... but if they did it would help me greatly because I'm so new...
     
  19. Offline

    chasechocolate

    ajs333 if you are new to coding, then I do not suggest starting with something as advanced as this.
     
    itzrobotix likes this.
  20. Offline

    Compressions

    ajs333 Doing the whole thing for you would hurt you greatly, missing out on an opportune time to learn.
     
  21. Offline

    ajs333

    Ok everyone, I'll just wait until I get more advanced to code this kit... thanks anyways... :/
     
  22. Offline

    Monkey_Swag

    PogoStick29 has a tutorial on grappling hooks. I would link you but I am on my phone. Go on youtube and search "Pogostick29dev grappling hook tutorial" ;)
     
    PogoStick29 likes this.
  23. Offline

    GeorgeeeHD

    Monkey_Swag lol this guy only cares about the leash being the hook, pretty sure pogo doesnt cover that. i think he already knows how to do it with a fishing rod
     
  24. Offline

    MrInspector

    Take a look at when this thread was posted & the OP hasn't been on since Dec 29th 2013.
     
  25. Offline

    Monkey_Swag

    MrInspector well someone else bumped it today. Didn't mind checking thr OP's date of posting this thread.... oops xD
     
    MrInspector likes this.
  26. Offline

    vRiiP

    I would buy your gKits plugin on Spigot but I dont know how well your Grappler kit works. Do you mind making a video on it?
     
  27. Offline

    GeorgeeeHD

    vRiiP it works the same as mcpvp
     
  28. Offline

    vRiiP

    awesome! I will hopefully buy your plugin within a week! :D
     
Thread Status:
Not open for further replies.

Share This Page