Fly help

Discussion in 'Plugin Development' started by stickeric, Jan 14, 2013.

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

    stickeric

    hey i'm working on a custom plugin for my server and it's working fine but i want to do it like this:

    When you type /fly
    and your flying is not enabled you will be enabled to get flying
    And when you type /fly agian
    It will basiclly stop flying

    And when i typ /fly it will start all over agian.

    So in short words:

    Typ /fly - Start flying
    typ /fly agian stop flying

    I do know how to make them fly but only with /fly and /stopfly
     
  2. Offline

    ZeusAllMighty11

    Well if you have a two way function for /fly , that means you must've put in in yourself. Because you can just do player.setAllowFlight(boolean); [where boolean = true / false ]

    ?? Can i see your code, I can fix.
     
  3. Offline

    Lonesface

    Code:java
    1.  
    2. if (p.isFlying()) {
    3. p.setAllowFlight(false);
    4. p.setFlying(false);
    5. } else {
    6. p.setAllowFlight(true);
    7. p.setFlying(true);
    8. }
    9.  

    Remember to cast the sender to a Player like this

    Code:java
    1.  
    2. Player p = (Player) sender;
    3.  
     
    stickeric likes this.
  4. Offline

    stickeric

    Thanks that is working!
     
Thread Status:
Not open for further replies.

Share This Page