Giving a player a passenger?

Discussion in 'Plugin Development' started by Samthelord1, Aug 28, 2013.

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

    Samthelord1

    I was wondering if its possible to give a player a passenger, I used this but I'm not sure whether it should work or not, suggestions appreciated.

    PHP:
        public boolean onCommand(CommandSender senderCommand cmdString commandLabelString[] args) {
            
    Player p = (Playersender;
            if(
    commandLabel.equalsIgnoreCase("ride")) {
                if(
    args.length == 1) {
                   
         
                      
    Player target Bukkit.getPlayer(args[0]);
                      if(
    target != null) {
                          
    target.setPassenger(p);
                      }
               
                      else {
    p.sendMessage(ChatColor.DARK_PURPLE args[0] + ChatColor.GOLD " is not online!");
    }
                }
                      else  {
          
    p.sendMessage(ChatColor.BLUE "usage: /ride <player>");
                              }
                }
            return 
    true;
    }
    }
     
  2. Offline

    xTrollxDudex

    Samthelord1
    Looks correct and all. But use getPlayerExact.
     
  3. Offline

    Samthelord1

    xTrollxDudex Idk if I should, because I wouldn't mind it changing from like troll to trolldood3 if nobody is online with troll
     
  4. Offline

    xTrollxDudex

  5. Offline

    Samthelord1

    xTrollxDudex I've learned quite a bit since we last spoke :D
     
  6. Offline

    xTrollxDudex

Thread Status:
Not open for further replies.

Share This Page