Fixed Enable for Bukkit. Also fixed placing wrong address in database #469

This commit is contained in:
Rsl1122 2017-12-14 16:16:13 +02:00
parent c84ad59da4
commit 3fb21b1d1e
6 changed files with 19 additions and 24 deletions

View File

@ -55,7 +55,6 @@ import main.java.com.djrapitops.plan.systems.listeners.*;
import main.java.com.djrapitops.plan.systems.processing.Processor;
import main.java.com.djrapitops.plan.systems.processing.importing.importers.OfflinePlayerImporter;
import main.java.com.djrapitops.plan.systems.queue.ProcessingQueue;
import main.java.com.djrapitops.plan.systems.tasks.TPSCountTimer;
import main.java.com.djrapitops.plan.systems.tasks.TaskSystem;
import main.java.com.djrapitops.plan.systems.update.VersionCheckSystem;
import main.java.com.djrapitops.plan.systems.webserver.WebServer;
@ -92,8 +91,6 @@ public class Plan extends BukkitPlugin implements IPlan {
private BukkitServerInfoManager serverInfoManager;
private ServerVariableHolder serverVariableHolder;
private TPSCountTimer tpsCountTimer;
private int bootAnalysisTaskID = -1;
/**
* Used to get the PlanAPI. @see API
@ -353,10 +350,6 @@ public class Plan extends BukkitPlugin implements IPlan {
return processingQueue;
}
public TPSCountTimer getTpsCountTimer() {
return tpsCountTimer;
}
public void addToProcessQueue(Processor... processors) {
if (!reloading) {
for (Processor processor : processors) {

View File

@ -9,7 +9,7 @@ import com.djrapitops.plugin.settings.ColorScheme;
import main.java.com.djrapitops.plan.settings.Settings;
/**
* //TODO Class Javadoc Comment
* ColorScheme that uses values in config settings specific to Plan or PlanBungee.
*
* @author Rsl1122
*/

View File

@ -54,7 +54,7 @@ public class Systems {
taskSystem = new PlanTaskSystem();
webServerSystem = new WebServerSystem(plugin);
webServerSystem = new WebServerSystem();
themeSystem = new Theme();
}
@ -71,7 +71,7 @@ public class Systems {
taskSystem = new PlanBungeeTaskSystem();
webServerSystem = new WebServerSystem(plugin);
webServerSystem = new WebServerSystem();
themeSystem = new Theme();
}
@ -79,8 +79,11 @@ public class Systems {
return new SubSystem[]{
fileSystem,
configSystem,
versionCheckSystem,
databaseSystem,
webServerSystem
taskSystem,
webServerSystem,
themeSystem
};
}

View File

@ -42,13 +42,6 @@ public class BukkitServerInfoManager {
} catch (IOException e) {
throw new PlanEnableException("Failed to read ServerInfoFile.yml", e);
}
try {
updateServerInfo();
} catch (SQLException e) {
throw new PlanEnableException("Failed to update Database server info", e);
} catch (IOException e) {
throw new PlanEnableException("Failed to write to ServerInfoFile.yml", e);
}
}
public void updateServerInfo() throws SQLException, IOException {

View File

@ -7,6 +7,7 @@ import main.java.com.djrapitops.plan.data.container.Session;
import main.java.com.djrapitops.plan.systems.cache.DataCache;
import main.java.com.djrapitops.plan.systems.processing.info.NetworkPageUpdateProcessor;
import main.java.com.djrapitops.plan.systems.processing.player.*;
import main.java.com.djrapitops.plan.systems.tasks.TaskSystem;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -103,7 +104,7 @@ public class PlanPlayerListener implements Listener {
String playerName = player.getName();
String displayName = player.getDisplayName();
int playersOnline = plugin.getTpsCountTimer().getLatestPlayersOnline();
int playersOnline = TaskSystem.getInstance().getTpsCountTimer().getLatestPlayersOnline();
cache.cacheSession(uuid, Session.start(time, world, gm));
plugin.addToProcessQueue(

View File

@ -5,10 +5,10 @@
package main.java.com.djrapitops.plan.systems.webserver;
import com.djrapitops.plugin.api.Check;
import main.java.com.djrapitops.plan.api.IPlan;
import main.java.com.djrapitops.plan.api.exceptions.PlanEnableException;
import main.java.com.djrapitops.plan.systems.SubSystem;
import main.java.com.djrapitops.plan.systems.Systems;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
/**
* //TODO Class Javadoc Comment
@ -19,8 +19,8 @@ public class WebServerSystem implements SubSystem {
private WebServer webServer;
public WebServerSystem(IPlan plugin) {
webServer = new WebServer(plugin);
public WebServerSystem() {
}
public static WebServerSystem getInstance() {
@ -29,6 +29,7 @@ public class WebServerSystem implements SubSystem {
@Override
public void init() throws PlanEnableException {
webServer = new WebServer(MiscUtils.getIPlan());
webServer.initServer();
if (Check.isBungeeAvailable() && !webServer.isEnabled()) {
throw new PlanEnableException("WebServer did not initialize!");
@ -37,11 +38,15 @@ public class WebServerSystem implements SubSystem {
@Override
public void close() {
webServer.stop();
// TODO Remove after WebServer setting requirement is gone.
if (webServer != null) {
webServer.stop();
}
}
public static boolean isWebServerEnabled() {
return getInstance().webServer.isEnabled();
WebServer webServer = getInstance().webServer;
return webServer != null && webServer.isEnabled();
}
public WebServer getWebServer() {