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;
|
|
|
|
|
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
|
|
|
private static int POINTS;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public PointsScheduler() {
|
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-26 20:14:53 +02:00
|
|
|
public static boolean isIgnoreHotelView() {
|
|
|
|
return IGNORE_HOTEL_VIEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setIgnoreHotelView(boolean ignoreHotelView) {
|
|
|
|
IGNORE_HOTEL_VIEW = ignoreHotelView;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isIgnoreIdled() {
|
|
|
|
return IGNORE_IDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setIgnoreIdled(boolean ignoreIdled) {
|
|
|
|
IGNORE_IDLED = ignoreIdled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int getPOINTS() {
|
|
|
|
return POINTS;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setPOINTS(int POINTS) {
|
|
|
|
PointsScheduler.POINTS = POINTS;
|
|
|
|
}
|
|
|
|
|
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");
|
|
|
|
POINTS = Emulator.getConfig().getInt("hotel.auto.points.amount");
|
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;
|
|
|
|
|
|
|
|
habbo.givePoints(POINTS);
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
}
|