Moved task system

This commit is contained in:
Rsl1122 2018-01-13 13:51:52 +02:00
parent 0e80545e91
commit 8f6b196b60
14 changed files with 40 additions and 21 deletions

View File

@ -47,7 +47,7 @@ import com.djrapitops.plan.systems.info.BukkitInformationManager;
import com.djrapitops.plan.systems.info.ImporterManager;
import com.djrapitops.plan.systems.info.InformationManager;
import com.djrapitops.plan.systems.info.server.BukkitServerInfoManager;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plan.utilities.file.export.HtmlExport;
import com.djrapitops.plan.utilities.metrics.BStats;
import com.djrapitops.plugin.BukkitPlugin;
@ -357,6 +357,7 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
return ConfigSystem.getInstance().getConfig();
}
@Deprecated
public InformationManager getInfoManager() {
return infoManager;
}

View File

@ -24,7 +24,7 @@ import com.djrapitops.plan.systems.Systems;
import com.djrapitops.plan.systems.info.BungeeInformationManager;
import com.djrapitops.plan.systems.info.InformationManager;
import com.djrapitops.plan.systems.info.server.BungeeServerInfoManager;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plan.utilities.file.export.HtmlExport;
import com.djrapitops.plugin.BungeePlugin;
import com.djrapitops.plugin.StaticHolder;

View File

@ -10,6 +10,7 @@ import com.djrapitops.plan.system.file.FileSystem;
import com.djrapitops.plan.system.listeners.ListenerSystem;
import com.djrapitops.plan.system.processing.ProcessingQueue;
import com.djrapitops.plan.system.settings.config.ConfigSystem;
import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plan.system.update.VersionCheckSystem;
import com.djrapitops.plan.utilities.NullCheck;
import com.djrapitops.plugin.api.Check;
@ -33,6 +34,7 @@ public abstract class PlanSystem implements SubSystem {
protected DBSystem databaseSystem;
protected ListenerSystem listenerSystem;
protected TaskSystem taskSystem;
public PlanSystem() {
processingQueue = new ProcessingQueue();
@ -48,12 +50,14 @@ public abstract class PlanSystem implements SubSystem {
databaseSystem.enable();
processingQueue.enable();
listenerSystem.enable();
taskSystem.enable();
}
@Override
public void disable() {
processingQueue.disable();
databaseSystem.disable();
taskSystem.disable();
configSystem.disable();
fileSystem.disable();
versionCheckSystem.disable();
@ -114,4 +118,8 @@ public abstract class PlanSystem implements SubSystem {
public ListenerSystem getListenerSystem() {
return listenerSystem;
}
public TaskSystem getTaskSystem() {
return taskSystem;
}
}

View File

@ -1,10 +1,18 @@
package com.djrapitops.plan.system.listeners;
import com.djrapitops.plan.system.PlanSystem;
import com.djrapitops.plan.system.SubSystem;
import com.djrapitops.plan.utilities.NullCheck;
import com.djrapitops.plugin.api.Benchmark;
public abstract class ListenerSystem implements SubSystem {
public static ListenerSystem getInstance() {
ListenerSystem listenerSystem = PlanSystem.getInstance().getListenerSystem();
NullCheck.check(listenerSystem, new IllegalStateException("Listener system was not initialized."));
return listenerSystem;
}
@Override
public void enable() {
Benchmark.start("Register Listeners");

View File

@ -5,7 +5,7 @@ import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.processing.processors.info.NetworkPageUpdateProcessor;
import com.djrapitops.plan.system.processing.processors.player.*;
import com.djrapitops.plan.systems.cache.DataCache;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.systems.NotificationCenter;
import com.djrapitops.plugin.api.utility.log.Log;

View File

@ -2,7 +2,7 @@
* Licence is provided in the jar as license.yml also here:
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
*/
package com.djrapitops.plan.systems.tasks;
package com.djrapitops.plan.system.tasks;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.settings.locale.Locale;
@ -21,7 +21,7 @@ import com.djrapitops.plugin.task.RunnableFactory;
*
* @author Rsl1122
*/
public class PlanTaskSystem extends TaskSystem {
public class BukkitTaskSystem extends TaskSystem {
// TODO Remove Plan.getInstance requirement.

View File

@ -2,7 +2,7 @@
* Licence is provided in the jar as license.yml also here:
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
*/
package com.djrapitops.plan.systems.tasks;
package com.djrapitops.plan.system.tasks;
import com.djrapitops.plan.PlanBungee;
import com.djrapitops.plan.systems.info.BungeeInformationManager;
@ -14,7 +14,7 @@ import com.djrapitops.plugin.task.AbsRunnable;
*
* @author Rsl1122
*/
public class PlanBungeeTaskSystem extends TaskSystem {
public class BungeeTaskSystem extends TaskSystem {
@Override
public void enable() {

View File

@ -1,4 +1,4 @@
package com.djrapitops.plan.systems.tasks;
package com.djrapitops.plan.system.tasks;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanBungee;

View File

@ -2,10 +2,11 @@
* Licence is provided in the jar as license.yml also here:
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
*/
package com.djrapitops.plan.systems.tasks;
package com.djrapitops.plan.system.tasks;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.system.PlanSystem;
import com.djrapitops.plan.system.SubSystem;
import com.djrapitops.plan.systems.Systems;
import com.djrapitops.plugin.api.systems.TaskCenter;
import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.task.IRunnable;
@ -21,7 +22,7 @@ public abstract class TaskSystem implements SubSystem {
protected TPSCountTimer tpsCountTimer;
public static TaskSystem getInstance() {
return Systems.getInstance().getTaskSystem();
return PlanSystem.getInstance().getTaskSystem();
}
protected IRunnable registerTask(AbsRunnable runnable) {

View File

@ -17,9 +17,9 @@ import com.djrapitops.plan.system.settings.config.BungeeConfigSystem;
import com.djrapitops.plan.system.settings.config.ConfigSystem;
import com.djrapitops.plan.system.update.VersionCheckSystem;
import com.djrapitops.plan.system.webserver.WebServerSystem;
import com.djrapitops.plan.systems.tasks.PlanBungeeTaskSystem;
import com.djrapitops.plan.systems.tasks.PlanTaskSystem;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.system.tasks.BungeeTaskSystem;
import com.djrapitops.plan.system.tasks.BukkitTaskSystem;
import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plugin.api.utility.log.Log;
import org.apache.commons.lang3.ArrayUtils;
@ -52,7 +52,7 @@ public class Systems {
databaseSystem = new BukkitDBSystem();
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
taskSystem = new PlanTaskSystem();
taskSystem = new BukkitTaskSystem();
webServerSystem = new WebServerSystem();
themeSystem = new Theme();
@ -69,7 +69,7 @@ public class Systems {
databaseSystem = new BungeeDBSystem();
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
taskSystem = new PlanBungeeTaskSystem();
taskSystem = new BungeeTaskSystem();
webServerSystem = new WebServerSystem();
themeSystem = new Theme();

View File

@ -21,6 +21,7 @@ import java.util.*;
*
* @author Rsl1122
*/
@Deprecated
public abstract class InformationManager {
boolean usingAnotherWebServer;
String webServerAddress;

View File

@ -16,8 +16,8 @@ import com.djrapitops.plan.systems.cache.DataCache;
import com.djrapitops.plan.systems.cache.SessionCache;
import com.djrapitops.plan.systems.info.BukkitInformationManager;
import com.djrapitops.plan.systems.info.InformationManager;
import com.djrapitops.plan.systems.tasks.PlanTaskSystem;
import com.djrapitops.plan.systems.tasks.TaskSystem;
import com.djrapitops.plan.system.tasks.BukkitTaskSystem;
import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.api.Benchmark;
import com.djrapitops.plugin.api.utility.log.Log;
@ -55,7 +55,7 @@ public class Analysis {
return;
}
((PlanTaskSystem) TaskSystem.getInstance()).cancelBootAnalysis();
((BukkitTaskSystem) TaskSystem.getInstance()).cancelBootAnalysis();
Benchmark.start("Analysis");
log(Locale.get(Msg.ANALYSIS_START).toString());

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.utilities.html.graphs.line;
import com.djrapitops.plan.data.container.TPS;
import com.djrapitops.plan.systems.tasks.TPSCountTimer;
import com.djrapitops.plan.system.tasks.TPSCountTimer;
import com.djrapitops.plan.utilities.analysis.Point;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.djrapitops.plan.utilities.html.graphs.line;
import com.djrapitops.plan.data.container.TPS;
import com.djrapitops.plan.systems.tasks.TPSCountTimer;
import com.djrapitops.plan.system.tasks.TPSCountTimer;
import com.djrapitops.plan.utilities.analysis.Point;
import java.util.List;