Renames openTime to activatedTime, though it's kind of used for both opening and activation

This commit is contained in:
Kristian Knarvik 2021-10-20 20:57:00 +02:00
parent 2650e31d97
commit 4b42d4914a
3 changed files with 13 additions and 13 deletions

View File

@ -130,15 +130,15 @@ public class Portal {
} }
/** /**
* Gets the time this portal opened * Gets the time this portal was activated/opened
* *
* <p>The time is given in the equivalent of a Unix timestamp. It's used to decide when a portal times out and * <p>The time is given in the equivalent of a Unix timestamp. It's used to decide when a portal times out and
* automatically closes.</p> * automatically closes.</p>
* *
* @return <p>The time this portal opened</p> * @return <p>The time this portal was activated/opened</p>
*/ */
public long getOpenTime() { public long getActivatedTime() {
return portalOpener.getOpenTime(); return portalOpener.getActivatedTime();
} }
/** /**

View File

@ -17,7 +17,7 @@ public class PortalOpener {
private boolean isOpen = false; private boolean isOpen = false;
private final Portal portal; private final Portal portal;
private long openTime; private long activatedTime;
private Player player; private Player player;
private final PortalActivator portalActivator; private final PortalActivator portalActivator;
@ -44,10 +44,10 @@ public class PortalOpener {
/** /**
* Sets the time when this portal was activated * Sets the time when this portal was activated
* *
* @param openTime <p>Unix timestamp when portal was activated</p> * @param activatedTime <p>Unix timestamp when portal was activated</p>
*/ */
public void setOpenTime(long openTime) { public void setActivatedTime(long activatedTime) {
this.openTime = openTime; this.activatedTime = activatedTime;
} }
/** /**
@ -99,7 +99,7 @@ public class PortalOpener {
private void updatePortalOpenState(Player openFor) { private void updatePortalOpenState(Player openFor) {
//Update the open state of this portal //Update the open state of this portal
isOpen = true; isOpen = true;
openTime = System.currentTimeMillis() / 1000; activatedTime = System.currentTimeMillis() / 1000;
Stargate.openPortalsQueue.add(portal); Stargate.openPortalsQueue.add(portal);
Stargate.activePortalsQueue.remove(portal); Stargate.activePortalsQueue.remove(portal);
PortalOptions options = portal.getOptions(); PortalOptions options = portal.getOptions();
@ -196,8 +196,8 @@ public class PortalOpener {
* *
* @return <p>The time this portal activator's portal opened</p> * @return <p>The time this portal activator's portal opened</p>
*/ */
public long getOpenTime() { public long getActivatedTime() {
return openTime; return activatedTime;
} }
} }

View File

@ -20,7 +20,7 @@ public class StarGateThread implements Runnable {
if (portal.getOptions().isAlwaysOn() || !portal.isOpen()) { if (portal.getOptions().isAlwaysOn() || !portal.isOpen()) {
continue; continue;
} }
if (time > portal.getOpenTime() + Stargate.getOpenTime()) { if (time > portal.getActivatedTime() + Stargate.getOpenTime()) {
portal.getPortalOpener().closePortal(false); portal.getPortalOpener().closePortal(false);
iterator.remove(); iterator.remove();
} }
@ -31,7 +31,7 @@ public class StarGateThread implements Runnable {
if (!portal.getPortalActivator().isActive()) { if (!portal.getPortalActivator().isActive()) {
continue; continue;
} }
if (time > portal.getOpenTime() + Stargate.getActiveTime()) { if (time > portal.getActivatedTime() + Stargate.getActiveTime()) {
portal.getPortalActivator().deactivate(); portal.getPortalActivator().deactivate();
iterator.remove(); iterator.remove();
} }