mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-20 19:52:45 +02:00
Sponge config values and renamed some Systems to more generic names.
This commit is contained in:
parent
f4c3f804cd
commit
cb9c99108d
|
@ -9,13 +9,13 @@ import com.djrapitops.plan.ShutdownHook;
|
|||
import com.djrapitops.plan.api.ServerAPI;
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import com.djrapitops.plan.system.database.BukkitDBSystem;
|
||||
import com.djrapitops.plan.system.database.ServerDBSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.info.BukkitInfoSystem;
|
||||
import com.djrapitops.plan.system.info.ServerInfoSystem;
|
||||
import com.djrapitops.plan.system.info.server.BukkitServerInfo;
|
||||
import com.djrapitops.plan.system.listeners.BukkitListenerSystem;
|
||||
import com.djrapitops.plan.system.settings.PlanErrorManager;
|
||||
import com.djrapitops.plan.system.settings.config.BukkitConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.config.ServerConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.network.NetworkSettings;
|
||||
import com.djrapitops.plan.system.tasks.BukkitTaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
|
@ -37,12 +37,12 @@ public class BukkitSystem extends PlanSystem implements ServerSystem {
|
|||
|
||||
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
|
||||
fileSystem = new FileSystem(plugin);
|
||||
configSystem = new BukkitConfigSystem();
|
||||
databaseSystem = new BukkitDBSystem();
|
||||
configSystem = new ServerConfigSystem();
|
||||
databaseSystem = new ServerDBSystem();
|
||||
listenerSystem = new BukkitListenerSystem(plugin);
|
||||
taskSystem = new BukkitTaskSystem(plugin);
|
||||
|
||||
infoSystem = new BukkitInfoSystem();
|
||||
infoSystem = new ServerInfoSystem();
|
||||
serverInfo = new BukkitServerInfo(plugin);
|
||||
|
||||
hookHandler = new HookHandler();
|
||||
|
|
|
@ -9,13 +9,13 @@ import com.djrapitops.plan.ShutdownHook;
|
|||
import com.djrapitops.plan.api.ServerAPI;
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import com.djrapitops.plan.system.database.BukkitDBSystem;
|
||||
import com.djrapitops.plan.system.database.ServerDBSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.info.BukkitInfoSystem;
|
||||
import com.djrapitops.plan.system.info.ServerInfoSystem;
|
||||
import com.djrapitops.plan.system.info.server.SpongeServerInfo;
|
||||
import com.djrapitops.plan.system.listeners.SpongeListenerSystem;
|
||||
import com.djrapitops.plan.system.settings.PlanErrorManager;
|
||||
import com.djrapitops.plan.system.settings.config.BukkitConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.config.SpongeConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.network.NetworkSettings;
|
||||
import com.djrapitops.plan.system.tasks.SpongeTaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
|
@ -29,6 +29,8 @@ import com.djrapitops.plugin.api.utility.log.Log;
|
|||
*/
|
||||
public class SpongeSystem extends PlanSystem implements ServerSystem {
|
||||
|
||||
private boolean firstInstall = false;
|
||||
|
||||
public SpongeSystem(PlanSponge plugin) {
|
||||
testSystem = this;
|
||||
|
||||
|
@ -36,12 +38,12 @@ public class SpongeSystem extends PlanSystem implements ServerSystem {
|
|||
|
||||
versionCheckSystem = new VersionCheckSystem(plugin.getVersion());
|
||||
fileSystem = new FileSystem(plugin);
|
||||
configSystem = new BukkitConfigSystem();
|
||||
databaseSystem = new BukkitDBSystem();
|
||||
configSystem = new SpongeConfigSystem();
|
||||
databaseSystem = new ServerDBSystem();
|
||||
listenerSystem = new SpongeListenerSystem(plugin);
|
||||
taskSystem = new SpongeTaskSystem(plugin);
|
||||
|
||||
infoSystem = new BukkitInfoSystem();
|
||||
infoSystem = new ServerInfoSystem();
|
||||
serverInfo = new SpongeServerInfo();
|
||||
|
||||
hookHandler = new HookHandler();
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.djrapitops.plan.system.settings.Settings;
|
|||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class BukkitDBSystem extends DBSystem {
|
||||
public class ServerDBSystem extends DBSystem {
|
||||
|
||||
@Override
|
||||
protected void initDatabase() throws DBInitException {
|
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.system.info;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.info.connection.BukkitConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.connection.ServerConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.request.CacheNetworkPageContentRequest;
|
||||
import com.djrapitops.plan.system.info.request.InfoRequest;
|
||||
import com.djrapitops.plan.system.info.request.SetupRequest;
|
||||
|
@ -19,10 +19,10 @@ import com.djrapitops.plugin.api.utility.log.Log;
|
|||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class BukkitInfoSystem extends InfoSystem {
|
||||
public class ServerInfoSystem extends InfoSystem {
|
||||
|
||||
public BukkitInfoSystem() {
|
||||
super(new BukkitConnectionSystem());
|
||||
public ServerInfoSystem() {
|
||||
super(new ServerConnectionSystem());
|
||||
}
|
||||
|
||||
@Override
|
|
@ -28,13 +28,13 @@ import java.util.UUID;
|
|||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class BukkitConnectionSystem extends ConnectionSystem {
|
||||
public class ServerConnectionSystem extends ConnectionSystem {
|
||||
|
||||
private long latestServerMapRefresh;
|
||||
|
||||
private Server mainServer;
|
||||
|
||||
public BukkitConnectionSystem() {
|
||||
public ServerConnectionSystem() {
|
||||
latestServerMapRefresh = 0;
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ public enum Settings {
|
|||
FORMAT_DATE_RECENT_DAYS("Customization.Formatting.Dates.RecentDays"),
|
||||
DISPLAY_PLAYER_IPS("Customization.Display.PlayerIPs"),
|
||||
DISPLAY_GAPS_IN_GRAPH_DATA("Customization.Display.GapsInGraphData"),
|
||||
DATA_GEOLOCATIONS("Data.Geolocations"),
|
||||
|
||||
// Integer
|
||||
WEBSERVER_PORT("WebServer.Port"),
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.io.IOException;
|
|||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class BukkitConfigSystem extends ConfigSystem {
|
||||
public class ServerConfigSystem extends ConfigSystem {
|
||||
|
||||
@Override
|
||||
protected void copyDefaults() throws IOException {
|
|
@ -0,0 +1,35 @@
|
|||
package com.djrapitops.plan.system.settings.config;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Sponge ConfigSystem that disables WebServer and Geolocations on first enable.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SpongeConfigSystem extends ServerConfigSystem {
|
||||
|
||||
private boolean firstInstall;
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
firstInstall = !FileSystem.getConfigFile().exists();
|
||||
super.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyDefaults() throws IOException {
|
||||
super.copyDefaults();
|
||||
if (firstInstall) {
|
||||
Log.info("WebServer and Geolocations disabled by default. Please enable them in the config.");
|
||||
Settings.WEBSERVER_DISABLED.set(true);
|
||||
Settings.DATA_GEOLOCATIONS.set(false);
|
||||
Settings.save();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ import com.djrapitops.plan.Plan;
|
|||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.database.BukkitDBSystem;
|
||||
import com.djrapitops.plan.system.database.ServerDBSystem;
|
||||
import com.djrapitops.plan.system.info.request.GenerateInspectPageRequest;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
|
@ -97,7 +97,7 @@ public class BungeeBukkitConnectionTest {
|
|||
Settings.WEBSERVER_PORT.setTemporaryValue(9250);
|
||||
Settings.BUNGEE_IP.setTemporaryValue("localhost");
|
||||
Settings.DB_TYPE.setTemporaryValue("sqlite");
|
||||
bungeeSystem.setDatabaseSystem(new BukkitDBSystem());
|
||||
bungeeSystem.setDatabaseSystem(new ServerDBSystem());
|
||||
|
||||
bungeeSystem.enable();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.system;
|
|||
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.database.BukkitDBSystem;
|
||||
import com.djrapitops.plan.system.database.ServerDBSystem;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import org.junit.*;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
@ -63,7 +63,7 @@ public class BungeeSystemTest {
|
|||
Settings.WEBSERVER_PORT.setTemporaryValue(9005);
|
||||
Settings.BUNGEE_IP.setTemporaryValue("8.8.8.8");
|
||||
Settings.DB_TYPE.setTemporaryValue("sqlite");
|
||||
bungeeSystem.setDatabaseSystem(new BukkitDBSystem());
|
||||
bungeeSystem.setDatabaseSystem(new ServerDBSystem());
|
||||
|
||||
bungeeSystem.enable();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class BungeeSystemTest {
|
|||
|
||||
Settings.WEBSERVER_PORT.setTemporaryValue(9005);
|
||||
Settings.DB_TYPE.setTemporaryValue("sqlite");
|
||||
bungeeSystem.setDatabaseSystem(new BukkitDBSystem());
|
||||
bungeeSystem.setDatabaseSystem(new ServerDBSystem());
|
||||
|
||||
bungeeSystem.enable();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user