Use TimeUnit for time calculations
This commit is contained in:
@@ -54,6 +54,7 @@ import tools.Pair;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AbstractPlayerInteraction {
|
||||
|
||||
@@ -502,7 +503,8 @@ public class AbstractPlayerInteraction {
|
||||
Pet evolved = null;
|
||||
Pet target;
|
||||
|
||||
long period = (long) 90 * 24 * 60 * 60 * 1000; //refreshes expiration date: 90 days
|
||||
long period = TimeUnit.DAYS.toMillis(90); //refreshes expiration date: 90 days
|
||||
|
||||
|
||||
target = getPlayer().getPet(slot);
|
||||
if (target == null) {
|
||||
|
||||
@@ -59,6 +59,8 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
|
||||
/**
|
||||
* @author Matze
|
||||
* @author Ronan
|
||||
@@ -665,7 +667,7 @@ public class EventInstanceManager {
|
||||
}
|
||||
|
||||
disposeLocks();
|
||||
}, 60 * 1000);
|
||||
}, MINUTES.toMillis(1));
|
||||
}
|
||||
|
||||
private void disposeLocks() {
|
||||
|
||||
@@ -51,6 +51,8 @@ import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
//import jdk.nashorn.api.scripting.ScriptUtils;
|
||||
|
||||
/**
|
||||
@@ -265,7 +267,7 @@ public class EventManager {
|
||||
synchronized (instances) {
|
||||
instances.remove(name);
|
||||
}
|
||||
}, YamlConfig.config.server.EVENT_LOBBY_DELAY * 1000);
|
||||
}, SECONDS.toMillis(YamlConfig.config.server.EVENT_LOBBY_DELAY));
|
||||
}
|
||||
|
||||
public void setProperty(String key, String value) {
|
||||
|
||||
@@ -69,6 +69,8 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
|
||||
/**
|
||||
* @author Matze
|
||||
*/
|
||||
@@ -670,9 +672,9 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
mc.changeMap(map, map.getPortal(0));
|
||||
mc.sendPacket(PacketCreator.serverNotice(6, LanguageConstants.getMessage(mc, LanguageConstants.CPQEntryLobby)));
|
||||
TimerManager tMan = TimerManager.getInstance();
|
||||
tMan.schedule(() -> mapClock(3 * 60), 1500);
|
||||
tMan.schedule(() -> mapClock((int) MINUTES.toSeconds(3)), 1500);
|
||||
|
||||
mc.setCpqTimer(TimerManager.getInstance().schedule(() -> mc.changeMap(mapExit, mapExit.getPortal(0)), 3 * 60 * 1000));
|
||||
mc.setCpqTimer(TimerManager.getInstance().schedule(() -> mc.changeMap(mapExit, mapExit.getPortal(0)), MINUTES.toMillis(3)));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -913,9 +915,9 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
mc.changeMap(map, map.getPortal(0));
|
||||
mc.sendPacket(PacketCreator.serverNotice(6, LanguageConstants.getMessage(mc, LanguageConstants.CPQEntryLobby)));
|
||||
TimerManager tMan = TimerManager.getInstance();
|
||||
tMan.schedule(() -> mapClock(3 * 60), 1500);
|
||||
tMan.schedule(() -> mapClock((int) MINUTES.toSeconds(3)), 1500);
|
||||
|
||||
mc.setCpqTimer(TimerManager.getInstance().schedule(() -> mc.changeMap(mapExit, mapExit.getPortal(0)), 3 * 60 * 1000));
|
||||
mc.setCpqTimer(TimerManager.getInstance().schedule(() -> mc.changeMap(mapExit, mapExit.getPortal(0)), MINUTES.toMillis(3)));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
Reference in New Issue
Block a user