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;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class PointsScheduler extends Scheduler {
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public static boolean IGNORE_HOTEL_VIEW;
|
|
|
|
public static boolean IGNORE_IDLED;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public PointsScheduler() {
|
2019-07-17 02:33:19 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
super(Emulator.getConfig().getInt("hotel.auto.points.interval"));
|
2019-05-02 02:42:12 +02:00
|
|
|
this.reloadConfig();
|
|
|
|
}
|
2018-07-06 15:30:00 +02:00
|
|
|
|
2019-05-02 02:42:12 +02:00
|
|
|
public void reloadConfig() {
|
2019-05-26 20:14:53 +02:00
|
|
|
if (Emulator.getConfig().getBoolean("hotel.auto.points.enabled")) {
|
|
|
|
IGNORE_HOTEL_VIEW = Emulator.getConfig().getBoolean("hotel.auto.points.ignore.hotelview");
|
|
|
|
IGNORE_IDLED = Emulator.getConfig().getBoolean("hotel.auto.points.ignore.idled");
|
2019-05-02 02:42:12 +02:00
|
|
|
if (this.disposed) {
|
|
|
|
this.disposed = false;
|
|
|
|
this.run();
|
|
|
|
}
|
2019-05-26 20:14:53 +02:00
|
|
|
} else {
|
2018-07-06 15:30:00 +02:00
|
|
|
this.disposed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public void run() {
|
2018-07-06 15:30:00 +02:00
|
|
|
super.run();
|
|
|
|
|
2019-03-18 02:22:00 +01:00
|
|
|
Habbo habbo;
|
2019-05-26 20:14:53 +02:00
|
|
|
for (Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
2018-07-06 15:30:00 +02:00
|
|
|
habbo = map.getValue();
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
try {
|
|
|
|
if (habbo != null) {
|
2018-07-06 15:30:00 +02:00
|
|
|
if (habbo.getHabboInfo().getCurrentRoom() == null && IGNORE_HOTEL_VIEW)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
|
|
|
|
continue;
|
|
|
|
|
2019-07-17 02:33:19 +02:00
|
|
|
//habbo.givePoints(POINTS);
|
|
|
|
habbo.givePoints(habbo.getHabboInfo().getRank().getDiamondsTimerAmount());
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
2019-05-26 20:14:53 +02:00
|
|
|
} catch (Exception e) {
|
2018-07-06 15:30:00 +02:00
|
|
|
Emulator.getLogging().logErrorLine(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public boolean isDisposed() {
|
2019-03-18 02:22:00 +01:00
|
|
|
return this.disposed;
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public void setDisposed(boolean disposed) {
|
2018-07-06 15:30:00 +02:00
|
|
|
this.disposed = disposed;
|
|
|
|
}
|
|
|
|
}
|