2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.core;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
public class CreditsScheduler extends Scheduler
|
|
|
|
{
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public static boolean IGNORE_HOTEL_VIEW;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public static boolean IGNORE_IDLED;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public static int CREDITS;
|
|
|
|
|
|
|
|
public CreditsScheduler()
|
|
|
|
{
|
|
|
|
super(Emulator.getConfig().getInt("hotel.auto.credits.interval"));
|
|
|
|
|
|
|
|
if(Emulator.getConfig().getBoolean("hotel.auto.credits.enabled"))
|
|
|
|
{
|
|
|
|
IGNORE_HOTEL_VIEW = Emulator.getConfig().getBoolean("hotel.auto.credits.ignore.hotelview");
|
|
|
|
IGNORE_IDLED = Emulator.getConfig().getBoolean("hotel.auto.credits.ignore.idled");
|
|
|
|
|
|
|
|
CREDITS = Emulator.getConfig().getInt("hotel.auto.credits.amount");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.disposed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
super.run();
|
|
|
|
|
|
|
|
Habbo habbo;
|
|
|
|
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
|
|
|
|
{
|
|
|
|
habbo = map.getValue();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (habbo != null)
|
|
|
|
{
|
|
|
|
if (habbo.getHabboInfo().getCurrentRoom() == null && IGNORE_HOTEL_VIEW)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
habbo.giveCredits(CREDITS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Emulator.getLogging().logErrorLine(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isDisposed()
|
|
|
|
{
|
|
|
|
return disposed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDisposed(boolean disposed)
|
|
|
|
{
|
|
|
|
this.disposed = disposed;
|
|
|
|
}
|
|
|
|
}
|