package info.tregmine.commands;

import org.bukkit.entity.Horse;

import info.tregmine.Tregmine;
import info.tregmine.api.TregminePlayer;

public class SpawnCommand extends AbstractCommand
{
    public SpawnCommand(Tregmine tregmine)
    {
        super(tregmine, "spawn");
    }

    @Override
    public boolean handlePlayer(TregminePlayer player, String[] args)
    {
        Horse horse = null;

        if((player.getVehicle() != null) && (player.getVehicle() instanceof Horse)){
            horse = (Horse)player.getVehicle();
        }

        if(horse != null){
            horse.eject();
            horse.teleport(player.getWorld().getSpawnLocation());
            player.teleport(player.getWorld().getSpawnLocation());
            horse.setPassenger(player.getDelegate());
        }else{
            player.teleport(player.getWorld().getSpawnLocation());
        }
        return true;
    }
}

@@ -376,468 +376,44 @@
     
-Horse horse = null;%0A%0A        if((player.getVehicle() != null) && (player.getVehicle() instanceof Horse))%7B%0A            horse = (Horse)player.getVehicle();%0A        %7D%0A%0A        if(horse != null)%7B%0A            horse.eject();%0A            horse.teleport(player.getWorld().getSpawnLocation());%0A            player.teleport(player.getWorld().getSpawnLocation());%0A            horse.setPassenger(player.getDelegate());%0A        %7Delse%7B%0A            player.teleport(player.getW
+player.teleportWithHorse(player.getw
 orld
@@ -440,18 +440,8 @@
 ));%0A
-        %7D%0A
     

Use new method