Solved Continuous stuff

Discussion in 'Plugin Development' started by Coopah, Jul 18, 2014.

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

    Coopah

    How would I go about making a method that checks if a player is right clicking with a sword?
    I know there is, isBlocking();
    I want to make something that when a player right clicks it will set his velocity but I want it so you can hold right click and keep setting his velocity. For example, if a player was holding block he would keep being launched until he stops right clicking.
     
  2. Offline

    TGRHavoc

  3. Offline

    Coopah

    TGRHavoc
    No lol :p
    I don't just want something to happen when a player clicks, I want something to happen after a player clicks and holds it. Like, the effect won't stop until they stop holding right click. Like a repeating task.
     
  4. Offline

    fireblast709

  5. Offline

    MrSnare

    To expand on this, What you want to do is as follows.

    When a player blocks with his sword, give him a velocity and create a sync delayed task to check if the player is blocking in 10 ticks,
    In the delayed task check if they are still blocking, if they are, set the velocity again and schedule the same task to run again. If they have stopped blocking, do nothing.
     
  6. Offline

    fireblast709

    MrSnare or use a repeating task... BukkitRunnables have the ability to self cancel
     
  7. Offline

    MrSnare

    Ya. I don't like repeating tasks though. Just a personal preference :)
     
  8. Offline

    Coopah

    Awhh, thank you guys! :D
     
Thread Status:
Not open for further replies.

Share This Page