mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-26 11:08:08 +01:00
Refactored class variable assignment in constructors for ServerInfo
This commit is contained in:
parent
d677fb816e
commit
efda292a37
@ -28,11 +28,12 @@ public class BukkitServerInfo extends ServerInfo {
|
||||
private ServerInfoFile serverInfoFile;
|
||||
private Database database;
|
||||
|
||||
BukkitServerInfo() {
|
||||
public BukkitServerInfo(Plan plugin) {
|
||||
this(new ServerProperties(plugin.getServer()));
|
||||
}
|
||||
|
||||
public BukkitServerInfo(Plan plugin) {
|
||||
serverProperties = new ServerProperties(plugin.getServer());
|
||||
public BukkitServerInfo(ServerProperties serverProperties) {
|
||||
super(serverProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ import java.util.UUID;
|
||||
public class BungeeServerInfo extends ServerInfo {
|
||||
|
||||
public BungeeServerInfo(PlanBungee plugin) {
|
||||
serverProperties = new ServerProperties(plugin.getProxy());
|
||||
super(new ServerProperties(plugin.getProxy()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,7 +44,7 @@ public class BungeeServerInfo extends ServerInfo {
|
||||
return server;
|
||||
}
|
||||
|
||||
private void updateServerInfo(Database db) throws DBException {
|
||||
private void updateServerInfo(Database db) {
|
||||
String accessAddress = WebServerSystem.getInstance().getWebServer().getAccessAddress();
|
||||
if (!accessAddress.equals(server.getWebAddress())) {
|
||||
server.setWebAddress(accessAddress);
|
||||
@ -61,7 +61,7 @@ public class BungeeServerInfo extends ServerInfo {
|
||||
}
|
||||
}
|
||||
|
||||
private Server registerBungeeInfo(Database db) throws DBException, EnableException {
|
||||
private Server registerBungeeInfo(Database db) throws EnableException {
|
||||
ServerProperties properties = ServerInfo.getServerProperties();
|
||||
UUID serverUUID = generateNewUUID(properties);
|
||||
String accessAddress = WebServerSystem.getInstance().getWebServer().getAccessAddress();
|
||||
|
@ -23,6 +23,10 @@ public abstract class ServerInfo implements SubSystem {
|
||||
protected Server server;
|
||||
protected ServerProperties serverProperties;
|
||||
|
||||
public ServerInfo(ServerProperties serverProperties) {
|
||||
this.serverProperties = serverProperties;
|
||||
}
|
||||
|
||||
public static ServerInfo getInstance() {
|
||||
ServerInfo serverInfo = PlanSystem.getInstance().getServerInfo();
|
||||
Verify.nullCheck(serverInfo, () -> new IllegalStateException("ServerInfo was not initialized."));
|
||||
|
@ -5,6 +5,6 @@ import org.spongepowered.api.Sponge;
|
||||
public class SpongeServerInfo extends BukkitServerInfo {
|
||||
|
||||
public SpongeServerInfo() {
|
||||
serverProperties = new ServerProperties(Sponge.getGame());
|
||||
super(new ServerProperties(Sponge.getGame()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user