package net.cobem.grizzly.habbohotel.roleplay;

public class TaxiMonitor implements Runnable {
    private Thread Taxi;

    private boolean Active;

    private int WaitTime = 0;

    private RoleplayObject Interactor;

    public TaxiMonitor(RoleplayObject Obj) {
        Taxi = new Thread(this);
        Taxi.start();

        Active = true;

        Interactor = Obj;
    }

    @Override
    public void run() {
        while (Active) {
            if (WaitTime != 0) //Still got some time to wait..
            {
                WaitTime--;
            }

            if (WaitTime == 1) //It's time to take them there!
            {
                Interactor.runTaxi();
            }

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
        }
    }

    public void setWaitingTime(int Time) {
        this.WaitTime = Time;
    }

}
