Fly Speed Boolean

Discussion in 'Plugin Development' started by C0lA_K1nG, Nov 10, 2012.

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

    C0lA_K1nG

    Okay I have created my plugin a Flying plugin Called FlyPlus

    I've searched up booleans for setting the speed of fly to like increase the speed!

    And when i issue the command
    /fly o <name>
    It changes your fly mode becuase of /fly any ideas?

    Becuase i need it for my server its a special plugin

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  2. Offline

    frozenpoptartmc

    Why WOULD you use BOOLEANS to set the player flight speed?
    That doesn't make sense.
     
    gomeow and ferrybig like this.
  3. Offline

    C0lA_K1nG

    What should i use then i could only find: p.setFlySpeed
     
  4. Offline

    thoosequa

    Boolean variables can have only two values: true and false. What you want is whatever .setFlySpeed() requires as arguments. Not looking at the API I am assuming its an int so what you can do is: p.setFlySpeed(5). That would increase the Fly speed by 5. Or if you do that via an command /<yourcommandherere> args[0]
    p.setFlySpeed(args[0])
     
  5. Offline

    beastman3226

    ^
    Code:
    public class MyPLuginCommandExecutor implements CommandExecutor {
    @Override
    public void onCommand(CommandSender sender, Command cmd, String label, String[] args) {
     if(cmd.getName().equalsIgnoreCase("whatever")){
        if(args.length == 2){
    //dont use the next line its just to show that arg 0 is the playername       
    if(args[0].equalsIgnoreCase(playername)){
    p.setFlySpeed(args[1]);
    }
    }
    }
    return true;
    }
    }
    
    This is how I would do it.
     
  6. Offline

    thoosequa

    Sorry but there are massive flaws in that bit of code. That will neither compile nor work

    That might be wrong I just scribbled that down real quick but that should do more or less

    Code:
    public class MyPLuginCommandExecutor implements CommandExecutor {
     
        @Override
        public void onCommand(CommandSender sender, Command cmd, String label, String[] args) {
       
        Player player = bukkit.getPlayer();
       
            if(cmd.getName().equalsIgnoreCase("flyspeed")){
                if(args.length == 2){
                    if(args[0].equalsIgnoreCase(player)){
                        player.setFlySpeed(args[1]);
                    } else { sender.sendMessage("Player not found"); }
                } else { sender.sendMessage("Incorrect Syntax. Try /flyspeed <name> <speed>); }
            } sender.sendMessage("Incorrect Syntax. Try /flyspeed <name> <speed>);
    return false;
        }
    }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  7. Offline

    C0lA_K1nG

    Thanks ill try that and see if it will work with my code!
     
Thread Status:
Not open for further replies.

Share This Page