I need Plugin Help please help me!

Discussion in 'Plugin Development' started by Dyrocraft, Aug 8, 2012.

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


    Im trying to make a plugin for letting players fly, i have created the command /fly to allow flight with this code player.setAllowFlight(isInitialized()); . How would i make it so if a player is already in flight mode it takes them away from it? I also have Permission in my code if that might interfer with anything please do tell me. Thanks and please please help me?>
  2. Offline


    1. if(p.getAllowFlight()==true){
    2. p.setAllowFlight(!p.getAllowFlight());
    3. }else if(p.getAllowFlight()==false){
    4. p.setAllowFlight(!p.getAllowFlight());
    5. }
    6. //That's if you want to tell them something specific to the changing.
    7. //If all you want to do is toggle do:
    8. p.setAllowFlight(!p.getAllowFlight));
  3. Offline

    Sagacious_Zed Bukkit Docs

    its simpler than that
    1. if (p.getAllowFlight()) {
    2. // do stuff if allowed
    3. } else {
    4. // do stuff if not allowed
    5. }
    6. p.setAlloweFlight(!p.getAllowFlight));

    The if statement is optional, its there if you need to do something during the toggle depending on the state it is currently in.
Thread Status:
Not open for further replies.

Share This Page