diff --git a/src/main/java/net/knarcraft/stargate/Stargate.java b/src/main/java/net/knarcraft/stargate/Stargate.java index 43c1578..a49d9df 100644 --- a/src/main/java/net/knarcraft/stargate/Stargate.java +++ b/src/main/java/net/knarcraft/stargate/Stargate.java @@ -60,10 +60,6 @@ public class Stargate extends JavaPlugin { public static final ConcurrentLinkedQueue activePortalsQueue = new ConcurrentLinkedQueue<>(); private static final Queue chunkUnloadQueue = new PriorityQueue<>(); - //Amount of seconds before deactivating/closing portals - private static final int activeTime = 10; - private static final int openTime = 10; - private static Logger logger; public static Server server; public static Stargate stargate; @@ -154,24 +150,6 @@ public class Stargate extends JavaPlugin { return stargateGateConfig.destroyedByExplosion(); } - /** - * Gets the amount of seconds a portal should be open before automatically closing - * - * @return

The open time of a gate

- */ - public static int getOpenTime() { - return openTime; - } - - /** - * Gets the amount of seconds a portal should be active before automatically deactivating - * - * @return

The active time of a gate

- */ - public static int getActiveTime() { - return activeTime; - } - /** * Gets the logger used for logging to the console * diff --git a/src/main/java/net/knarcraft/stargate/config/StargateGateConfig.java b/src/main/java/net/knarcraft/stargate/config/StargateGateConfig.java index 8ab9cf5..8a39a4b 100644 --- a/src/main/java/net/knarcraft/stargate/config/StargateGateConfig.java +++ b/src/main/java/net/knarcraft/stargate/config/StargateGateConfig.java @@ -21,6 +21,8 @@ public final class StargateGateConfig { private boolean destroyExplosion = false; private ChatColor signColor; private String defaultGateNetwork = "central"; + private static final int activeTime = 10; + private static final int openTime = 10; /** * Instantiates a new stargate config @@ -31,6 +33,24 @@ public final class StargateGateConfig { loadGateConfig(newConfig); } + /** + * Gets the amount of seconds a portal should be open before automatically closing + * + * @return

The open time of a gate

+ */ + public int getOpenTime() { + return openTime; + } + + /** + * Gets the amount of seconds a portal should be active before automatically deactivating + * + * @return

The active time of a gate

+ */ + public int getActiveTime() { + return activeTime; + } + /** * Gets the maximum number of gates allowed on each network * diff --git a/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java b/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java index c2ad0a4..ac734eb 100644 --- a/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java +++ b/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java @@ -20,7 +20,7 @@ public class StarGateThread implements Runnable { if (portal.getOptions().isAlwaysOn() || !portal.isOpen()) { continue; } - if (time > portal.getActivatedTime() + Stargate.getOpenTime()) { + if (time > portal.getActivatedTime() + Stargate.getGateConfig().getOpenTime()) { portal.getPortalOpener().closePortal(false); iterator.remove(); } @@ -31,7 +31,7 @@ public class StarGateThread implements Runnable { if (!portal.getPortalActivator().isActive()) { continue; } - if (time > portal.getActivatedTime() + Stargate.getActiveTime()) { + if (time > portal.getActivatedTime() + Stargate.getGateConfig().getActiveTime()) { portal.getPortalActivator().deactivate(); iterator.remove(); }